Re: [PATCH 1/2] Adds a read-only "procs" file similar to "tasks" that shows only unique tgids
From: Paul Menage
Date: Fri Jul 03 2009 - 13:55:11 EST
On Fri, Jul 3, 2009 at 9:50 AM, Andrew Morton<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> I think you're saying "for each pid N in the cgroup, set the Nth
> element in an IDR tree".
Right.
> That would work. And it automatically gives
> ordered traversal and dupe removal.
>
> I don't think IDRs permit in-order traversal, whereas radix-trees do
> support this.
I thought that an IDR *was* a form of radix tree.
Looking at the IDR API it doesn't appear support the notion of "insert
an entry with id N" anyway.
> Unfortunately radix-trees are presented as operating on
> void* data, so one would need to do some typecasting when storing
> BITS_PER_LONG-sized bitfields inside them.
That would mean adding something a bit like the IDA wrapper that
converts IDR to deal with bitfields?
Is the benefit of avoiding a vmalloc() at all costs really worth the
additional complexity, versus just doing:
if (size > 2 * PAGE_SIZE) {
array = vmalloc(size);
} else {
array = kmalloc(size, GFP_KERNEL);
}
?
That would only require vmalloc on cgroups with >2048 tasks, which is
going to be pretty rare, and is way simpler.
Paul
--
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/