Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp527546ybt; Wed, 24 Jun 2020 05:16:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWaIxipO3Lojk/fHzUY6U/ukF2kXgMV1vOMjklcgst+R0WUUKyQsbzTKhQHsKb/9LxfWNx X-Received: by 2002:a17:906:1196:: with SMTP id n22mr24220565eja.33.1593000962914; Wed, 24 Jun 2020 05:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593000962; cv=none; d=google.com; s=arc-20160816; b=XoZQjmu+83kdt/7xLjHivSg32+IAy2KAUPQT8DnoWX5gtAkeUQ238mhvObE+5UHfZp E010rxOEkSS2bWiZsPsm/NUJU0dp/5TX49whhA5VZZvrylhD/mCXDeKEdFGsoDGWeaKX dCYtduP6arNpZBhBoVcfTHt/HUsg+Q5vekxi7OECaoRKGuAv3D6znRCnRiJOsoXneKJT 2nN/C1HKo5Dq3BHBAs/d+OMQEuznaP7w4NhB5cFNcKncX+Fd2HBBxYPZQI+WZRxk7G7O xqx1JqZ2yFcRlmDZ35rYZOYlhnFhspL/0NUnT0He4OTelRDIDN0gN9wQCtBKqrn0aKrG bwcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FFligsyF98My6Xm3UIph4XYaA4IdzF18Q2YK8jdqDNs=; b=wvTVkrdyVhT1sTdq9I1jNNL6AaOkEWSl0EbCUHpzG+tAOtaizhscy0j8UBUvoqVXrn L6jI/q+QIKDkeXqWocPz/R+sSMSjr+Q6ygD21S9N9db2cYIhOQrWEbsbXinh+blDd0I/ r+Krqgp94wO/221pcs2jIGGjBZFe7TdMRzjUVhrYC82e/pfGeVlecvMGdnFZy9CqMDrm 9/HRExb3dw9fXwT6tiIXlSE/dt9Mpn824Ne4iZt10cbGVNUIEx9plnaG1opGxo0hEIDr odkuIz5wCYK2MhcZ7bWDBwtHlcKFqHwv7w7Eynx3mFC68fg6v2eCXZBaIfgbuQrdY9I1 U6pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k+r1RPo8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc13si3968605edb.297.2020.06.24.05.15.39; Wed, 24 Jun 2020 05:16:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k+r1RPo8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390330AbgFXMN5 (ORCPT + 99 others); Wed, 24 Jun 2020 08:13:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:49376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389907AbgFXMN4 (ORCPT ); Wed, 24 Jun 2020 08:13:56 -0400 Received: from localhost (lfbn-ncy-1-996-218.w90-101.abo.wanadoo.fr [90.101.73.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8C4C62088E; Wed, 24 Jun 2020 12:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593000836; bh=QzHyuz7ytmBCoTWY1f/kwZ7sJSq4u28blMy4Q4iNhwo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=k+r1RPo8wq7doLhEr/5UAaZ2yaOtsIN0/OKMIDlyMRBj0DZi6BTccwXAHxBB5NyiY ueFwOdqbtlS2KSn4kzt3GyPFX57Or1hP9ncUqffw0uKjAYTAF2q/rrKXIScA2ndXb1 GA0nLcaKL52VBPkG6Mb552Ct+WxPQsOVI2JWK5qo= Date: Wed, 24 Jun 2020 14:13:53 +0200 From: Frederic Weisbecker To: Nitesh Narayan Lal Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, mtosatti@redhat.com, juri.lelli@redhat.com, abelits@marvell.com, bhelgaas@google.com, linux-pci@vger.kernel.org, rostedt@goodmis.org, mingo@kernel.org, peterz@infradead.org, tglx@linutronix.de, davem@davemloft.net, akpm@linux-foundation.org, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com Subject: Re: [Patch v3 1/3] lib: Restrict cpumask_local_spread to houskeeping CPUs Message-ID: <20200624121352.GA28020@lenoir> References: <20200623192331.215557-1-nitesh@redhat.com> <20200623192331.215557-2-nitesh@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200623192331.215557-2-nitesh@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 23, 2020 at 03:23:29PM -0400, Nitesh Narayan Lal wrote: > From: Alex Belits > > The current implementation of cpumask_local_spread() does not respect the > isolated CPUs, i.e., even if a CPU has been isolated for Real-Time task, > it will return it to the caller for pinning of its IRQ threads. Having > these unwanted IRQ threads on an isolated CPU adds up to a latency > overhead. > > Restrict the CPUs that are returned for spreading IRQs only to the > available housekeeping CPUs. > > Signed-off-by: Alex Belits > Signed-off-by: Nitesh Narayan Lal > --- > lib/cpumask.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/lib/cpumask.c b/lib/cpumask.c > index fb22fb266f93..d73104995981 100644 > --- a/lib/cpumask.c > +++ b/lib/cpumask.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > > /** > * cpumask_next - get the next cpu in a cpumask > @@ -205,22 +206,27 @@ void __init free_bootmem_cpumask_var(cpumask_var_t mask) > */ > unsigned int cpumask_local_spread(unsigned int i, int node) > { > - int cpu; > + int cpu, hk_flags; > + const struct cpumask *mask; > > + hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ; This should be HK_FLAG_MANAGED_IRQ instead of HK_FLAG_WQ since this function seem to be used mostly to select CPUs to affine managed IRQs. In the end the cpumask you pass to IRQ core will be filtered throughout HK_FLAG_MANAGED_IRQ anyway so better select an appropriate one in the first place to avoid an empty cpumask intersection. Now even if cpumask_local_spread() is currently mostly used to select managed irq targets, the name and role of the function don't refer to that. Probably cpumask_local_spread() should take HK_ flag in parameter so that it can correctly handle future users? That being said, I plan to merge HK_FLAG_RCU, HK_FLAG_MISC, HK_FLAG_SCHED, HK_FLAG_WQ and HK_FLAG_TIMER into HK_FLAG_UNBOUND since it doesn't make sense to divide them all. And the actual flag used inside cpumask_local_spread() could end up being HK_FLAG_DOMAIN | HK_FLAG_UNBOUND. So probably you don't need to worry about that and just change the HK_FLAG_WQ in your patch with HK_FLAG_MANAGED_IRQ. Thanks.