From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754183AbdDGHNf (ORCPT ); Fri, 7 Apr 2017 03:13:35 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36089 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753038AbdDGHN1 (ORCPT ); Fri, 7 Apr 2017 03:13:27 -0400 Date: Fri, 7 Apr 2017 09:13:23 +0200 From: Ingo Molnar To: Thomas Gleixner Cc: Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, Peter Zijlstra , Mike Galbraith , Ingo Molnar , "Rafael J . Wysocki" Subject: Re: [RFC PATCH] kernel: sched: Provide a pointer to the valid CPU mask Message-ID: <20170407071323.GA5360@gmail.com> References: <20170404184202.20376-1-bigeasy@linutronix.de> <20170405073943.GA17266@gmail.com> <20170405083753.7eszej2njds4ovdb@linutronix.de> <20170406061622.GA19979@gmail.com> <20170406073832.e7bu4ldpfuq44ui6@linutronix.de> <20170406080139.GA22069@gmail.com> <20170406110215.GA1367@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Thomas Gleixner wrote: > On Thu, 6 Apr 2017, Ingo Molnar wrote: > > CPU hotplug and changing the affinity mask are the more complex cases, because > > there migrating or not migrating is a correctness issue: > > > > - CPU hotplug has to be aware of this anyway, regardless of whether it's solved > > via a counter of the affinity mask. > > You have to prevent CPU hotplug simply as long as there are migration disabled > tasks on the fly. Making that depend on whether they are on a CPU which is about > to be unplugged or not would be complete overkill as you still have to solve the > case that a task sets the migrate_disable() AFTER the cpu down machinery > started. > > [...] > > The counter alone might be enough for the scheduler placement decisions, but it > cannot solve the hotplug issue. You still need something like I sketched out in > my previous reply. Yes, so what you outlined: void migrate_disable(void) { if (in_atomic() || irqs_disabled()) return; if (!current->migration_disabled) { percpu_down_read_preempt_disable(hotplug_rwsem); current->migration_disabled++; preempt_enable(); } else { current->migration_disabled++; } } Would solve it? I.e. my point is: whether migrate_disable()/enable() is implemented via a counter or a pointer to a cpumask does not materially change how the CPU-hotplug solution looks like, right? I.e. we could just use the counter and avoid the whole wrapping of cpumask complexity. Thanks, Ingo