public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] introduce sig_needs_tasklist() helper
Date: Tue, 21 Feb 2006 10:40:17 -0800	[thread overview]
Message-ID: <20060221184017.GD1295@us.ibm.com> (raw)
In-Reply-To: <43FB5B15.F88FF5A8@tv-sign.ru>

On Tue, Feb 21, 2006 at 09:25:25PM +0300, Oleg Nesterov wrote:
> "Paul E. McKenney" wrote:
> > 
> > On Sat, Feb 18, 2006 at 09:12:04PM +0300, Oleg Nesterov wrote:
> > > +#define sig_needs_tasklist(sig) \
> > > +             (((sig) < SIGRTMIN)  && T(sig, SIG_KERNEL_STOP_MASK | M(SIGCONT)))
> > > +
> > 
> > Seems to me to be an improvement, but why not also encapsulate the
> > lock acquisition, something like:
> > 
> >         static inline int sig_tasklist_lock(int sig)
> >         {
> >                 if (unlikely(sig_needs_tasklist(sig)) {
> >                         read_lock(&tasklist_lock);
> >                         return 1;
> >                 }
> >                 return 0;
> >         }
> > 
> >         static inline void sig_tasklist_unlock(int acquired_tasklist_lock)
> >         {
> >                 if (acquired_tasklist_lock)
> >                         read_unlock(&tasklist_lock);
> >         }
> 
> I hope we will have
> 
> 	#define sig_needs_tasklist(sig)	  (sig == SIGCONT)
> 
> really soon (I planned to submit the final bits today, but
> for some stupid reasons I can't do anything till weekend),
> so I think it's better to kill 'acquired_tasklist_lock' and
> just do:
> 
> 	void sig_tasklist_lock(sig)
> 	{
> 		if (sig_needs_tasklist(sig))
> 			read_lock(&tasklist_lock);
> 	}
> 
> 	void sig_tasklist_unlock(sig)
> 	{
> 		if (sig_needs_tasklist(sig));
> 			read_unlock(&tasklist_lock);
> 	}

Even better!

						Thanx, Paul

      reply	other threads:[~2006-02-21 18:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-18 18:12 [PATCH] introduce sig_needs_tasklist() helper Oleg Nesterov
2006-02-21  2:13 ` Paul E. McKenney
2006-02-21 18:25   ` Oleg Nesterov
2006-02-21 18:40     ` Paul E. McKenney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060221184017.GD1295@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox