Re: sched: hang in migrate_swap

From: Peter Zijlstra
Date: Wed May 14 2014 - 07:21:04 EST


On Wed, May 14, 2014 at 12:26:02PM +0200, Peter Zijlstra wrote:
> so we serialize stop_cpus_work() vs stop_two_cpus() with an l/g lock.
>
> Ah, but stop_cpus_work() only holds the global lock over queueing, it
> doesn't wait for completion, that might indeed cause a problem.

Hmm, is this so? If the stop_cpus_work() queueing is complete, the
stop_two_cpus() queueing must always happen _after_ it.

Therefore the stopper threads should also observe them in that order,
right? /me goes check..

Hmm, cpu_stop_queue_work() does list_add_tail(), does that make it a
LIFO?

Bah, now I've confused myself again.

> Also, since its two different cpus queueing, the ordered queue doesn't
> really matter, you can still interleave the all and two sets and get
> into this state.


Anyway, before I stared getting self doubts, I wrote the below, now I'm
not sure its at all relevant but here goes.

---

Yeah, sorry for not also providing a solution, extending the lg_global
lock over the entire sqeuence won't work for it will disable preemption,
which means we need something a little smarter.

Now, I still have the hotplug lock rewrite laying about, now Linus had
an opinion on that, but we could adapt percpu-rwsem.c to use the same
logic.

At that point, I think it would be possible to use the percpu-rwsem for
this, use the write lock for the global stop all thing, and the read
side for the two-cpu stopper.

http://thread.gmane.org/gmane.linux.kernel/1574737

Attachment: pgpVAcqPO5SOS.pgp
Description: PGP signature