Re: [RFC PATCH(Experimental) 1/4] freezer-cpu-hotplug core

From: Oleg Nesterov
Date: Wed Feb 14 2007 - 14:48:56 EST


Gautham, I'll try to apply this patch and read the code on Sunday, right
now a couple of comments about workqueue.c changes.

On 02/14, Gautham R Shenoy wrote:
>
> --- hotplug.orig/kernel/workqueue.c
> +++ hotplug/kernel/workqueue.c
> @@ -368,6 +368,7 @@ static int worker_thread(void *__cwq)
> DEFINE_WAIT(wait);
> struct k_sigaction sa;
> sigset_t blocked;
> + int bind_cpu = smp_processor_id();
>
> if (!cwq->wq->freezeable)
> current->flags |= PF_NOFREEZE;
> @@ -392,8 +393,11 @@ static int worker_thread(void *__cwq)
> do_sigaction(SIGCHLD, &sa, (struct k_sigaction *)0);
>
> for (;;) {
> - if (cwq->wq->freezeable)
> + if (cwq->wq->freezeable) {

Else? This is wrong. The change like this should start from making all
cwq->threads freezeable, otherwise it just doesn't work.

> try_to_freeze();
> + if (cpu_is_offline(bind_cpu))
> + goto wait_to_die;
> + }
>
> ...
>
> +
> +wait_to_die:
> + /* Wait for kthread_stop */
> + set_current_state(TASK_INTERRUPTIBLE);
> + while (!kthread_should_stop()) {
> + schedule();
> + set_current_state(TASK_INTERRUPTIBLE);
> + }
> + __set_current_state(TASK_RUNNING);
> + return 0;
> }

I believe this is not needed, see the comments for the next patch.

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/