Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp838617ybt; Wed, 24 Jun 2020 12:28:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFExWM2EWkFvS5xdCZmz8jbF8+6+sgHieRA7WoO8AgAQmF2CA6bcHywP5sh/TelOpk9t0E X-Received: by 2002:a50:fa8d:: with SMTP id w13mr28822191edr.324.1593026937655; Wed, 24 Jun 2020 12:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593026937; cv=none; d=google.com; s=arc-20160816; b=Un0ui+vKqpmJi5wPGrtAKdl69/UEKBHSyb1hyLtVmZuvwetpKtZRQ3pVHI4qLnFSAE SaKRbyfUZf8vY4pbFwtumhhF0wjr3WHwsGUq13VazJUnP5Gv0EYhun92bO1d2k2ImAVL 8gus6CjgxMy1Lx2Ntv6il75ou5xV606XMTunHFYxOa8ptyk/EQcwVm5Lais83F6aP5zU 7DHrZiUKynzWCP+iyTIZYDqh6yS96PuawUlrodYYIqvlyxmEF1H/0sCNlP38UTAKqfLd 569rpGSXsxj9EB2VJfw7AJBZ2nQevw067vK7fRtC6EtK2QfrFzQ525TiNgTuTzzs1pfy L3fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=16rEsTaE9mEDrTXWTXQoBTdl3ZuDPhHZtSkwYsPxU68=; b=Y4bLiRZ6bW6vhn+15SKerS0AvBcSDhNJLERCaAWWbvRpkqj7r5ZLVs5gzUOsf/OHt8 MZ7uWyzw87vv4tEGtVivsrXUe0To1ioh8P2l31mEwTqpWDf7MPMEKIigCuUWmnnA3nsf 4WQTzjWYdWyeXUdvyXHbkKjJ5ZvEQuqqfizzDjMBYPgUrcINMzUSF0kcgyKoEeor3ls4 Uzvhh9mbKEm/tVR1wQE83vuGhQDgiM7adZjwIgs8PN1WgVq+B/Tg05H5TalGZSzAV5Lb YPGNJ5KWIHQc/9HJ5diviX10XzyEUNK++CthMgpWKD6EhuglJ/CnX7JMEnbQlwJakGnH ptLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=entyhUy2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r4si9525832edl.262.2020.06.24.12.28.34; Wed, 24 Jun 2020 12:28:57 -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=entyhUy2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391293AbgFXT0v (ORCPT + 99 others); Wed, 24 Jun 2020 15:26:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:33694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391257AbgFXT0u (ORCPT ); Wed, 24 Jun 2020 15:26:50 -0400 Received: from X1 (nat-ab2241.sltdut.senawave.net [162.218.216.4]) (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 EE6C22081A; Wed, 24 Jun 2020 19:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593026809; bh=AaVrCkbvdrnTMJpjmNJkp9fgMy62sxa7lMZDueE1js8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=entyhUy2DAHhZzqGA1Mv5asRjmiJXX6k5MeNRPqcFMP75szXMr6iUsznNbTrbi16s O/pfC8TYPXREiUwau4gyu+P39POTpe7OhPwHuEKZY/Cli6Jmz1kba8IjeyHKvKwxti fk1io+KueFd4VBq6kTjVw6TSlVekpyxocW3s6x+U= Date: Wed, 24 Jun 2020 12:26:47 -0700 From: Andrew Morton To: Nitesh Narayan Lal Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, frederic@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, sfr@canb.auug.org.au, stephen@networkplumber.org, rppt@linux.vnet.ibm.com, yuqi jin , Shaokun Zhang Subject: Re: [Patch v3 1/3] lib: Restrict cpumask_local_spread to houskeeping CPUs Message-Id: <20200624122647.766bec7760d9197ba71a58c4@linux-foundation.org> In-Reply-To: <20200623192331.215557-2-nitesh@redhat.com> References: <20200623192331.215557-1-nitesh@redhat.com> <20200623192331.215557-2-nitesh@redhat.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Jun 2020 15:23:29 -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. > > ... > > --- 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; > + mask = housekeeping_cpumask(hk_flags); > /* Wrap: we always want a cpu. */ > - i %= num_online_cpus(); > + i %= cpumask_weight(mask); > > if (node == NUMA_NO_NODE) { > - for_each_cpu(cpu, cpu_online_mask) > + for_each_cpu(cpu, mask) { > if (i-- == 0) > return cpu; > + } > } else { > /* NUMA first. */ > - for_each_cpu_and(cpu, cpumask_of_node(node), cpu_online_mask) > + for_each_cpu_and(cpu, cpumask_of_node(node), mask) { > if (i-- == 0) > return cpu; > + } > > - for_each_cpu(cpu, cpu_online_mask) { > + for_each_cpu(cpu, mask) { > /* Skip NUMA nodes, done above. */ > if (cpumask_test_cpu(cpu, cpumask_of_node(node))) > continue; Are you aware of these changes to cpu_local_spread()? https://lore.kernel.org/lkml/1582768688-2314-1-git-send-email-zhangshaokun@hisilicon.com/ I don't see a lot of overlap but it would be nice for you folks to check each other's homework ;)