alloc_pidmap() query

From: Amol Lad
Date: Mon Apr 19 2004 - 05:11:55 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/