Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3978161rdh; Fri, 29 Sep 2023 07:52:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqha7hih4A/cLqViFvM35zd4B1tq649Xmj+pjdodqfRONVwefDAk9mjom7up7WnA/+WcSm X-Received: by 2002:a17:902:f54b:b0:1c3:86cf:8cc0 with SMTP id h11-20020a170902f54b00b001c386cf8cc0mr4659489plf.10.1695999147385; Fri, 29 Sep 2023 07:52:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695999147; cv=none; d=google.com; s=arc-20160816; b=LeNEi6A+FyCzgJSm0nFzGZcexPDcECUWwFOJOONi2keh2TM22XqcYPeA5/GHQGSwrP lLUtHoZSymWN5lCJdn4m9luGoBfjmgMmNU4B+PKnOz5F2LPdNlKhKcPHMRVKK0gEZBig KdW64om/rKgANpapeTGBZ4xfNiXmcjXJoZgwTP5015iDQ0oqF0oQOjcFmweDRRB9MF2d 2pybRbbKbdK3zH8iFiVIAILOML7Hkfd/6jheTsY+spYl07gwAOExZzHDzEFvFJJQXmV5 FoLQW6xhk+YyzPGWRb0PpEkfJ59zJGG7SqgvEQSr69YPcjXNZiMf/hFuna3M4qqR6JwP /3IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=MJFVcdWCqcDV6qycuab+i81ZPsWdTYGA5ipCa8aCpMg=; fh=fdbks9cDZD3nws6fbVmPJcsGIn1evRgsQgeNrttrtE4=; b=TPfLCoQIR7KNONZzEB+ieW7YqKzqUXtpg8Dg3ZRJ7m8QK5sfYXWy0h12LVcMEviEjs 8o6sweWih31CA0PytcmQ5eGlB3Y0TZRLmU2506QEZWyVtBuQQrMKVxCtOdbwENV12toB Z/AVTnRa3k72MZrq6FpHKuLWpG8tH3lDosoXMpJ1gDJunfFusLN3WT+2ZyqnoVOPBRzy FkVQhn0krFpGYpDTtYq8toFIouc63ZpG/gWMXHccYpDH/P2fTUfyUip2FOOx4MUF0HIA z1zOxdFNgyE/O+nK5s8O9/WHFy7DykCfPXeHIYB6hEj/MRTkKySwmW2bdrGeMIruJ3my dCvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CXraKciQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id f1-20020a170902ce8100b001c3fcfb8000si21318681plg.506.2023.09.29.07.52.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 07:52:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=CXraKciQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8A80880A2225; Fri, 29 Sep 2023 07:34:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233522AbjI2Od5 (ORCPT + 99 others); Fri, 29 Sep 2023 10:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233208AbjI2OdQ (ORCPT ); Fri, 29 Sep 2023 10:33:16 -0400 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89076171F for ; Fri, 29 Sep 2023 07:32:41 -0700 (PDT) Received: by mail-qt1-x831.google.com with SMTP id d75a77b69052e-4195fe5cf73so301371cf.1 for ; Fri, 29 Sep 2023 07:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695997960; x=1696602760; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MJFVcdWCqcDV6qycuab+i81ZPsWdTYGA5ipCa8aCpMg=; b=CXraKciQQimxJy+UHkFRD4YD4ez/m6GoXPMka7oAOG5OQR+bQK6uOib1lbM44HZxCt 4YYnqtRIWU/ov7ZXAjBP0dxolTwls1iP97J6zIbIHL4prKxX+PhWeASqmFj3fdzvjCuS S3zi+cdmmvIWuhTjhkiIWDBcskNo/rE5EOS9+GG19RLaChK6NCp1qnIsWaWawmFnooqj OttyhwHGPLjSsePgyHu1VyNdDuWNd2eWuaO7mb1UElwmHP4ciQtUcK9JMJcYkiCBBCRK 1LMHlxFhLz0Lp7gNAilOnpE0eKnh8lz1vX/q3j5kM8kbYHPbKVfReUB19JTJZr4nOurb nuLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695997960; x=1696602760; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MJFVcdWCqcDV6qycuab+i81ZPsWdTYGA5ipCa8aCpMg=; b=fqUI0nysWPwSqi/x1v/BmggW5awy3n+3m/fGrUcoE5SsxVrsXIMENLchneEJO7ry23 oWOpeVkq8lnXs/EorZ8aNKDRAVH9hBHFx4BejQtSGsuKkVYdv+mokMPBKl6JmGpFK9Fw 3gU6egvVCVJvfqcEgfqbhUJf6kbbQwA50/H72GFBHgp+BGMxqzMeCbVM8S2uonUqIP/z VcuFxjyrdOpEThnuIK/dKgNyHgmWSsu+2KKaOZjZnWdFkmq4ehu1hdrgHi9r2lqlifU2 oPXnfpReWdXb9+88KihCoYn3Jo/G8Xc9w1Qz6IGAkHY/DLyCpquapeggiijL9uxRsKLc W7kQ== X-Gm-Message-State: AOJu0Yyrr/DZ1P+5xjEEIld/CUeSjLIVidsVRc7ojVhG1ogPbjMtjqqt UKIJPn/QAQDuaRYfDnZdFZLX+BreTdDRVFr3WhXtSA== X-Received: by 2002:ac8:5885:0:b0:404:8218:83da with SMTP id t5-20020ac85885000000b00404821883damr1154536qta.1.1695997960490; Fri, 29 Sep 2023 07:32:40 -0700 (PDT) MIME-Version: 1.0 References: <20230829234426.64421-1-tony.luck@intel.com> <20230928191350.205703-1-tony.luck@intel.com> <20230928191350.205703-8-tony.luck@intel.com> In-Reply-To: <20230928191350.205703-8-tony.luck@intel.com> From: Peter Newman Date: Fri, 29 Sep 2023 16:32:29 +0200 Message-ID: Subject: Re: [PATCH v6 7/8] x86/resctrl: Sub NUMA Cluster detection and enable To: Tony Luck Cc: Fenghua Yu , Reinette Chatre , Jonathan Corbet , Shuah Khan , x86@kernel.org, Shaopeng Tan , James Morse , Jamie Iles , Babu Moger , Randy Dunlap , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 29 Sep 2023 07:34:39 -0700 (PDT) Hi Tony, On Thu, Sep 28, 2023 at 9:14=E2=80=AFPM Tony Luck wro= te: > +static __init int snc_get_config(void) > +{ > + unsigned long *node_caches; > + int mem_only_nodes =3D 0; > + int cpu, node, ret; > + int num_l3_caches; > + > + if (!x86_match_cpu(snc_cpu_ids)) > + return 1; > + > + node_caches =3D bitmap_zalloc(nr_node_ids, GFP_KERNEL); > + if (!node_caches) > + return 1; > + > + cpus_read_lock(); > + for_each_node(node) { > + cpu =3D cpumask_first(cpumask_of_node(node)); > + if (cpu < nr_cpu_ids) > + set_bit(get_cpu_cacheinfo_id(cpu, 3), node_caches= ); > + else > + mem_only_nodes++; > + } > + cpus_read_unlock(); > + > + num_l3_caches =3D bitmap_weight(node_caches, nr_node_ids); > + if (!num_l3_caches) > + return 1; > + > + ret =3D (nr_node_ids - mem_only_nodes) / num_l3_caches; > + kfree(node_caches); It seems a little peculiar to free node_caches a couple of lines after you're actually done with it. > + > + if (ret > 1) > + rdt_resources_all[RDT_RESOURCE_L3].r_resctrl.mon_scope = =3D RESCTRL_NODE; > + > + return ret; > +} > + > static __init void rdt_init_res_defs_intel(void) > { > struct rdt_hw_resource *hw_res; > struct rdt_resource *r; > > + snc_nodes_per_l3_cache =3D snc_get_config(); > + > for_each_rdt_resource(r) { > hw_res =3D resctrl_to_arch_res(r); > > -- > 2.41.0 > Reviewed-by: Peter Newman