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

Pavel Machek
2006-11-29T23:56:26Z

On Mon 2006-11-27 21:02:38, Rafael J. Wysocki wrote:
> On Monday, 27 November 2006 11:50, Pavel Machek wrote:
> > Hi!
> >
> > > > > @@ -61,10 +60,13 @@ static inline void freeze_process(struct
> > > > > unsigned long flags;
> > > > >
> > > > > if (!freezing(p)) {
> > > > > - freeze(p);
> > > > > - spin_lock_irqsave(&p->sighand->siglock, flags);
> > > > > - signal_wake_up(p, 0);
> > > > > - spin_unlock_irqrestore(&p->sighand->siglock, flags);
> > > > > + rmb();
> > > >
> > > > If frozen is atomic_t, do we need memory barrier?
> > >
> > > I think so. For example on x86-64 atomic_read() is just a read.
> >
> > Sorry for one more change, but
> >
> >
> > /* set thread flags in other task's structures
> > * - see asm/thread_info.h for TIF_xxxx flags available
> > */
> > static inline void set_tsk_thread_flag(struct task_struct *tsk, int
> > flag)
> > {
> > set_ti_thread_flag(task_thread_info(tsk), flag);
> > }
> >
> > ...could we use set_tsk_thread_flag and friends to avoid enlarging
> > task struct?
>
> _Of_ _course_. [Heh, I didn't even know something like this existed. ;-)]

Well, of course I did not know, too.... I was just searching for
atomic_t semantics when I hit this by accident ;-).
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html