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 B7735C7618E for ; Mon, 24 Apr 2023 17:11:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231908AbjDXRKt (ORCPT ); Mon, 24 Apr 2023 13:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231983AbjDXRKq (ORCPT ); Mon, 24 Apr 2023 13:10:46 -0400 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 E1BE65FC6 for ; Mon, 24 Apr 2023 10:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682356198; 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=OgUsTW9maVz5SYqmXCdcKI0jUBBCt41uSwRWxLob5gI=; b=W0pC6nhupnce7puxOAXemF7UvBG4NXqFBvIH2brXnE0tNq3BqiMV5duif+BnXBZAkuoP00 k/q+o1sQFADJWF9U5OC38WFsOm85KaMsq8FwohDSe4rDC0/jCR1X6WX2Jii8NLrZ4GDpC6 V6Z4uU1MBNITYR/eUiZcWr00DgFJoUE= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-264-YrnGmtYwOLSpEQS1Il-dtg-1; Mon, 24 Apr 2023 13:09:56 -0400 X-MC-Unique: YrnGmtYwOLSpEQS1Il-dtg-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3f18b63229bso38936065e9.0 for ; Mon, 24 Apr 2023 10:09:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682356195; x=1684948195; 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=OgUsTW9maVz5SYqmXCdcKI0jUBBCt41uSwRWxLob5gI=; b=HvuBvM1L0kpv39rJlRC4XS/wBZpyR6BM55uRZ1d+WxHi2wL2x6cyiAtExdxljtluHZ nJkgKntG8au8Znls/lBqcGSBFh7uzUNFg77CbQvCPRVHA02KqhruboHoi9ObPR3KqKeE whutkCw4MJotBgM2qWH64UaLOINiPvWXpnmeG4YicCp3URKH8fVnXBHL4TLzyZevLeiX j5hHrkbndhvZe3jOtjRjpciE6L1RrdiIMhGO+eQeunRSuxDJ8iSYX9oOCHIdw2JI4e2D Z+NiJasizthJxMZp3g7r2BktpFo4t3cxaJnEulfsx9s/KwbJkurQLd+xc5qPvIYYYgsI Fb2g== X-Gm-Message-State: AAQBX9f6fU72acJQpAzrrGPr/g5NhnO5WU44cEB1itWjkHeQ/KyueaRm MXQDfrFgFScAzuruS9xz4asOOEr3Nx+hZhnvhcCTmz6kVnp3wxOdpESV5CixCouDLbyu7qjnSH2 CmbMo36rJYcW1t38X X-Received: by 2002:adf:ee91:0:b0:2f0:2e16:7e0c with SMTP id b17-20020adfee91000000b002f02e167e0cmr14022953wro.26.1682356195279; Mon, 24 Apr 2023 10:09:55 -0700 (PDT) X-Google-Smtp-Source: AKy350YHammZSSXtFBRiRgQbIBE6xsn5b0O7mWQ6zsuEYOSTLmqZ/wx8guTLKGPMZOG3vHcfAOeOBg== X-Received: by 2002:adf:ee91:0:b0:2f0:2e16:7e0c with SMTP id b17-20020adfee91000000b002f02e167e0cmr14022941wro.26.1682356195016; Mon, 24 Apr 2023 10:09:55 -0700 (PDT) Received: from vschneid.remote.csb ([154.57.232.159]) by smtp.gmail.com with ESMTPSA id z4-20020a05600c0a0400b003ef4cd057f5sm16353354wmp.4.2023.04.24.10.09.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 10:09:54 -0700 (PDT) From: Valentin Schneider To: Yury Norov , Jakub Kicinski , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Yury Norov , Saeed Mahameed , Pawel Chmielewski , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Paolo Abeni , Andy Shevchenko , Rasmus Villemoes , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Tariq Toukan , Gal Pressman , Greg Kroah-Hartman , Heiko Carstens , Barry Song Subject: Re: [PATCH v2 7/8] lib: add test for for_each_numa_{cpu,hop_mask}() In-Reply-To: <20230420051946.7463-8-yury.norov@gmail.com> References: <20230420051946.7463-1-yury.norov@gmail.com> <20230420051946.7463-8-yury.norov@gmail.com> Date: Mon, 24 Apr 2023 18:09:52 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 19/04/23 22:19, Yury Norov wrote: > + for (node = 0; node < sched_domains_numa_levels; node++) { > + unsigned int hop, c = 0; > + > + rcu_read_lock(); > + for_each_numa_cpu(cpu, hop, node, cpu_online_mask) > + expect_eq_uint(cpumask_local_spread(c++, node), cpu); > + rcu_read_unlock(); > + } I'm not fond of the export of sched_domains_numa_levels, especially considering it's just there for tests. Furthermore, is there any value is testing parity with cpumask_local_spread()? Rather, shouldn't we check that using this API does yield CPUs of increasing NUMA distance? Something like for_each_node(node) { unsigned int prev_cpu, hop = 0; cpu = cpumask_first(cpumask_of_node(node)); prev_cpu = cpu; rcu_read_lock(); /* Assert distance is monotonically increasing */ for_each_numa_cpu(cpu, hop, node, cpu_online_mask) { expect_ge_uint(cpu_to_node(cpu), cpu_to_node(prev_cpu)); prev_cpu = cpu; } rcu_read_unlock(); }