Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3808275pxk; Tue, 22 Sep 2020 03:11:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBEJ3JhnKjNEqny898mp/qJpxXNH4bvTP1/vGvebFUV+khyvg/0b0S9BtFJnW/nbPYpWzH X-Received: by 2002:aa7:d68c:: with SMTP id d12mr3187951edr.274.1600769510379; Tue, 22 Sep 2020 03:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600769510; cv=none; d=google.com; s=arc-20160816; b=h3ThLZq+7IMaZ2oge8q+VzF20dRTG5oMwQxA3Rdn3CmVW1ZrMJyICTYTVuRaPlJyI5 cvvQL8L21Rn6FNIiNhcvq1oJMZv1SAwj7E3AIsIAVDIwL1OoIWofteV8AdwoGbxiEwtw WhNNIu1qiBBGigQZhTM7ZxUxEkmzCjt1z8nHbCQFGnf/qOGgMDg7ixZ700mJC9lfQkQO QRbylPzV8IsZDqWLNDrcXY1KwSQDHyKj/sIxUvcDYABhhjOsmyfGQ8622sslc5n44Irl zJNQyfd6nucdJj+ohiWXtNuiVuKwUCl4m2OI0SEKNuHFSZTAYFSYK2Umam2ENuEz0u5j CPUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=9c6BzqruwBx+hkZTWGsZpCfwgc9Y6+WnB9Gc8kclMgg=; b=vfJxcRaxd11WUvQL783+NOf6HsLFS2KOmySE/sZa+NRHmahZW+Fw661S25yPeHgVfc mk4zgm+A1+xH2SI6ByMghMs8rDLDIxrzSfvqoNYQSzEqvLjRqd0kiMAG9aP6rHNyBR0+ 3YlH4nsB2LzigyqleIzqJb2AlyD8EP5xGa7/YhoiB7+mxRsNP11ogCN9o10CrSymx3de ixuFO8leSje038ExRHG4LOkz9Asy7225FHyDTNyLbEksJKByzN71UOVI8Ur3rfJnhrk9 lNnymZrTTIiFFNOxOSLKErj1NTjgNTvKNnhaH9btE9wVxtC//XlHBs2xRWUPmK4m8fT7 MNnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NHlyRnU9; 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 mj21si10234621ejb.271.2020.09.22.03.11.26; Tue, 22 Sep 2020 03:11:50 -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=NHlyRnU9; 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 S1726554AbgIVKIV (ORCPT + 99 others); Tue, 22 Sep 2020 06:08:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:49632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726341AbgIVKIV (ORCPT ); Tue, 22 Sep 2020 06:08:21 -0400 Received: from localhost (lfbn-ncy-1-588-162.w81-51.abo.wanadoo.fr [81.51.203.162]) (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 A6120238A1; Tue, 22 Sep 2020 10:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600769300; bh=8DhSYCbvL/5uQLKa1OoCbzQjAI1KVYGhNkk/tvbAHZ0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NHlyRnU9UhfcxJcB2NGTMckkO90/LQ4r1quggB0dvN5ilY1C6sPfDw4FdL5Avvzeu VF1DknG4aCbj7mPorxnXwITF3ByQsjgWGj8ujFNnYTcTsNMY9cofIF5xZtHHWKa4jd UVXu7GVI1s9vlH9MtIWjb3cSqadLBcN5sal4PMPg= Date: Tue, 22 Sep 2020 12:08:17 +0200 From: Frederic Weisbecker To: Nitesh Narayan Lal Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, mtosatti@redhat.com, sassmann@redhat.com, jeffrey.t.kirsher@intel.com, jacob.e.keller@intel.com, jlelli@redhat.com, hch@infradead.org, bhelgaas@google.com, mike.marciniszyn@intel.com, dennis.dalessandro@intel.com, thomas.lendacky@amd.com, jerinj@marvell.com, mathias.nyman@intel.com, jiri@nvidia.com Subject: Re: [RFC][Patch v1 1/3] sched/isolation: API to get num of hosekeeping CPUs Message-ID: <20200922100817.GB5217@lenoir> References: <20200909150818.313699-1-nitesh@redhat.com> <20200909150818.313699-2-nitesh@redhat.com> <20200921234044.GA31047@lenoir> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2020 at 11:16:51PM -0400, Nitesh Narayan Lal wrote: > > On 9/21/20 7:40 PM, Frederic Weisbecker wrote: > > On Wed, Sep 09, 2020 at 11:08:16AM -0400, Nitesh Narayan Lal wrote: > >> +/* > >> + * num_housekeeping_cpus() - Read the number of housekeeping CPUs. > >> + * > >> + * This function returns the number of available housekeeping CPUs > >> + * based on __num_housekeeping_cpus which is of type atomic_t > >> + * and is initialized at the time of the housekeeping setup. > >> + */ > >> +unsigned int num_housekeeping_cpus(void) > >> +{ > >> + unsigned int cpus; > >> + > >> + if (static_branch_unlikely(&housekeeping_overridden)) { > >> + cpus = atomic_read(&__num_housekeeping_cpus); > >> + /* We should always have at least one housekeeping CPU */ > >> + BUG_ON(!cpus); > >> + return cpus; > >> + } > >> + return num_online_cpus(); > >> +} > >> +EXPORT_SYMBOL_GPL(num_housekeeping_cpus); > >> + > >> int housekeeping_any_cpu(enum hk_flags flags) > >> { > >> int cpu; > >> @@ -131,6 +153,7 @@ static int __init housekeeping_setup(char *str, enum hk_flags flags) > >> > >> housekeeping_flags |= flags; > >> > >> + atomic_set(&__num_housekeeping_cpus, cpumask_weight(housekeeping_mask)); > > So the problem here is that it takes the whole cpumask weight but you're only > > interested in the housekeepers who take the managed irq duties I guess > > (HK_FLAG_MANAGED_IRQ ?). > > IMHO we should also consider the cases where we only have nohz_full. > Otherwise, we may run into the same situation on those setups, do you agree? I guess it's up to the user to gather the tick and managed irq housekeeping together? Of course that makes the implementation more complicated. But if this is called only on drivers initialization for now, this could be just a function that does: cpumask_weight(cpu_online_mask | housekeeping_cpumask(HK_FLAG_MANAGED_IRQ)) And then can we rename it to housekeeping_num_online()? Thanks. > > > >> free_bootmem_cpumask_var(non_housekeeping_mask); > >> > >> return 1; > >> -- > >> 2.27.0 > >> > -- > Thanks > Nitesh >