[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20110124130529.903d9832.akpm@linux-foundation.org>
Date: Mon, 24 Jan 2011 13:05:29 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Ben Blum <bblum@...rew.cmu.edu>
Cc: linux-kernel@...r.kernel.org,
containers@...ts.linux-foundation.org, ebiederm@...ssion.com,
lizf@...fujitsu.com, matthltc@...ibm.com, menage@...gle.com,
oleg@...hat.com, David Rientjes <rientjes@...gle.com>,
Miao Xie <miaox@...fujitsu.com>
Subject: Re: [PATCH v7 1/3] cgroups: read-write lock CLONE_THREAD forking
per threadgroup
On Sun, 26 Dec 2010 07:09:51 -0500
Ben Blum <bblum@...rew.cmu.edu> wrote:
> Adds functionality to read/write lock CLONE_THREAD fork()ing per-threadgroup
>
> From: Ben Blum <bblum@...rew.cmu.edu>
>
> This patch adds an rwsem that lives in a threadgroup's signal_struct that's
> taken for reading in the fork path, under CONFIG_CGROUPS. If another part of
> the kernel later wants to use such a locking mechanism, the CONFIG_CGROUPS
> ifdefs should be changed to a higher-up flag that CGROUPS and the other system
> would both depend on.
>
> This is a pre-patch for cgroup-procs-write.patch.
>
> ...
>
> +/* See the declaration of threadgroup_fork_lock in signal_struct. */
> +#ifdef CONFIG_CGROUPS
> +static inline void threadgroup_fork_read_lock(struct task_struct *tsk)
> +{
> + down_read(&tsk->signal->threadgroup_fork_lock);
> +}
> +static inline void threadgroup_fork_read_unlock(struct task_struct *tsk)
> +{
> + up_read(&tsk->signal->threadgroup_fork_lock);
> +}
> +static inline void threadgroup_fork_write_lock(struct task_struct *tsk)
> +{
> + down_write(&tsk->signal->threadgroup_fork_lock);
> +}
> +static inline void threadgroup_fork_write_unlock(struct task_struct *tsk)
> +{
> + up_write(&tsk->signal->threadgroup_fork_lock);
> +}
> +#else
Risky. sched.h doesn't include rwsem.h.
We could make it do so, but almost every compilation unit in the kernel
includes sched.h. It would be nicer to make the kernel build
finer-grained, rather than blunter-grained. Don't be afraid to add new
header files if that is one way of doing this!
--
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