From: Jonathan Perry <yonch@yonch.com>
To: Tony Luck <tony.luck@intel.com>,
Reinette Chatre <reinette.chatre@intel.com>,
linux-kernel@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org,
Jonathan Corbet <corbet@lwn.net>,
James Morse <james.morse@arm.com>,
Roman Storozhenko <romeusmeister@gmail.com>,
Jonathan Perry <yonch@yonch.com>
Subject: [PATCH 3/8] resctrl/mon: Select cpumask before invoking mon_event_read()
Date: Thu, 16 Oct 2025 09:46:51 -0500 [thread overview]
Message-ID: <20251016144656.74928-4-yonch@yonch.com> (raw)
In-Reply-To: <20251016144656.74928-1-yonch@yonch.com>
Refactor rdtgroup_mondata_show() to pick the appropriate CPU mask
first and then call mon_event_read() once.
No functional change intended.
Signed-off-by: Jonathan Perry <yonch@yonch.com>
---
fs/resctrl/ctrlmondata.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
index 82f8ad2b3053..f28328c49479 100644
--- a/fs/resctrl/ctrlmondata.c
+++ b/fs/resctrl/ctrlmondata.c
@@ -607,6 +607,7 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
struct rdt_resource *r;
struct cacheinfo *ci;
struct mon_data *md;
+ cpumask_t *cpumask;
rdtgrp = rdtgroup_kn_lock_live(of->kn);
if (!rdtgrp) {
@@ -639,9 +640,9 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
if (!ci)
continue;
rmid_read_init(&rr, r, NULL, rdtgrp,
- evtid, false, ci);
- mon_event_read(&rr, &ci->shared_cpu_map);
- goto checkresult;
+ evtid, false, ci);
+ cpumask = &ci->shared_cpu_map;
+ goto perform;
}
}
ret = -ENOENT;
@@ -658,10 +659,11 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
}
d = container_of(hdr, struct rdt_mon_domain, hdr);
rmid_read_init(&rr, r, d, rdtgrp, evtid, false, NULL);
- mon_event_read(&rr, &d->hdr.cpu_mask);
+ cpumask = &d->hdr.cpu_mask;
}
-checkresult:
+perform:
+ mon_event_read(&rr, cpumask);
/*
* -ENOENT is a special case, set only when "mbm_event" counter assignment
next prev parent reply other threads:[~2025-10-16 14:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 14:46 [PATCH 0/8] resctrl: Add perf PMU for resctrl monitoring Jonathan Perry
2025-10-16 14:46 ` [PATCH 1/8] resctrl: Pin rdtgroup for mon_data file lifetime Jonathan Perry
2025-10-16 14:46 ` [PATCH 2/8] resctrl/mon: Split RMID read init from execution Jonathan Perry
2025-10-16 14:46 ` Jonathan Perry [this message]
2025-10-16 14:46 ` [PATCH 4/8] resctrl/mon: Create mon_event_setup_read() helper Jonathan Perry
2025-10-16 14:46 ` [PATCH 5/8] resctrl: Propagate CPU mask validation error via rr->err Jonathan Perry
2025-10-16 14:46 ` [PATCH 6/8] resctrl/pmu: Introduce skeleton PMU and selftests Jonathan Perry
2025-10-16 14:46 ` [PATCH 7/8] resctrl/pmu: Use mon_event_setup_read() and validate CPU Jonathan Perry
2025-10-16 14:46 ` [PATCH 8/8] resctrl/pmu: Implement .read via direct RMID read; add LLC selftest Jonathan Perry
2025-10-16 21:25 ` [PATCH 0/8] resctrl: Add perf PMU for resctrl monitoring Luck, Tony
2025-10-16 21:51 ` Luck, Tony
2025-10-17 18:17 ` Jonathan Perry
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=20251016144656.74928-4-yonch@yonch.com \
--to=yonch@yonch.com \
--cc=corbet@lwn.net \
--cc=james.morse@arm.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=romeusmeister@gmail.com \
--cc=tony.luck@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).