[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1247596470.13426.16088.camel@nimitz>
Date: Tue, 14 Jul 2009 11:34:30 -0700
From: Dave Hansen <dave@...ux.vnet.ibm.com>
To: Ben Blum <bblum@...gle.com>
Cc: linux-kernel@...r.kernel.org,
containers@...ts.linux-foundation.org, akpm@...ux-foundation.org,
serue@...ibm.com, lizf@...fujitsu.com, menage@...gle.com
Subject: Re: [PATCH 1/3] Adds a read-only "procs" file similar to "tasks"
that shows only unique tgids
On Fri, 2009-07-10 at 16:01 -0700, Ben Blum wrote:
> +struct cgroup_pidlist {
> + /* protects the other fields */
> + struct rw_semaphore mutex;
> + /* array of xids */
> + pid_t *list;
> + /* how many elements the above list has */
> + int length;
> + /* how many files are using the current array */
> + int use_count;
> +};
I think a slightly nicer way of doing this would be to use a structure
like this:
#define NR_PIDS (PAGE_SIZE-sizeof(struct list_head))
struct pid_list {
struct list_head list;
pid_t pids[NR_PIDS];
};
That way, you can always kmalloc(sizeof(pid_list)), it fits nicely in
PAGE_SIZE, and you can chain them together.
Or, you could always just use one of the other flexible structures in
the kernel like a radix_tree.
-- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists