Re: [RFC][PATCH -mm 1/5] PM: Make freeze_processes SMP-safe

Luca
2006-11-26T23:37:10Z

On 11/26/06, Pavel Machek <pavel@ucw.cz> wrote:
===================================================================
> > --- linux-2.6.19-rc6-mm1.orig/include/linux/sched.h
> > +++ linux-2.6.19-rc6-mm1/include/linux/sched.h
> > @@ -1065,6 +1065,9 @@ struct task_struct {
> > #ifdef CONFIG_TASK_DELAY_ACCT
> > struct task_delay_info *delays;
> > #endif
> > +#ifdef CONFIG_PM
> > + int freezing; /* if set, we should be freezing for suspend */
> > +#endif
> > #ifdef CONFIG_FAULT_INJECTION
> > int make_it_fail;
> > #endif
>
> It is int, imagine machine that can't do 32-bit atomic access (only
> does 64 bits). On such beast (alpha? something stranger?) this will
> clobber make_it_fail field, sometimes.
>
> OTOH on i386 normal instructions can be used. But that's okay, we
> should just use atomic_t here. Should be as fast on i386/x86-64, and
> still safe.

What about using lock_task_sighand()? This should protect us against
->flags manipulation due to signals without the need of an extra
field.

Luca