]> git.baikalelectronics.ru Git - kernel.git/commit
percpu: fix synchronization between synchronous map extension and chunk destruction
authorTejun Heo <tj@kernel.org>
Wed, 25 May 2016 15:48:25 +0000 (11:48 -0400)
committerTejun Heo <tj@kernel.org>
Wed, 25 May 2016 15:48:25 +0000 (11:48 -0400)
commit11f6826c4e6f5232f861e164b1ae0962ff81eb0b
tree526322970c44a03be3b46d27e45644fa188886fb
parent3cd0d7f7f3361d97ef95fc7dc874fc9cd7743924
percpu: fix synchronization between synchronous map extension and chunk destruction

For non-atomic allocations, pcpu_alloc() can try to extend the area
map synchronously after dropping pcpu_lock; however, the extension
wasn't synchronized against chunk destruction and the chunk might get
freed while extension is in progress.

This patch fixes the bug by putting most of non-atomic allocations
under pcpu_alloc_mutex to synchronize against pcpu_balance_work which
is responsible for async chunk management including destruction.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-and-tested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Reported-by: Vlastimil Babka <vbabka@suse.cz>
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Cc: stable@vger.kernel.org # v3.18+
Fixes: a3e8d56b637c ("percpu: implement asynchronous chunk population")
mm/percpu.c