Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6214756rwb; Tue, 9 Aug 2022 11:02:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR5MjdjjuDGdfiVwVvZyk8+VCmcrwCvd1x5qYu3DI5njXaECEGs32QqYnQ60S3y+67HBq3We X-Received: by 2002:a05:6a00:3408:b0:52f:9dd0:4b21 with SMTP id cn8-20020a056a00340800b0052f9dd04b21mr5420315pfb.39.1660068175961; Tue, 09 Aug 2022 11:02:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660068175; cv=none; d=google.com; s=arc-20160816; b=F/eYXPiFhw+OrIidkB7I9sbGJbah/raBoz5nfNb782mLrY9a/Zg9BBUHojOLFtQ5am GcDQGbywiQo4otk83Kxe5k6M5krfDKjCJu3Hlj94fkD+G76jQ0Keb2NPBYN3mhZBjXE9 7G/1EbDPuHJ7QHbWDWuGvzwdU3itVpSpuc9nMhesHePpLz1XPrxODbsXaemkIt/SeCwM z2OLsgWKq+GePD0zVtR7cWr8kRgxNFEy8IK3dbsdpx5XyKX/PuIDqI7kr0qhgs05YKoX 72xSQRaTP1QMqRuR66JaiG5hSBzzjzJPYLOeY+SpT0mOpOx7KCGdIDsYEqrarDig0d5e eSGQ== 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=EpsfinQmEWM+SHyZD/utaFr+TSXXqftEifyBCQeGArk=; b=pbyoI9IhvaxMSrALiML/GSzOREJC1EvHHEkdrxAe53BUr+K2+ELL8xj00VsDjpS9Ly LSudwiM7j/7yk0rSoA0gWOkcYNWbA7pwNEdAtEcxC5BuUYpMpSMi/jGhkCuotm3H6nyK GSoTkeGk5e2anYvDmYaynRYEAKWZ6/B/DpcrNg5rYON1n8nInRXXHZeXiVQ9GFmcf8zE d8vRf6YKWIpMLLCgz0vdld2G7cm0ldlL7tkp1kxNZ3IBvLjUZm3cL1dHQZtiMesEhA6U f8WJ7QvIbB/p1fM5XIdXkqr6u3pvTi3XL5N30vlkC2Vr53zez73CCNnD2vtwOfsYLzHz t5iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JhiHI6G9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 i3-20020a17090332c300b0016d0a9f9c4esi9951606plr.103.2022.08.09.11.02.36; Tue, 09 Aug 2022 11:02:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=JhiHI6G9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S245637AbiHIRhN (ORCPT + 99 others); Tue, 9 Aug 2022 13:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245634AbiHIRhH (ORCPT ); Tue, 9 Aug 2022 13:37:07 -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 ESMTP id 3AF0B25287 for ; Tue, 9 Aug 2022 10:37:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660066624; 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=EpsfinQmEWM+SHyZD/utaFr+TSXXqftEifyBCQeGArk=; b=JhiHI6G9Q3Rg713hTTgKC+6o3pw78HSSRkgXUSwJAaZEF/q+qprx28EHoZaKguxDc9UnLJ s3OI1IvuhZtLRzJCr8sV79eIp7uk14Nw/mcliUO6vpgaKmfYdi5Oly+Z1SdTTTQeBjSzEE Kac7hTfIw8ozCEhZJ2s4HBd7klP3jzk= 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.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-606-ye-AW4zNN32hW3ycAyBOiQ-1; Tue, 09 Aug 2022 13:37:03 -0400 X-MC-Unique: ye-AW4zNN32hW3ycAyBOiQ-1 Received: by mail-wm1-f69.google.com with SMTP id j22-20020a05600c485600b003a50fa6981bso8353199wmo.9 for ; Tue, 09 Aug 2022 10:37:03 -0700 (PDT) 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; bh=EpsfinQmEWM+SHyZD/utaFr+TSXXqftEifyBCQeGArk=; b=7al2eDqbQjkfu9ltUaZS3XtThSbpgeuaonLDoLDQnHpXfbd/TsLc2s9RrQfVTprXOR y8uByY+V0Xl5EpjGRWO5ZPXsgZhDiMN8zihCZ6Ypjm8F4Uaa8LR4qw5kGSsziN9dgPTQ fPmxTc1phjBD8dIj5lJgG6xSKd9QfG/yk8NumoPA4DBY5tqinqc1jyMMrIcK7Ax+2jY6 IwxSQvkO/V68UqKAD64bomuNwr7jCj5HtdAGgsrPVFvX54hp3ZRwnooVMPvq9uCZFpxQ V+mt+/9UJe1l6a4+0k/Lr8N1OEcJefe+/+V+qcT+fMx7oUQo1Qq87QFRZCYD42JQbhh9 y4yg== X-Gm-Message-State: ACgBeo10oEvJcWimz58vF6IIueqEHmSbdS4czdAarBvDJWJuCbi5T9WE baDWgejI761usAuDE715coaTAmgGTpcptPDhLjxg+/HrnzNHiVoycQZ5VhEX/FuvWGZwo9paeAm CIjKm497yNJ0mm7SlM7cAggrGZgwl5SD28BO2iEEVtUq/PNpKEIh6Jm/94F71NOlSu4YDKgfUU0 IQ X-Received: by 2002:adf:ed4f:0:b0:220:5fe9:9995 with SMTP id u15-20020adfed4f000000b002205fe99995mr15127524wro.388.1660066621807; Tue, 09 Aug 2022 10:37:01 -0700 (PDT) X-Received: by 2002:adf:ed4f:0:b0:220:5fe9:9995 with SMTP id u15-20020adfed4f000000b002205fe99995mr15127500wro.388.1660066621582; Tue, 09 Aug 2022 10:37:01 -0700 (PDT) Received: from vschneid.remote.csb ([185.11.37.247]) by smtp.gmail.com with ESMTPSA id b6-20020adfee86000000b00220606afdf4sm14366974wro.43.2022.08.09.10.37.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 10:37:01 -0700 (PDT) From: Valentin Schneider To: Tariq Toukan , Tariq Toukan , "David S. Miller" , Saeed Mahameed , Jakub Kicinski , Ingo Molnar , Peter Zijlstra , Juri Lelli Cc: Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, Gal Pressman , Vincent Guittot , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next V4 1/3] sched/topology: Add NUMA-based CPUs spread API In-Reply-To: <69829c71-d51c-b25f-2d74-5fdd231ed9e4@gmail.com> References: <20220728191203.4055-1-tariqt@nvidia.com> <20220728191203.4055-2-tariqt@nvidia.com> <12fd25f9-96fb-d0e0-14ec-3f08c01a5a4b@gmail.com> <69829c71-d51c-b25f-2d74-5fdd231ed9e4@gmail.com> Date: Tue, 09 Aug 2022 18:36:59 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org On 09/08/22 17:04, Tariq Toukan wrote: > On 8/9/2022 3:52 PM, Valentin Schneider wrote: >> On 09/08/22 13:18, Tariq Toukan wrote: >>> On 8/9/2022 1:02 PM, Valentin Schneider wrote: >>>> >>>> Are there cases where we can't figure this out in advance? From what I grok >>>> out of the two callsites you patched, all vectors will be used unless some >>>> error happens, so compressing the CPUs in a single cpumask seemed >>>> sufficient. >>>> >>> >>> All vectors will be initialized to support the maximum number of traffic >>> rings. However, the actual number of traffic rings can be controlled and >>> set to a lower number N_actual < N. In this case, we'll be using only >>> N_actual instances and we want them to be the first/closest. >> >> Ok, that makes sense, thank you. >> >> In that case I wonder if we'd want a public-facing iterator for >> sched_domains_numa_masks[%i][node], rather than copy a portion of >> it. Something like the below (naming and implementation haven't been >> thought about too much). >> >> const struct cpumask *sched_numa_level_mask(int node, int level) >> { >> struct cpumask ***masks = rcu_dereference(sched_domains_numa_masks); >> >> if (node >= nr_node_ids || level >= sched_domains_numa_levels) >> return NULL; >> >> if (!masks) >> return NULL; >> >> return masks[level][node]; >> } >> EXPORT_SYMBOL_GPL(sched_numa_level_mask); >> > > The above can be kept static, and expose only the foo() function below, > similar to my sched_cpus_set_spread(). > So what I was thinking with this was to only have to export the sched_numa_level_mask() thing and the iterator, and then consumers would be free to use whatever storage form they want (cpumask, array, list...). Right now I believe sched_domains_numa_masks has the right shape for the interface (for a given node, you a cpumask per distance level) and I don't want to impose an interface that uses just an array, but perhaps I'm being silly and the array isn't so bad and simpler to use - that said we could always build an array-based helper on top of the array of cpumasks thing. Clearly I need to scratch my head a bit longer :-) > LGTM. > How do you suggest to proceed? > You want to formalize it? Or should I take it from here? > I need to have a think (feel free to ponder and share your thoughts as well) - I'm happy to push something if I get a brain-wave, but don't let that hold you back either.