Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp773023rwb; Wed, 7 Dec 2022 05:01:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf5aSe0UDnMq15ms+qvU6r2/t4L+BMCinqYEZlRFhL1lTs63/P6Ewdtgrlz6E8iWEmDyzDhC X-Received: by 2002:aa7:d8c6:0:b0:46d:5e5e:5a03 with SMTP id k6-20020aa7d8c6000000b0046d5e5e5a03mr2339608eds.146.1670418073385; Wed, 07 Dec 2022 05:01:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670418073; cv=none; d=google.com; s=arc-20160816; b=qLf0mFOHd2MR2CpRWwC0P30jN67IMweTpp9JW2UVNnwclPRwo7mND7bNTGw/B6UpXp GmgEDiw9BAM/+dtyWE8rAn8ukueXXbuRIuMzm37hA1CahG1pwr8GNyr2+j2kkXiz7IsQ MfDR6Hr6/YDdySFusO5cu4hw879/2INXFvPgtJNBHNuO+RCcBpEAntmAwYY3ijORFo6I OVDoQNk5A1b5IFaKmb649Ts3DFPNy+wvwjmT3Fbii3Vistb24NQ24lMmGmSOxuqJUd9c CdW+xBwP9n8RRY1Psv86TeYYOyyAm3fGyOHHp3FyZnEG/KKRRvdP6s7DO4r5CcAe+stU rxZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=3wHEueCe02/dFo7mDV34CjEc4Hqty62444bWhBRSbJ4=; b=qEKioZB8n4+1AnsnGT1/kzglKd2vxc+mpOw0TrdfglkXqBh2rAyQGDadSKUBRvbVMK BmZ2CcZDZ+b28WKAH/QBcYJNAvjSdhFFWGTWJ9rHLIDUfuSEp6zthTNmkDUVolC7igsP 2osWpWmbaFiGMQUvJ6IWKEgDiUPeezn076Oxg7hw1OiVteAxvVeFbNLxhWGEJA3UjioF R8GrtiHnhW/yRt2xPJN472N2PsgUGabVpX+AFATvxfX3ORE8LrxViOpTkn9OqulKCLht +Grj+PlCrqR020Vx4V5S/JhNJAc8RekAeOMV/JB339LEoJzzP2vHaLBd3U+ZWy4zfVED yZRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VzNNWJf1; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e10-20020a17090658ca00b007c0d0d4bd13si11204908ejs.169.2022.12.07.05.00.39; Wed, 07 Dec 2022 05:01:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VzNNWJf1; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229606AbiLGMyP (ORCPT + 99 others); Wed, 7 Dec 2022 07:54:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbiLGMyI (ORCPT ); Wed, 7 Dec 2022 07:54:08 -0500 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 938BE5217D; Wed, 7 Dec 2022 04:54:07 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id fc4so13684006ejc.12; Wed, 07 Dec 2022 04:54:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=3wHEueCe02/dFo7mDV34CjEc4Hqty62444bWhBRSbJ4=; b=VzNNWJf1AddOafMP3bB5Jbnh04AX1NzHjVhFQA7rKO7lzu+Y9HTI9wgx2Xl9ojcDzK s+D3GU5oT6JD3rhB7arH48dXPoYnxgzLx4GlXrIqnVwsg6sgG/A8DHkkwgdgYZygW7LJ WYdrR6JS3jYsPycNHsP0LFCt5DDkSeO7BcCrLeaW8H8/QasiZR0aC3uGtSzkLkPWWXIg m9w3hTuF188F9NDur0WwC+CpYuj3ubkJQ0N7GqsYEnrg80OFVwex3ofZlMf014sOi5ja VZ5QHiSsXgaOLa0vqbc8QZMlNd52akbeeHaaH7OQVMOb8VrFpw7h0ouL06vw6ZPVJxLy 4Bjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3wHEueCe02/dFo7mDV34CjEc4Hqty62444bWhBRSbJ4=; b=opo9NHeulkFpvm8P4XUVFI6U7CLROf0GLJUps7yE1+MGFml3ixNEwKU3HlVT0dpbVg jB9A0keTD6MrocBUd1P299ixlkd4VKhRPOqRyz0cPwhuB9VVVkUsQusiLxENc5OkTsdJ pH8c90Y3/9hzKcy1bF6f4T7Am+uBbd8WFD7hqTLjM5bJzCXnhg45srCyi+4QdFe6nm7W xcDCJR86i5aVnPRcYoBnHq6tRbUGEHiZWuzhMANl+f6Ok7N5QYrPgrSsMLtqRul6IURc zBReUMHYx+4OsQteqH4teawOyMM2vftFbl/u1Ky5ef4wiVpv5nbKiL7zLSHV48FG0uQ7 imnQ== X-Gm-Message-State: ANoB5pmcZ5d522NBfXGVcqhZg8YRfYLT20uBGtFtDpumQLWiL93dpp7U c9rlo5h/MwtZWR8GvsrFnC8= X-Received: by 2002:a17:906:258d:b0:7c0:aea3:a9a8 with SMTP id m13-20020a170906258d00b007c0aea3a9a8mr23156206ejb.718.1670417645965; Wed, 07 Dec 2022 04:54:05 -0800 (PST) Received: from [192.168.0.105] ([77.126.19.155]) by smtp.gmail.com with ESMTPSA id j16-20020a170906535000b007c0f2c4cdffsm3671712ejo.44.2022.12.07.04.54.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Dec 2022 04:54:05 -0800 (PST) Message-ID: <19cbfb5e-22b1-d9c1-8d50-38714e3eaf7d@gmail.com> Date: Wed, 7 Dec 2022 14:53:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v2 0/4] cpumask: improve on cpumask_local_spread() locality Content-Language: en-US To: Yury Norov Cc: Valentin Schneider , linux-kernel@vger.kernel.org, "David S. Miller" , Andy Shevchenko , Barry Song , Ben Segall , haniel Bristot de Oliveira , Dietmar Eggemann , Gal Pressman , Greg Kroah-Hartman , Heiko Carstens , Ingo Molnar , Jakub Kicinski , Jason Gunthorpe , Jesse Brandeburg , Jonathan Cameron , Juri Lelli , Leon Romanovsky , Mel Gorman , Peter Zijlstra , Rasmus Villemoes , Saeed Mahameed , Steven Rostedt , Tariq Toukan , Tony Luck , Vincent Guittot , linux-crypto@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org References: <20221112190946.728270-1-yury.norov@gmail.com> <665b6081-be55-de9a-1f7f-70a143df329d@gmail.com> From: Tariq Toukan In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 11/30/2022 3:47 AM, Yury Norov wrote: > On Mon, Nov 28, 2022 at 08:39:24AM +0200, Tariq Toukan wrote: >> >> >> On 11/17/2022 2:23 PM, Valentin Schneider wrote: >>> On 15/11/22 10:32, Yury Norov wrote: >>>> On Tue, Nov 15, 2022 at 05:24:56PM +0000, Valentin Schneider wrote: >>>>> >>>>> Is this meant as a replacement for [1]? >>>> >>>> No. Your series adds an iterator, and in my experience the code that >>>> uses iterators of that sort is almost always better and easier to >>>> understand than cpumask_nth() or cpumask_next()-like users. >>>> >>>> My series has the only advantage that it allows keep existing codebase >>>> untouched. >>>> >>> >>> Right >>> >>>>> I like that this is changing an existing interface so that all current >>>>> users directly benefit from the change. Now, about half of the users of >>>>> cpumask_local_spread() use it in a loop with incremental @i parameter, >>>>> which makes the repeated bsearch a bit of a shame, but then I'm tempted to >>>>> say the first point makes it worth it. >>>>> >>>>> [1]: https://lore.kernel.org/all/20221028164959.1367250-1-vschneid@redhat.com/ >>>> >>>> In terms of very common case of sequential invocation of local_spread() >>>> for cpus from 0 to nr_cpu_ids, the complexity of my approach is n * log n, >>>> and your approach is amortized O(n), which is better. Not a big deal _now_, >>>> as you mentioned in the other email. But we never know how things will >>>> evolve, right? >>>> >>>> So, I would take both and maybe in comment to cpumask_local_spread() >>>> mention that there's a better alternative for those who call the >>>> function for all CPUs incrementally. >>>> >>> >>> Ack, sounds good. >>> >> >> Good. >> Is a respin needed, to add the comment mentioned above? > > If you think it's worth the effort. No, not sure it is... I asked because this mail thread was inactive for a while, with the patches not accepted to the kernel yet. If everyone is happy with it, let's make it to this kernel while possible. To which tree should it go? Thanks, Tariq