From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3D04C4708E for ; Wed, 7 Dec 2022 12:54:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbiLGMyP (ORCPT ); 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-Google-Smtp-Source: AA0mqf5rJ8Y2G5K8J77Da+1fY6fh0SokcCUuw7mN1S5LXHOpp/KJnxOL0OG+9lxX8aLNgrMq9yk9mA== 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 Precedence: bulk List-ID: X-Mailing-List: netdev@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