[PATCH 1/2] Adds a read-only "procs" file similar to "tasks" that shows only unique tgids

Paul Menage menage at google.com
Fri Jul 3 10:54:48 PDT 2009

On Fri, Jul 3, 2009 at 9:50 AM, Andrew Morton<akpm at linux-foundation.org> wrote:
> I think you're saying "for each pid N in the cgroup, set the Nth
> element in an IDR tree".


> 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.


More information about the Containers mailing list