[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110425115253.GP17734@mtj.dyndns.org>
Date: Mon, 25 Apr 2011 13:52:53 +0200
From: Tejun Heo <tj@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"Nikita V. Youshchenko" <nyoushchenko@...sta.com>,
Matt Fleming <matt@...sole-pimps.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] signal: do_sigtimedwait() needs
retarget_shared_pending()
Hello,
On Sat, Apr 23, 2011 at 08:00:00PM +0200, Oleg Nesterov wrote:
> do_sigtimedwait() changes current->blocked and thus it needs
> set_current_bloked()->retarget_shared_pending().
>
> We could use set_current_bloked() directly. It is fine to change
> ->real_blocked from all-zeroes to ->blocked and vice versa lockless,
> but this is not immediately clear, looks racy, and needs a huge
> comment to explain why this is correct.
>
> To keep the things simple this patch adds the new static helper,
> __set_task_blocked() which should be called with ->siglock held. This
> way we can change both ->real_blocked and ->blocked atomically under
> ->siglock as the current code does. This is more understandable.
>
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
Acked-by: Tejun Heo <tj@...nel.org>
> @@ -2322,7 +2327,8 @@ int do_sigtimedwait(sigset_t *these, sig
> /*
> * None ready -- temporarily unblock those we're
> * interested while we are sleeping in so that we'll
> - * be awakened when they arrive.
> + * be awakened when they arrive. Unblocking is always
> + * fine, we can avoid set_current_blocked().
> */
> tsk->real_blocked = tsk->blocked;
> sigandsets(&tsk->blocked, &tsk->blocked, these);
Maybe it would be a good idea to introduce a new helper which checks /
enforces that the operation indeed is only unblocking? Also, it can
be a pure preference but I think _locked suffix is better / more
common for APIs which expect the caller to be responsible for locking.
Thanks.
--
tejun
--
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