Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2823909lqz; Wed, 3 Apr 2024 09:31:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVI1Su/rqN5F+zjkMjwe9cspS1iiWpiqi94MzMszDP3A86x/rIX4c1QA0A0+4JC8CB7RGC+Z7iav8EyyAPRahpdmJdX+9cNyUvZ8KU94g== X-Google-Smtp-Source: AGHT+IGI0ATbh5r0dxN+fTDf07hhRdbO1/hPcQQLkGWnW2+Fx+ButGJ/G4kjtwRf+Uej7dsTOfQP X-Received: by 2002:a05:620a:17a8:b0:78b:c152:11f9 with SMTP id ay40-20020a05620a17a800b0078bc15211f9mr5095455qkb.14.1712161906285; Wed, 03 Apr 2024 09:31:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712161906; cv=pass; d=google.com; s=arc-20160816; b=uz04Qxz6N5voZUD6nMQBLJxJV2I+pdEuQi+qHMZD+FxWNGDrdyx+LzlFckxvBGZyXg 7H5flCPK0YPFn31n2yxkMFx2Ih8SNsSIYN/02wdHYrrsFETVelsBeR8rCMaBqXRfgIAa A/tyH5Zq9LqZzzhtwZYqSNSoLCmeEd4gBAY9E+vyxlSL8tQcgGL7tmGH1eycJRpzAl3D qRLvqmtWY6aO+kyTjrBlbqdonxcJshLRYHGDkx311mLaevspBHGxDOlZzGbtTSHucpgr joOogXVm2HQLFXigWciBZsYk2K2tU/lxkXy/KBKZi0G87fFO8ZSAHkq3vvE//5TfaCjj e5bg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WitudJQrPd2aFPqvPyORq1RfFG+UAlZFwAtUhdU5ix8=; fh=BbMnrX9Huc7YDvLmJ5nQ3dPxdALZYz9jzpqqbvcEXJs=; b=O214Kea+EK/NENVu5LsP5pQanJ/3jbRPyF5500vv07omvP4lCanp/c4tDhqAsNAQJS iU77PEUiSic++6q28wVhji7U+jQzSkhSHf04GuHNb1EOEvOvcdUzgkAHACcDqk+43+Nz PehR2TRXtcrjvzKC5D8T/JKGkdvcs19YT0EdgQAT3FTJpm6Llcm052TFerDkVXGMy1Zk /kYw9SPWHpzCQki6vc03qX/iHBbkx5eXZ5iJ1+kokiWH11tUB4f/tziX9sFT9O2dxUG2 gs0yQPvNFftM3dmyOQnc0ZFOoUOqrLmzzLatI8F17hNAqSgE5eg91vWG4JMwICBXvqpL iBJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ivWKiRt0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-130198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dr12-20020a056130278c00b007e394afb8f4si610878uab.98.2024.04.03.09.31.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:31:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ivWKiRt0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-130198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0656F1C25D19 for ; Wed, 3 Apr 2024 16:31:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9379A45037; Wed, 3 Apr 2024 16:31:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ivWKiRt0" Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BD5A58203; Wed, 3 Apr 2024 16:31:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712161899; cv=none; b=PIHqhHVQdqj930zyMLSzMw2ZqFoG2SsMFM0qH+yDCNVE+IOMnQvd/kYRvAOVGWo/Mj2rhveWL8Hkj1gV8QrQVXVyoXbElMlIziEKMPKPXOEbxrZWL7Pc/lES4REU91ApUTwhrhAqn2RT82N3NrHaxzZqRoa1D4ZcmRjIgA4ssm0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712161899; c=relaxed/simple; bh=wCGfbqkCjZqO1k85+SxiFGnS5gu5jwe8FmDhiwuzS+A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fyB3bjCjg6tjjMyrBMl8S6XsI+sgbriEJamIQSNqJEMloKodPcSk9II86Q0tL1hBYWOLrRAvsfPG7///haXj4TbkBjbacsejnVbgDKRFItT/EgPihdjJS1oW8oL/8UCTWB+imIzA0vbJaLsORjMWY2JzPqpA5neKFYLV9qS3LEY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ivWKiRt0; arc=none smtp.client-ip=209.85.128.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-6154a3df493so9309877b3.1; Wed, 03 Apr 2024 09:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712161897; x=1712766697; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WitudJQrPd2aFPqvPyORq1RfFG+UAlZFwAtUhdU5ix8=; b=ivWKiRt0B2I5aWf5WtiQcklSaD7i3m4gyUU4q64TL77qsMSsAv08kPBSekgxpQ8XdT WrRe2c+AbwjbCjDGcljSX3nzYI0QqYW1OfRVWgLGuG16B/CixIFG7ZRrHKxuYvrQvJGm BRtOWkg75dm/dADPiGCP1obZfxjkNeL+VHwClWDvaXQLzM8UwcFIkC/TG3facQ/AI2/B Rg8PZm+rF+paTsq3z2FrDf8YOz27g95vQ+dpuSHTfdRBkAV1Uc2bN3PZJssJ7ed1Nme1 pSg0P6l4YXJjYmWU40EeZgB8G9tGEiJU3Gtebo6f9d+XiNKxel5xA66JsvTNfu6EHABb jE6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712161897; x=1712766697; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WitudJQrPd2aFPqvPyORq1RfFG+UAlZFwAtUhdU5ix8=; b=tBVDtPgASNbvws4v57psZ5Akd6f3Rr+0yhNfF4+wwmS07HVGN6SFfVCXjYjuqPT2jy MKEtqzeV2CKis61pAAjKhqTBLS5xcMdg4j/FQhFrptpkb+z3ijFKeWCLmwJby+ElhX++ QeMppoNxHytiSFJFUhke374wfXZyr1+O5PvGJmeCONd54CsH5Kj7TCihbj+k296B49uz ZP/gq1LWFkKTSd1C4GrPoza1R2LYSJ0NAarJCmH2+vExHKjjehfjjcwloy6rjIEhUHFS CsTourn9vaP1jJ3CTiW3Sp6rJMz0am1+a2GfpLEJyBBC8znKZIpur0idC9ufvpy9ZV+a 98uw== X-Forwarded-Encrypted: i=1; AJvYcCXB3e6G5LIVAlOpwEm0mVgE9tztboO/DvWhskP1brxjrpbZPdDOvyO/ABGAntxXy+sA9CH9fM+5/NPQ97l2wOz0t6CW+N0Y5Lh4M3a4co0xNoGjpJD07am3uLL76ny2jxhSNtgJYw/YAmwJyw== X-Gm-Message-State: AOJu0Yw3mLZ3FHFRLelqvAIjy1dv/7Oflty+dt9mkbuCiQeYRnB5RV2a 2hv/wRSbNv8BZpaHq/b9HmrMnGLIXBiIna7RrKdhiEIQj/EqHjlX X-Received: by 2002:a81:6cc2:0:b0:610:b545:6605 with SMTP id h185-20020a816cc2000000b00610b5456605mr1908655ywc.26.1712161897057; Wed, 03 Apr 2024 09:31:37 -0700 (PDT) Received: from localhost ([2601:344:8301:57f0:e71b:60d3:a7cd:425b]) by smtp.gmail.com with ESMTPSA id l3-20020a81ad43000000b0061548271a57sm652178ywk.98.2024.04.03.09.31.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:31:36 -0700 (PDT) Date: Wed, 3 Apr 2024 09:31:35 -0700 From: Yury Norov To: Dawei Li Cc: will@kernel.org, mark.rutland@arm.com, linux@rasmusvillemoes.dk, xueshuai@linux.alibaba.com, renyu.zj@linux.alibaba.com, yangyicong@hisilicon.com, jonathan.cameron@huawei.com, andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Thomas Gleixner , Andrew Morton , Peter Zijlstra , Rusty Russell Subject: Re: [PATCH v3 01/10] cpumask: add cpumask_any_and_but() Message-ID: References: <20240403155950.2068109-1-dawei.li@shingroup.cn> <20240403155950.2068109-2-dawei.li@shingroup.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240403155950.2068109-2-dawei.li@shingroup.cn> On Wed, Apr 03, 2024 at 11:59:41PM +0800, Dawei Li wrote: > From: Mark Rutland > > In some cases, it's useful to be able to select a random cpu from the > intersection of two masks, excluding a particular CPU. > > For example, in some systems an uncore PMU is shared by a subset of > CPUs, and management of this PMU is assigned to some arbitrary CPU in > this set. Whenever the management CPU is hotplugged out, we wish to > migrate responsibility to another arbitrary CPU which is both in this > set and online. > > Today we can use cpumask_any_and() to select an arbitrary CPU in the > intersection of two masks. We can also use cpumask_any_but() to select > any arbitrary cpu in a mask excluding, a particular CPU. > > To do both, we either need to use a temporary cpumask, which is > wasteful, or use some lower-level cpumask helpers, which can be unclear. > > This patch adds a new cpumask_any_and_but() to cater for these cases. > > Signed-off-by: Mark Rutland > Cc: Thomas Gleixner > Cc: Andrew Morton > Cc: Peter Zijlstra > Cc: Rusty Russell > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Dawei Li Thank you, Acked-by: Yury Norov