Re: [PATCH] Do not change worker's running cpu in cmci_rediscover().

From: Tang Chen
Date: Wed Oct 17 2012 - 23:43:37 EST


On 10/17/2012 07:08 AM, Tejun Heo wrote:
On Thu, Sep 27, 2012 at 05:19:46PM +0800, Tang Chen wrote:
1. cmci_rediscover() is only called by the CPU_POST_DEAD event handler, which
means the corresponding cpu has already dead. As a result, it won't be accessed
in the for_each_online_cpu loop.
So, we could change the if(cpu == dying) statement into a BUG_ON().

Let's please move this to a separate patch and use WARN_ON_ONCE()
instead.

OK, no problem. :)


2. cmci_rediscover() used set_cpus_allowed_ptr() to change the current process's
running cpu, and migrate itself to the dest cpu. But worker processes are not
allowed to be migrated. If current is a worker, the worker will be migrated to
another cpu, but the corresponding worker_pool is still on the original cpu.

In this case, the following BUG_ON in try_to_wake_up_local() will be triggered:
BUG_ON(rq != this_rq());

This will cause the kernel panic.

This patch removes the set_cpus_allowed_ptr() call, and put the cmci rediscover
jobs onto all the other cpus using system_wq. This could bring some delay for
the jobs.

After separating out the fix part into a separate patch, please add
Cc: stable@xxxxxxxxxxxxxxxx

OK, I will.


The change looks correct to me but fails to apply to the current
mainline.

I'll update it and resend it soon. :)
Thanks.


Thanks!


--
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/