Re: [RFC][PATCH][EXPERIMENTAL] CPU hotplug with frozen tasks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/16, Rafael J. Wysocki wrote:
>
> Appended is the updated version of the patch (in addition to the changes
> mentioned above I've eliminated the magic constant 0x0008 from cpu.c by
> changing the new definitions in notifier.h).

Most sub-systems doesn't care about CPU_TASKS_FROZEN bit. Take for example
workqueue.c,

> --- linux-2.6.21-rc7.orig/kernel/workqueue.c	2007-04-16 23:05:17.000000000 +0200
> +++ linux-2.6.21-rc7/kernel/workqueue.c	2007-04-16 23:05:45.000000000 +0200
> @@ -757,6 +757,7 @@ static int __devinit workqueue_cpu_callb
>  
>  	switch (action) {
>  	case CPU_UP_PREPARE:
> +	case CPU_UP_PREPARE_FROZEN:
>  		mutex_lock(&workqueue_mutex);
>  		/* Create a new workqueue thread for it. */
>  		list_for_each_entry(wq, &workqueues, list) {
> @@ -768,6 +769,7 @@ static int __devinit workqueue_cpu_callb
>  		break;
>  
>  	case CPU_ONLINE:
> +	case CPU_ONLINE_FROZEN:
>  		/* Kick off worker threads. */
>  		list_for_each_entry(wq, &workqueues, list) {
>  			struct cpu_workqueue_struct *cwq;
> @@ -780,6 +782,7 @@ static int __devinit workqueue_cpu_callb
>  		break;
>  
>  	case CPU_UP_CANCELED:
> +	case CPU_UP_CANCELED_FROZEN:
>  		list_for_each_entry(wq, &workqueues, list) {
>  			if (!per_cpu_ptr(wq->cpu_wq, hotcpu)->thread)
>  				continue;
> @@ -792,14 +795,17 @@ static int __devinit workqueue_cpu_callb
>  		break;
>  
>  	case CPU_DOWN_PREPARE:
> +	case CPU_DOWN_PREPARE_FROZEN:
>  		mutex_lock(&workqueue_mutex);
>  		break;
>  
>  	case CPU_DOWN_FAILED:
> +	case CPU_DOWN_FAILED_FROZEN:
>  		mutex_unlock(&workqueue_mutex);
>  		break;
>  
>  	case CPU_DEAD:
> +	case CPU_DEAD_FROZEN:
>  		list_for_each_entry(wq, &workqueues, list)
>  			cleanup_workqueue_thread(wq, hotcpu);
>  		list_for_each_entry(wq, &workqueues, list)

I think it is better to add

	action &= ~CPU_TASKS_FROZEN;

at the head of workqueue_cpu_callback() instead. I think this way
you can make this patch a lot simpler and smaller.

Oleg.

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux