Re: [PATCH 01/23] tref: Implement task references.

From: Eric W. Biederman
Date: Fri Mar 03 2006 - 12:48:10 EST


Oleg Nesterov <oleg@xxxxxxxxxx> writes:

> Eric W. Biederman wrote:
>>
>> Oleg Nesterov <oleg@xxxxxxxxxx> writes:
>>
>> > I think there is another, much simpler solution. We can make a "reference"
> to
>> > the
>> > pid itself to protect it against free_pidmap(), so that this pid can't be
>> > reused.
>>
>> However with my trivial hostile program I can with 32 or 33 living processes
>> each with 1000 references to dead processes I can completely saturate the
>> default pid map. And it won't be obvious why alloc_pidmap is failing.
>
> Yes, this is a problem. Please see the new version below. Instead of delaying
> pid releasing, free_pidmap() just invalidates pid_ref. The code becomes even
> simpler.

And it removes most of my interaction problem with multiple pid spaces.

>> Your resource consumption with the extra hash table is higher than
>> mine at until very high process counts.
>
> The size of ref_array[] could be arbitrary low (we can't use pid_hashfn() in
> this case, of course). And tref adds 4 * sizeof(void*) to every task, and it
> is much more complicated.

I guess the worst case behavior would be triggered by a find in /proc.
Which would probably populate a ref for every pid, and it isn't that
uncommon. So I suspect we really want to make ref_array be able to
use pid hashfn as it is likely to get an equal amount of use.

More comments when I have time.

Eric
-
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/