From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752602AbdBIJgN (ORCPT ); Thu, 9 Feb 2017 04:36:13 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:55892 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752401AbdBIJf3 (ORCPT ); Thu, 9 Feb 2017 04:35:29 -0500 Date: Thu, 9 Feb 2017 09:59:00 +0100 (CET) From: Thomas Gleixner To: Ingo Molnar cc: Peter Zijlstra , Mike Galbraith , Ingo Molnar , Sebastian Andrzej Siewior , LKML Subject: Re: tip: demise of tsk_cpus_allowed() and tsk_nr_cpus_allowed() In-Reply-To: <20170209065727.GA6902@gmail.com> Message-ID: 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> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 9 Feb 2017, 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. I'm fine with that. Making the pointer const is clever and prevents people from manipulating the wrong thing. If would be great if you could rework it that way instead of just ripping all out. Thanks, tglx