Re: [RFC] Fix SMP brokenness for PF_FREEZE and make freezing usable for other purposes

Pavel Machek
2005-06-27T14:13:20Z

Hi!

> > It's called "work", and we have the "TIF_xxx" flags for it. That's how
> > "need-resched" and "sigpending" are done. There could be a
> > "TIF_FREEZEPENDING" thing there too..
>
> Ok. Here is yet another version of the patch:
>
> ---
> The current suspend code modifies thread flags from outside the context of process.
> This creates a SMP race.
>
> The patch fixes that by introducing a TIF_FREEZE flag (for all arches). Also
>
> - Uses a completion handler instead of waiting in a schedule loop in the refrigerator.
>
> - Introduces a semaphore freezer_sem to provide a way that multiple kernel
> subsystems can use the freezing ability without interfering with one another.
>
> - Include necessary definitions for the migration code if CONFIG_MIGRATE is set.
>
> - Removes PF_FREEZE
>
> If this approach is okay then we will need to move the refrigerator() and the
> definition of the semaphore and the completion variable out of kernel/power/process.c
> into kernel/sched.c (right?).

Approach seems okay... Perhaps better place is something like
kernel/freezer.c so it stays separate file? It is not really scheduler
core, and it is only conditionally compiled...
Pavel
--
Boycott Kodak -- for their patent abuse against Java.