Re: [RFC][PATCH -mm 2/6] Freezer: Do not send signals to kernel threads

Rafael J. Wysocki
2007-07-10T05:57:39Z

Hi,

On Tuesday, 10 July 2007 01:42, Pavel Machek wrote:
> Hi!
>
> > From: Rafael J. Wysocki <rjw@sisk.pl>
> >
> > Commit b74d0deb968e1f85942f17080eace015ce3c332c has changed
> > recalc_sigpending_tsk() so that it doesn't clear TIF_SIGPENDING. For this
> > reason, the freezer should not send fake signals to kernel threads any more,
> > since otherwise some of them may run with TIF_SIGPENDING set forever if the
> > freezing of kernel threads fails.
>
> Is there some bigger plan why we want this?
>
> I mean, it seems nicer w/o signals, but OTOH it is more lines of code
> and kernel/user freezing diverges. Can we just revert few lines,
> instead of inserting 100 lines?

I'm not sure what you mean.

AFAICS, commit b74d0deb968e1f85942f17080eace015ce3c332c is a bugfix and is not
reversible.

> > +/*
> > + * 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)); \
> > + } while (try_to_freeze()); \
> > + __ret; \
> > +})
> > +
> > +
> > +#define wait_event_freezable_timeout(wq, condition, timeout) \
> > +({ \
> > + long __ret = timeout; \
> > + do { \
> > + __ret = wait_event_interruptible_timeout(wq, \
> > + (condition) || freezing(current), \
> > + __ret); \
> > + } while (try_to_freeze()); \
> > + __ret; \
> > +})
>
> Hohum, but yes, these are nice.

:-)

Greetings,
Rafael

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