lkml.org 
[lkml]   [2004]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectalloc_pidmap() query
From
Date
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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.019 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site