Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1687981rwb; Tue, 29 Nov 2022 17:51:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf5JceOaX1PL5riOPPZUetFItQp2vLgD40ft425X2OK0xJvwGQEWVA9IaK13xb6dUjx9JSdP X-Received: by 2002:a17:906:9f09:b0:7bc:db1b:206f with SMTP id fy9-20020a1709069f0900b007bcdb1b206fmr20101216ejc.719.1669773069497; Tue, 29 Nov 2022 17:51:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669773069; cv=none; d=google.com; s=arc-20160816; b=CmiHJ7x9h3KcQZVrAPhW1ToLPXouraGloswOKF/c1CFg2nly58Q/27WnRWcdCLMLCj XpYel2aMDrKUp4OekOE7q+1Lvy75t6ZVIB/VxvJfWKraJJ6G7cpK5GZ2eeYqMtYFf2ha SSjaXp0i0Uu70EJkAAebMq1qOUj5BEs9oNy2jL0JQtQwbGaLUm01vAOZ770+k7kCx7Fk nDdIExb7NQOpeNHlbW7UjdD2dRzFFE8ThUDO9PJPYC2nBBtt+HEWSVdvex+3AKHVgzW9 wJeZ7uart8y4mrieldrcrBU2ZQvmd3EJpetoOhEnQUA47hTvhzGC5BODGZHSdxB2nIc9 i0iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jHLuEwDd4ephlkChL9nCW8YQ7VT3fy4zl63QtukC6uk=; b=QAHD4WngXbuNU19O+Ai35aeRhfbMcRNvjBCAuRBzGFd04MDNR242uSRjOTufJfjDZN XPQORkNu1+6ZR5w8vfAFJ9kxx0Nmocc91yM10B5+LmUTAqPI6fbz9H3stCFr2dwZYrMI ON9O9dDXbFbLm5HmG9gAP2rokbEBA41KAN0isl2CJqfk0d+1Xeia2BVpjfcRsCetoh82 gAqWgW2aMg6Mt+iHSZ1a8jFb0BoMqKno9IA+yk+f2w3MdvTHLEA/vEmrz3qlHNHbRdmB SvtTGEiQmu4YuOhA9jt9FtR2Niy+urOK6KIPsf11e44ljTN24D8xtc3Px4F5hFqH1Xp3 9OEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mszqok5e; 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 c13-20020a170906340d00b00782161b3422si105463ejb.914.2022.11.29.17.50.44; Tue, 29 Nov 2022 17:51:09 -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=mszqok5e; 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 S229981AbiK3Brh (ORCPT + 99 others); Tue, 29 Nov 2022 20:47:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbiK3Brg (ORCPT ); Tue, 29 Nov 2022 20:47:36 -0500 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5904813B; Tue, 29 Nov 2022 17:47:31 -0800 (PST) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-13bd2aea61bso19433311fac.0; Tue, 29 Nov 2022 17:47:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=jHLuEwDd4ephlkChL9nCW8YQ7VT3fy4zl63QtukC6uk=; b=mszqok5e+P0HO8KMquZAwj2ulqGdn79hCsFcF6DehjjW2LARu8qilsWv3XsVH69EOG B9E5tH1teWPEFpT/vbZlByIBSIV2ET24W1YgOHMJ3rkfEj2AaI7cw3X2d1h+yoeP6grJ Gycis4bjMmnnxhJcEs9FqNSVKZqIA0fXPpsDaASEqc8GrahoqbdmpIklGpKJWbNfVcp5 SqgASUiIeX/svV0O5X0Mq+oV9nXPokWgVkPYjcnrWvQ9TJA2tREyxbhS6WfGaNrgyih8 DxT4kxu4/NRZNbrXi01FQdq1hmdGpvKXlLGEZXh0xIoc74o2d2H+bve/hv2KkhVHeBsr BnHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=jHLuEwDd4ephlkChL9nCW8YQ7VT3fy4zl63QtukC6uk=; b=atVFeS/gCcwZQsfMay8mIuNWjFSXvGS/gtPMPgBklvh4Sf9Cig62khS4QHsGYLh4lO Il1ZmMefxO0mw41TkARj884GqYokYBixuzwFgW8F9HHr9YnfJqIvNVxfz/i7YJLSBZrD VAkgadSEXyc89sR0AeMNP0G3VXsGrvA8BPwkWnXfUy3w1VgBF7oeSMY2oi97OmCz+LuB j+ClYbNmWguiR/W+yfkfXsBvWTujnOYMnWAJCTn8n5Ru3WBWF2Cb8jTKa/y5fjs2cfGI rDDrQIyJlIoX+Y73kLU+dpb4NtgBsEGhhyh+Yc8/PQpJMygHO8zxCRyk8gQBgwq28jf0 X8QQ== X-Gm-Message-State: ANoB5pnjqtQw9iGMBDhmbYVTwoVAl+9Jmg+nUVFUIEg53o8nndFCh+sV ivadBiTlwZUBPD/PuAYFW+U= X-Received: by 2002:a05:6870:5a5:b0:13a:f95a:2cca with SMTP id m37-20020a05687005a500b0013af95a2ccamr34859654oap.212.1669772850608; Tue, 29 Nov 2022 17:47:30 -0800 (PST) Received: from localhost ([12.97.180.36]) by smtp.gmail.com with ESMTPSA id z25-20020a056870d69900b00141e56210b2sm222965oap.57.2022.11.29.17.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 17:47:30 -0800 (PST) Date: Tue, 29 Nov 2022 17:47:28 -0800 From: Yury Norov To: Tariq Toukan 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 Subject: Re: [PATCH v2 0/4] cpumask: improve on cpumask_local_spread() locality Message-ID: References: <20221112190946.728270-1-yury.norov@gmail.com> <665b6081-be55-de9a-1f7f-70a143df329d@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <665b6081-be55-de9a-1f7f-70a143df329d@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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 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.