Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1939807rwb; Thu, 17 Nov 2022 04:29:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf60kgyMFY/WVFwe1p02aBs1e2wB1Ues7x+T79+4EPjH8omkoaXAekuUiDYa1+MBKQkPCgw+ X-Received: by 2002:a63:2163:0:b0:474:d6fa:f574 with SMTP id s35-20020a632163000000b00474d6faf574mr1847469pgm.190.1668688162802; Thu, 17 Nov 2022 04:29:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668688162; cv=none; d=google.com; s=arc-20160816; b=ok8zzJAVGjx+a/pqTDobZC8jQfnS9swAs1y9qHewRazubvHyk8FJFj+ZJoAWP/zKVA 17LZPOHzS7YY0M4l7eqMwaEZYCPPjgM8z85v/IztFSEcUar/7hBkBBSb3mvD03vVOZcl vk0a7Tfk0nNHUBPb7w+9gjTOsUl2upBmYLSzzFPjpibDBwdO5jVwtYc3q4Oenynm2qYN CZ80za3OlaUKhowzgjCsyplLDe4sCX0dBPHvReXoKQr155eOrjMRWnZu4QurvH0ShVks TWvac2RCjAw2wQBZGjlS2NEGCzQd3ozhqvWUuPmMtcgg9VKf7wFxNPXVniPYZeMZiwwE mxTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=5jdvVC382FTzq1UHx+dqms0RlcCWrWtt69iT+pMSrhc=; b=xqNwqXbxYcaWWD/ROTY6mdQ7F0617vPBw39v2F9Fjf5G2I5NCbwyPyEhS0iHGOkmM9 6YRr8ZPcfUiworseM1mvpNDYk3yaHsWO95TYTlFKQz8GcooWA/I6VpG+3Vjy816N73sP IHP/f+8DOFdcbQZ2B4uelJTfAHNlbNqfM7nBKnrsthHkhz6lZuFuW70uhj4kOa8GDUbS EPyYf/t8pYhOzZNjBwUf/77UujW9smG2TU6cNKssW63fHbOoetrLTZxRJb2gHLSygE32 vJxwbseEEbqZ6YzeWDBCqZhAeSXQfEN+8xaEamToIxKigSb2iPW+hCNG8/DouqEGJaLD Axpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Zcn30s6m; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w130-20020a628288000000b00571b10549b0si758496pfd.87.2022.11.17.04.29.02; Thu, 17 Nov 2022 04:29:22 -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=@redhat.com header.s=mimecast20190719 header.b=Zcn30s6m; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239684AbiKQMYs (ORCPT + 99 others); Thu, 17 Nov 2022 07:24:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230327AbiKQMYr (ORCPT ); Thu, 17 Nov 2022 07:24:47 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C43A92229E for ; Thu, 17 Nov 2022 04:23:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668687832; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5jdvVC382FTzq1UHx+dqms0RlcCWrWtt69iT+pMSrhc=; b=Zcn30s6mzHo2TA2845EVihGK7vA5Dp9MKdZXfGilcuB6FGDDuYtLgWGz1WFZcjTGZKklnD 2jkG9Ap4TgoS+EGcsBnkoQC/og7AmoHvNrEnGMOM9wPmqoqqJ7EDLOFGx/n5PK9xejdqoH 5BiyJ+NDBxVVP4oQBxAnxSkqEhTMCaQ= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-132-0MEx8mbYOfK_S1VtoN_Zmw-1; Thu, 17 Nov 2022 07:23:51 -0500 X-MC-Unique: 0MEx8mbYOfK_S1VtoN_Zmw-1 Received: by mail-wm1-f69.google.com with SMTP id 84-20020a1c0257000000b003cfe9e8e3f9so589767wmc.0 for ; Thu, 17 Nov 2022 04:23:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5jdvVC382FTzq1UHx+dqms0RlcCWrWtt69iT+pMSrhc=; b=Et5hd/OJ5zKL2IDoiYI2zfTQ5H382oyyXe4X4XSvE4bE6YcWu3WwtrQiLJnLpaJRK9 AX+/m02Mr5XFQT7OWxF+YOFYtNPq04r/Zqe1ovCAJEkR4mqxkzD0XnMh9wvc4wKcn0rZ Ytg1M6gw10vr1uG3IaDRbqSL9vUg4ao8/znO+BCDF/PgKjWxygzYKnHzZ4T0c1fPMnju rjLqohQNW/47Qpr2IiE3lEpyklZnmpSmEUcvvb9f6ozLUBdqeJFmZ5tMd3fWQ+xfTY7W vPS+o1Egu9HDDUOO99aivY3/L/i3y1kNGiXRdT3TzzCzPQeunlmyMtO2dk1HONSmeLzU 5maA== X-Gm-Message-State: ANoB5pm63fHjNbOU6p3/UmKEAvR9GdhUhMOD2TcGguC63w+k3/64s9v9 cu0IzPWQbcbg9o0M/xHg0qilfpaYnZ26A6TbwxFN4wnIZs4Lb+9Lobp0jG69wtUzHVBt8ghzy/c 0ohKlVqikZUG3kY6B76PU0mJn X-Received: by 2002:a5d:4ace:0:b0:236:7988:b282 with SMTP id y14-20020a5d4ace000000b002367988b282mr1368751wrs.341.1668687830287; Thu, 17 Nov 2022 04:23:50 -0800 (PST) X-Received: by 2002:a5d:4ace:0:b0:236:7988:b282 with SMTP id y14-20020a5d4ace000000b002367988b282mr1368719wrs.341.1668687830120; Thu, 17 Nov 2022 04:23:50 -0800 (PST) Received: from vschneid.remote.csb ([154.57.232.159]) by smtp.gmail.com with ESMTPSA id r4-20020a05600c35c400b003c6b874a0dfsm1315337wmq.14.2022.11.17.04.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 04:23:49 -0800 (PST) From: Valentin Schneider To: Yury Norov Cc: 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 , 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 In-Reply-To: References: <20221112190946.728270-1-yury.norov@gmail.com> Date: Thu, 17 Nov 2022 12:23:45 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 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. > Thanks, > Yury