All of lore.kernel.org
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: qinyuntan <qinyuntan@linux.alibaba.com>, Tony Luck <tony.luck@intel.com>
Cc: "H . Peter Anvin" <hpa@zytor.com>, <linux-kernel@vger.kernel.org>,
	<x86@kernel.org>
Subject: Re: [PATCH] x86/resctrl: Remove unnecessary references to cacheinfo in the resctrl subsystem.
Date: Wed, 28 May 2025 10:38:20 -0700	[thread overview]
Message-ID: <60f5d0cc-afcf-4ca3-ba55-dc4298d95477@intel.com> (raw)
In-Reply-To: <37f6345f-7536-45a3-8c85-6b2bfdba2fe6@linux.alibaba.com>

Hi Qinyun Tan,

On 5/27/25 11:37 PM, qinyuntan wrote:
> On 5/28/25 12:49 PM, Reinette Chatre wrote:

...

>> One issue I can think of here is when there is a usage where the user does
>> task isolation on the numa node boundary. Let's consider the SNC-3 example
>> again with node3, node4, and node5 on the second socket, "L3 cache ID 1".
>> If all CPUs on node3 are in tick_nohz_full_mask while none of the node4 and
>> node5 CPUs are in tick_nohz_full_mask then one of node3's CPUs will get
>> an unnecessary IPI.
>>
> You are right, how about this? First, obtain any cpu in hdr.cpu_mask, and then use the cacheinfo shared_cpu_map of this cpu:
> 
> diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
> index 9337787461d2d..d43f438465ad0 100644
> --- a/fs/resctrl/ctrlmondata.c
> +++ b/fs/resctrl/ctrlmondata.c
> @@ -596,7 +596,8 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
>         struct rdtgroup *rdtgrp;
>         struct rdt_resource *r;
>         struct mon_data *md;
> -       int domid, ret = 0;
> +       struct cacheinfo *ci;
> +       int domid, cpu, ret = 0;
> 
>         rdtgrp = rdtgroup_kn_lock_live(of->kn);
>         if (!rdtgrp) {
> @@ -625,8 +626,12 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
>                 list_for_each_entry(d, &r->mon_domains, hdr.list) {
>                         if (d->ci_id == domid) {
>                                 rr.ci_id = d->ci_id;
> +                               cpu = cpumask_any(&d->hdr.cpu_mask)
> +                               ci = get_cpu_cacheinfo_level(cpu, RESCTRL_L3_CACHE);
> +                               if (!ci)
> +                                       continue;
>                                 mon_event_read(&rr, r, NULL, rdtgrp,
> -                                              &d->hdr.cpu_mask, evtid, false);
> +                                              &ci->shared_cpu_map, evtid, false);
>                                 goto checkresult;
>                         }
>                 }
> 

This looks good to me. Much better than what I was thinking about.

Apart from the items already mentioned I would like to add a couple of style comments:
- Please order variable declarations at beginning of function in reverse fir tree order.
  For example, above snippet would look like:

        struct rdtgroup *rdtgrp;
        int domid, cpu, ret = 0;
        struct rdt_resource *r;
        struct cacheinfo *ci;
        struct mon_data *md;

- Please align struct member names in tabular format (re. the struct rmid_read changes).
- Please ensure struct descriptions are aligned with the text surrounding it. (re.
  the struct rmid_read and struct rdt_mon_domain changes).

Thank you very much.

Reinette

      parent reply	other threads:[~2025-05-28 17:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-26  7:37 [PATCH] x86/resctrl: Remove unnecessary references to cacheinfo in the resctrl subsystem Qinyun Tan
2025-05-27 21:25 ` Luck, Tony
2025-05-28  2:30   ` qinyuntan
2025-05-27 23:36 ` Reinette Chatre
2025-05-28  0:14   ` Luck, Tony
2025-05-28  2:59     ` Reinette Chatre
2025-05-28  3:32   ` qinyuntan
2025-05-28  4:49     ` Reinette Chatre
2025-05-28  6:37       ` qinyuntan
2025-05-28  6:40         ` qinyuntan
2025-05-28 17:38         ` Reinette Chatre [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60f5d0cc-afcf-4ca3-ba55-dc4298d95477@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qinyuntan@linux.alibaba.com \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.