mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amol Lad <amol@teneoris.com>
To: linux-kernel@vger.kernel.org
Subject: alloc_pidmap() query
Date: 19 Apr 2004 15:40:20 +0530	[thread overview]
Message-ID: <1082369420.2308.6.camel@amol.teneoris.com> (raw)

Hi, 
 It seems in the alloc_pidmap() code (2.6), that for the first time when
the PIDs are allocated, the alternate entries in pidmap array is used.

Lets take an example,
    offset = pid & BITS_PER_PAGE_MASK;
    map = pidmap_array + pid / BITS_PER_PAGE;

  if pid == BITS_PER_PAGE, then we have
offset = 0;
map = pidmap_array[1];

as this is the first time allocation, so map->page == NULL,

Following code with get executed,

    if (!offset || !atomic_read(&map->nr_free)) {
next_map:
        map = next_free_map(map, &max_steps);
        if (!map)
            goto failure;
        offset = 0;
    }

This code will select pidmap_array[2] for pid selection even though no
pids are yet allocated from pidmap_array[1].

is this ok ?

please cc me
Amol




-- 
Linus's Law - Given enough eyeballs, all bugs are shallow.


                 reply	other threads:[~2004-04-19 10:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1082369420.2308.6.camel@amol.teneoris.com \
    --to=amol@teneoris.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®