Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753217AbdDNJ5R (ORCPT ); Fri, 14 Apr 2017 05:57:17 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:48598 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbdDNJ5O (ORCPT ); Fri, 14 Apr 2017 05:57:14 -0400 Date: Fri, 14 Apr 2017 11:56:55 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: LKML , Ingo Molnar , Sebastian Siewior , Benjamin Herrenschmidt , "David S. Miller" , Fenghua Yu , Herbert Xu , Lai Jiangshan , Len Brown , Michael Ellerman , "Rafael J. Wysocki" , Tejun Heo , Tony Luck , Viresh Kumar Subject: Re: [patch 02/13] workqueue: Provide work_on_cpu_safe() Message-ID: <20170414095655.qb3r2mkqvsgaqnut@hirez.programming.kicks-ass.net> References: <20170412200726.941336635@linutronix.de> <20170412201042.262610721@linutronix.de> <20170414085459.sp3psluw647ab4lw@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 793 Lines: 24 On Fri, Apr 14, 2017 at 11:51:07AM +0200, Thomas Gleixner wrote: > On Fri, 14 Apr 2017, Peter Zijlstra wrote: > > > On Wed, Apr 12, 2017 at 10:07:28PM +0200, Thomas Gleixner wrote: > > > +long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg) > > > +{ > > > + long ret = -ENODEV; > > > + > > > + get_online_cpus(); > > > + if (cpu_online(cpu)) > > > + ret = work_on_cpu(cpu, fn, arg); > > > + put_online_cpus(); > > > + return ret; > > > +} > > > > But doesn't workqueue have this lovelt 'feature' where it will unbind > > per-cpu work and run it on random CPUs when hotplug happens? > > > > That is, I think you need a flush_work() before put_online_cpus() if you > > want to guarantee anything. > > work_on_cpu() is sychnronous, it flushes already. So much for being awake ...