Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522AbdDNIzP (ORCPT ); Fri, 14 Apr 2017 04:55:15 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:58856 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbdDNIzN (ORCPT ); Fri, 14 Apr 2017 04:55:13 -0400 Date: Fri, 14 Apr 2017 10:54:59 +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: <20170414085459.sp3psluw647ab4lw@hirez.programming.kicks-ass.net> References: <20170412200726.941336635@linutronix.de> <20170412201042.262610721@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170412201042.262610721@linutronix.de> 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: 527 Lines: 17 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.