Re: [RFC][PATCH -mm 4/7] Freezer: Introduce freezer-firendly waiting macros

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

 



On Thursday, 12 July 2007 00:56, Pavel Machek wrote:
> Hi!
> 
> > From: Rafael J. Wysocki <rjw@xxxxxxx>
> > 
> > Introduce freezer-friendly wrappers around wait_event_interruptible() and
> > wait_event_interruptible_timeout(), originally defined in <linux/wait.h>, to
> > be used in freezable kernel threads.  Make some of the freezable kernel threads
> > use them.
> > 
> > This is necessary for the freezer to stop sending signals to kernel threads,
> > which is implemented in the next patch.
> > 
> > Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
> 
> ACK, but...
> 
> > +/*
> > + * Freezer-friendly wrappers around wait_event_interruptible() and
> > + * wait_event_interruptible_timeout(), originally defined in <linux/wait.h>
> > + */
> > +
> > +#define wait_event_freezable(wq, condition)				\
> > +({									\
> > +	int __ret;							\
> > +	do {								\
> > +		__ret = wait_event_interruptible(wq, 			\
> > +				(condition) || freezing(current));	\
> > +		try_to_freeze();					\
> > +	} while (!(condition));					\
> > +	__ret;								\
> > +})
> 
> ...
> 
> > Index: linux-2.6.22-rc6-mm1/drivers/media/dvb/dvb-core/dvb_frontend.c
> > ===================================================================
> > --- linux-2.6.22-rc6-mm1.orig/drivers/media/dvb/dvb-core/dvb_frontend.c	2007-07-11 20:48:04.000000000 +0200
> > +++ linux-2.6.22-rc6-mm1/drivers/media/dvb/dvb-core/dvb_frontend.c	2007-07-11 20:51:14.000000000 +0200
> > @@ -528,7 +528,8 @@ static int dvb_frontend_thread(void *dat
> >  		up(&fepriv->sem);	    /* is locked when we enter the thread... */
> >  restart:
> >  		timeout = wait_event_interruptible_timeout(fepriv->wait_queue,
> > -			dvb_frontend_should_wakeup(fe) || kthread_should_stop(),
> > +			dvb_frontend_should_wakeup(fe) || kthread_should_stop()
> > +				|| freezing(current),
> >  			fepriv->delay);
> 
> Should this use the new helper? This change does not seem to match the rest.

Yes, because it uses something like the new helper already, but with some code
in between., so I decided to add the freezing(current) only to it.

BTW, please see the updated patch in the reply to Oleg (the macros have been
fixed).

Greetings,
Rafael


-- 
"Premature optimization is the root of all evil." - Donald Knuth

_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux