mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* alloc_pidmap() query
@ 2004-04-19 10:10 Amol Lad
  0 siblings, 0 replies; only message in thread
From: Amol Lad @ 2004-04-19 10:10 UTC (permalink / raw)
  To: linux-kernel

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-04-19 10:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-19 10:10 alloc_pidmap() query Amol Lad

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®