Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1955495rdb; Thu, 7 Dec 2023 13:42:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDmEGJdLx7O1Hf7fh0OoQTSzoqQ23BbXccnafRE/grTXjI7XMaWNumwPveX0TtedKp8i4I X-Received: by 2002:a05:6a20:a127:b0:18f:3c1d:1f2b with SMTP id q39-20020a056a20a12700b0018f3c1d1f2bmr2584329pzk.97.1701985329383; Thu, 07 Dec 2023 13:42:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701985329; cv=none; d=google.com; s=arc-20160816; b=KdvA5rydZ6mrzGF6jixpeTCsk1wWgAodud8Eho+E36M5HmlKldvxdNPODiPxswVrXn ePkNa3ys81y1pocyCFeS4cKeZ5huFJ3tdMWHVcLMXu7XnuwMW3qPl3bQic/9ybr86SrW BgJAzOq1nAWcH+vx7TYu519d9CqyHZ/HlnePB43BvNUa5vNuO1H/NlR+nfeBve/5imks UUp3PlBAu73ePEbZTIMphQAMZ7BMgAbrik9c92Fw+CMB6h28e7DdBBFc6k8v2dIFfli2 1uYKQsYyqP/CUh6Zopr1+HH5McxI5MY5tjyZI5jOwZKtlqOkzsAkZnLIK6sHf2XnwYDJ 9DIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Wh6cgkCIGZBJHQ3BtU4mTvAGil7w7UC8q+cCPDLx2bI=; fh=Jx5ujPV+AkkglogN9Dh3TOlpSrZkmLFElIsX7ggU1sE=; b=a9ylTqpFBDHaY0xsp3Iz1xpRBTLSSM/AMJE9obPo+OxX6CtlzLe/PIK1aVcFWJxqZx T40SreV49hKZ13ezfXjCbZWKnX9GuPX/WRu+wXXqOGb7yHeZe3MADERfyoQYOu6SI1C+ Gjgo29LlUN+VGrYWZZ2CsZyNCsNWUZKU8QsDDqDGqWaYV3g8ryyaLL+UKi1bi3ogdejl ik+zwfjItDlN5X0gdK7NVeZvw7UBg+k3uNJc5IxzeKqd+NCwrG36rWrUimO819iem9zf qJsCNrFdTUhBxZzcLiFzZXTEpEIjBNRV8BLaNwmbVScslHrhR52hwAme2fEbcqnsvhCE oLhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="ZU9/Zr0t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id e15-20020a170902ed8f00b001cf5cb5ac88si237522plj.486.2023.12.07.13.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 13:42:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b="ZU9/Zr0t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id AECDB81603AD; Thu, 7 Dec 2023 13:42:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231481AbjLGVlx (ORCPT + 99 others); Thu, 7 Dec 2023 16:41:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231499AbjLGVlv (ORCPT ); Thu, 7 Dec 2023 16:41:51 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 458A410E6 for ; Thu, 7 Dec 2023 13:41:58 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A66D3C433C8; Thu, 7 Dec 2023 21:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1701985317; bh=pxbkvWPyG5KlmzsHOZAtK+EcaWVG6n3b0d6X7OmmU7E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ZU9/Zr0tP88r/R9PJyHSUKU+soRsm93JiBQYxf2LeuEFQnJiUJoB2dRPf6aWueGU/ hKHyqALgIjmJJUXZTLmx6ZoHGqX4GsiQWSGWQKv5Xrtu0YpqP4wfqDIQvwEmOdAmIA J0oobNdRY3HS9JadQdXkjUZDJtmQLPFX7J5LihK4= Date: Thu, 7 Dec 2023 13:41:56 -0800 From: Andrew Morton To: Yury Norov Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, Ming Lei , Andy Shevchenko , Rasmus Villemoes Subject: Re: [PATCH v2 1/6] cpumask: introduce for_each_cpu_and_from() Message-Id: <20231207134156.494973b8d8aa7e1aac4891d6@linux-foundation.org> In-Reply-To: <20231207203900.859776-2-yury.norov@gmail.com> References: <20231207203900.859776-1-yury.norov@gmail.com> <20231207203900.859776-2-yury.norov@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 07 Dec 2023 13:42:06 -0800 (PST) On Thu, 7 Dec 2023 12:38:55 -0800 Yury Norov wrote: > Similarly to for_each_cpu_and(), introduce a for_each_cpu_and_from(), > which is handy when it's needed to traverse 2 cpumasks or bitmaps, > starting from a given position. A naming question: > --- a/include/linux/cpumask.h > +++ b/include/linux/cpumask.h > @@ -332,6 +332,17 @@ unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta > #define for_each_cpu_and(cpu, mask1, mask2) \ > for_each_and_bit(cpu, cpumask_bits(mask1), cpumask_bits(mask2), small_cpumask_bits) > > +/** > + * for_each_cpu_and_from - iterate over every cpu in both masks starting from a given cpu > + * @cpu: the (optionally unsigned) integer iterator > + * @mask1: the first cpumask pointer > + * @mask2: the second cpumask pointer > + * > + * After the loop, cpu is >= nr_cpu_ids. > + */ > +#define for_each_cpu_and_from(cpu, mask1, mask2) \ > + for_each_and_bit_from(cpu, cpumask_bits(mask1), cpumask_bits(mask2), small_cpumask_bits) Shouldn't this be for_each_and_cpu_from()? That seems more consistent and makes a little more sense given what the iterator does.