|
From: Pavel Machek on 7 May 2008 05:40 Hi! > From: Rafael J. Wysocki <rjw(a)sisk.pl> > > The freezer currently attempts to distinguish kernel threads from > user space tasks by checking if their mm pointer is unset and it > does not send fake signals to kernel threads. However, there are > kernel threads, mostly related to networking, that behave like > user space tasks and may want to be sent a fake signal to be frozen. > > Introduce the new process flag PF_FREEZER_NOSIG that will be set > by default for all kernel threads and make the freezer only send > fake signals to the tasks having PF_FREEZER_NOSIG unset. Provide > the set_freezable_with_signal() function to be called by the kernel > threads that want to be sent a fake signal for freezing. > > This patch should not change the freezer's observable behavior. > > Signed-off-by: Rafael J. Wysocki <rjw(a)sisk.pl> ACK. > -static int has_mm(struct task_struct *p) > +static inline bool should_send_signal(struct task_struct *p) > { > - return (p->mm && !(p->flags & PF_BORROWED_MM)); > + return !(current->flags & PF_FREEZER_NOSIG); > } > Note that we used to tell kernel threads by ->mm, and now you assume that anything created by ktrheadd is kernel thread, ->mm or not. I'm not sure if those can differ (->mm = NULL somewhere? Or ->mm = something somewhere else?). I guess this should go to -mm for a long test... > @@ -234,7 +234,7 @@ int kthreadd(void *unused) > set_user_nice(tsk, KTHREAD_NICE_LEVEL); > set_cpus_allowed(tsk, CPU_MASK_ALL); > > - current->flags |= PF_NOFREEZE; > + current->flags |= PF_NOFREEZE | PF_FREEZER_NOSIG; > > for (;;) { > set_current_state(TASK_INTERRUPTIBLE); Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Rafael J. Wysocki on 7 May 2008 08:20 On Wednesday, 7 of May 2008, Pavel Machek wrote: > Hi! Hi, > > From: Rafael J. Wysocki <rjw(a)sisk.pl> > > > > The freezer currently attempts to distinguish kernel threads from > > user space tasks by checking if their mm pointer is unset and it > > does not send fake signals to kernel threads. However, there are > > kernel threads, mostly related to networking, that behave like > > user space tasks and may want to be sent a fake signal to be frozen. > > > > Introduce the new process flag PF_FREEZER_NOSIG that will be set > > by default for all kernel threads and make the freezer only send > > fake signals to the tasks having PF_FREEZER_NOSIG unset. Provide > > the set_freezable_with_signal() function to be called by the kernel > > threads that want to be sent a fake signal for freezing. > > > > This patch should not change the freezer's observable behavior. > > > > Signed-off-by: Rafael J. Wysocki <rjw(a)sisk.pl> > > ACK. Thanks! > > -static int has_mm(struct task_struct *p) > > +static inline bool should_send_signal(struct task_struct *p) > > { > > - return (p->mm && !(p->flags & PF_BORROWED_MM)); > > + return !(current->flags & PF_FREEZER_NOSIG); > > } > > > > Note that we used to tell kernel threads by ->mm, and now you assume > that anything created by ktrheadd is kernel thread, ->mm or not. > > I'm not sure if those can differ (->mm = NULL somewhere? Or ->mm = > something somewhere else?). It's done in analogy with PF_NOFREEZE, ie. everything that has set PF_NOFREEZE by default also has PF_FREEZER_NOSIG set by default, so I really don't expect any problems here. > I guess this should go to -mm for a long test... Yes, it should. Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: possible regression of ptrace on 2.6.26-rc1 Next: Freezer: Try to handle killable tasks |