Re: [RFC][PATCH 1/7][memcg] virtually indexed array library.

From: KAMEZAWA Hiroyuki
Date: Thu Jul 29 2010 - 00:31:59 EST

On Thu, 29 Jul 2010 09:32:26 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:

> On Wed, 28 Jul 2010 12:45:13 -0700
> Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> > My gut reaction to this sort of thing is "run away in terror". It
> > encourages kernel developers to operate like lackadaisical userspace
> > developers and to assume that underlying code can perform heroic and
> > immortal feats. But it can't. This is the kernel and the kernel is a
> > tough and hostile place and callers should be careful and defensive and
> > take great efforts to minimise the strain they put upon other systems.
> >
> > IOW, can we avoid doing this?
> >

I'll use pre-allocated pointer array in the next version. It's simple even
if a bit slow.

struct mem_cgroup *mem_cgroups[CONFIG_MAX_MEM_CGROUPS] __read_mostly;
#define id_to_memcg(id) mem_cgroups[id];
But this can use, can be quick.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at