From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933081AbdDFGQe (ORCPT ); Thu, 6 Apr 2017 02:16:34 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:33474 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756246AbdDFGQ0 (ORCPT ); Thu, 6 Apr 2017 02:16:26 -0400 Date: Thu, 6 Apr 2017 08:16:22 +0200 From: Ingo Molnar To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Thomas Gleixner , Mike Galbraith , Ingo Molnar , "Rafael J . Wysocki" Subject: Re: [RFC PATCH] kernel: sched: Provide a pointer to the valid CPU mask Message-ID: <20170406061622.GA19979@gmail.com> References: <20170404184202.20376-1-bigeasy@linutronix.de> <20170405073943.GA17266@gmail.com> <20170405083753.7eszej2njds4ovdb@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170405083753.7eszej2njds4ovdb@linutronix.de> 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 * Sebastian Andrzej Siewior wrote: > On 2017-04-05 09:39:43 [+0200], Ingo Molnar wrote: > > > > So maybe we could add the following facility: > > > > ptr = sched_migrate_to_cpu_save(cpu); > > > > ... > > > > sched_migrate_to_cpu_restore(ptr); BTW., and I'm sure this has come up before, but why doesn't migrate_disable() use a simple per task flag that the scheduler migration code takes into account? It should be functionally equivalent to the current solution, and it appears to have a heck of a smaller cross section with the rest of the scheduler. I.e.: static inline void migrate_disable(void) { current->migration_disabled++; } ... static inline void migrate_enable(void) { current->migration_disabled--; } or so? Then add this flag as a condition to can_migrate_task() et al. While we generally dislike such flags as they wreck havoc with the scheduler if overused, the cpus_allowed based solution has the exact same effect so it's not like it's a step backwards - and it should also be much faster and less intrusive. Am I missing some complication? Thanks, Ingo