Re: [PATCH] introduce sig_needs_tasklist() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"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);
	}

Oleg.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux