[<prev] [next>] [day] [month] [year] [list]
Message-ID: <AANLkTim3GS+O9DnLZ+nh73DkoNnxa+pyAajjX2O-wb-X@mail.gmail.com>
Date: Sat, 25 Sep 2010 23:31:02 +0900
From: Namhyung Kim <namhyung@...il.com>
To: Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>
Cc: Al Viro <viro@...iv.linux.org.uk>,
Eric Dumazet <eric.dumazet@...il.com>,
Oleg Nesterov <oleg@...hat.com>,
Roland McGrath <roland@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] signal: annotate lock_task_sighand()
Add missing Cc.
On Sat, Sep 25, 2010 at 23:04, Namhyung Kim <namhyung@...il.com> wrote:
> lock_task_sighand() grabs sighand->siglock in case of returning
> non-NULL but unlock_task_sighand() releases it unconditionally.
> This leads sparse to complain about the lock context imbalance.
> Rename and wrap lock_task_sighand() using __cond_lock() macro
> to make sparse happy.
>
> Suggested-by: Eric Dumazet <eric.dumazet@...il.com>
> Signed-off-by: Namhyung Kim <namhyung@...il.com>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Roland McGrath <roland@...hat.com>
> ---
> include/linux/sched.h | 9 ++++++++-
> kernel/signal.c | 3 ++-
> 2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 1e2a6db..9937998 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -2210,9 +2210,16 @@ static inline void task_unlock(struct task_struct *p)
> spin_unlock(&p->alloc_lock);
> }
>
> -extern struct sighand_struct *lock_task_sighand(struct task_struct *tsk,
> +extern struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
> unsigned long *flags);
>
> +#define lock_task_sighand(tsk, flags) \
> +({ struct sighand_struct *__ss; \
> + __cond_lock(&(tsk)->sighand->siglock, \
> + (__ss = __lock_task_sighand(tsk, flags))); \
> + __ss; \
> +}) \
> +
> static inline void unlock_task_sighand(struct task_struct *tsk,
> unsigned long *flags)
> {
> diff --git a/kernel/signal.c b/kernel/signal.c
> index bded651..e4e8cfe 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1105,7 +1105,8 @@ int zap_other_threads(struct task_struct *p)
> return count;
> }
>
> -struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags)
> +struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
> + unsigned long *flags)
> {
> struct sighand_struct *sighand;
>
> --
> 1.7.2.2
>
>
--
Regards,
Namhyung Kim
--
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