From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752181AbdKFKko (ORCPT ); Mon, 6 Nov 2017 05:40:44 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:33870 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752005AbdKFKkm (ORCPT ); Mon, 6 Nov 2017 05:40:42 -0500 Date: Mon, 6 Nov 2017 11:40:38 +0100 From: Peter Zijlstra To: James Morse Cc: Thomas Gleixner , "linux-kernel@vger.kernel.org" Subject: Re: get_online_cpus() from a preemptible() context (bug?) Message-ID: <20171106104038.GD3857@worktop> References: <59FC8119.8030608@arm.com> <20171106103212.GG3165@worktop.lehotels.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171106103212.GG3165@worktop.lehotels.local> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 06, 2017 at 11:32:12AM +0100, Peter Zijlstra wrote: > On Fri, Nov 03, 2017 at 02:45:45PM +0000, James Morse wrote: > > Hi Thomas, Peter, > > > > I'm trying to work out what stops a thread being pre-empted and migrated between > > calling get_online_cpus() and put_online_cpus(). Nothing; why would you think it would? All those functions guarantee is that any CPU observed as being online says online (and its converse, that a CPU observed as being offline, says offline, although less people care about that one). That is; it serializes against CPU hotplug, nothing else.