From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752023AbdBIIxH (ORCPT ); Thu, 9 Feb 2017 03:53:07 -0500 Received: from merlin.infradead.org ([205.233.59.134]:57078 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751950AbdBIIxG (ORCPT ); Thu, 9 Feb 2017 03:53:06 -0500 Date: Thu, 9 Feb 2017 09:51:34 +0100 From: Peter Zijlstra To: Ingo Molnar Cc: Thomas Gleixner , Mike Galbraith , Ingo Molnar , Sebastian Andrzej Siewior , LKML Subject: Re: tip: demise of tsk_cpus_allowed() and tsk_nr_cpus_allowed() Message-ID: <20170209085134.GY6500@twins.programming.kicks-ass.net> References: <1486355037.10462.17.camel@gmx.de> <20170206103156.GA18908@gmail.com> <1486383511.10462.43.camel@gmx.de> <20170206122928.GB9404@gmail.com> <20170206133242.GK6515@twins.programming.kicks-ass.net> <20170206222313.GA6061@gmail.com> <20170208114016.GX6500@twins.programming.kicks-ass.net> <20170209064501.GA27072@gmail.com> <20170209065727.GA6902@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170209065727.GA6902@gmail.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 09, 2017 at 07:57:27AM +0100, Ingo Molnar wrote: > And -rt would do something like this in migration_disable()/enable(): > > t->cpus_ptr = &cpumask_of(task_cpu(p)); > t->nr_cpus = 1; > > ... > > t->cpus_ptr = &t->cpus_mask; > t->nr_cpus = cpumask_weight(t->cpus_mask); > > In addition to that we could cache the weight of the cpumask as an additional > optimization: > > t->cpus_ptr = &t->cpus_mask; > t->nr_cpus = t->cpus_mask_weight; > > It all looks like a pretty natural construct to me. The migration_disabled() flag > spreads almost a hundred branches all across the scheduler. Could work I suppose. But please then implement this instead of ripping out the current thing, because taking out the accessors leaves RT in a bind without recourse.