Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275909

Re: [PATCH v2 1/1] stop_machine: Remove stop_cpus_lock and lg_double_lock/unlock()

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/1] stop_machine: Remove stop_cpus_lock and lg_double_lock/unlock()
Date 2015-11-23 23:00 +0100
Message-ID <qy7js-7vZ-25@gated-at.bofh.it> (permalink)
References <qxkVs-wW-9@gated-at.bofh.it> <qxkVt-wW-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello, Oleg.

On Sat, Nov 21, 2015 at 07:11:48PM +0100, Oleg Nesterov wrote:
> stop_two_cpus() and stop_cpus() use stop_cpus_lock to avoid the deadlock,
> we need to ensure that the stopper functions can't be queued "backwards"
> from one another. This doesn't look nice; if we use lglock then we do not
> really need stopper->lock, cpu_stop_queue_work() could use lg_local_lock()
> under local_irq_save().

Yeah, removing stopper->lock would be nice.

> OTOH it would be even better to avoid lglock in stop_machine.c and remove
> lg_double_lock(). This patch adds "bool stop_cpus_in_progress" set/cleared
> by queue_stop_cpus_work(), and changes cpu_stop_queue_two_works() to busy
> wait until it is cleared.
> 
> queue_stop_cpus_work() sets stop_cpus_in_progress = T lockless, but after
> it queues a work on CPU1 it must be visible to stop_two_cpus(CPU1, CPU2)
> which checks it under the same lock. And since stop_two_cpus() holds the
> 2nd lock too, queue_stop_cpus_work() can not clear stop_cpus_in_progress
> if it is also going to queue a work on CPU2, it needs to take that 2nd
> lock to do this.

Isn't this a lot more subtler than the other direction?  Unless
there's a clear performance advantage to removing stopper->lock, using
lglock for both stop_two and stop_machine seems like an
easier-to-follow approach to me.

Thanks.

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/1] stop_machine: Remove stop_cpus_lock and  lg_double_lock/unlock() Oleg Nesterov <oleg@redhat.com> - 2015-11-21 19:20 +0100
  Re: [PATCH v2 1/1] stop_machine: Remove stop_cpus_lock and  lg_double_lock/unlock() Tejun Heo <tj@kernel.org> - 2015-11-23 23:00 +0100
    Re: [PATCH v2 1/1] stop_machine: Remove stop_cpus_lock and  lg_double_lock/unlock() Peter Zijlstra <peterz@infradead.org> - 2015-11-24 11:00 +0100
      Re: [PATCH v2 1/1] stop_machine: Remove stop_cpus_lock and  lg_double_lock/unlock() Tejun Heo <tj@kernel.org> - 2015-11-24 16:00 +0100

csiph-web