While min_bandwidth is exposed for each resource under
/sys/fs/resctrl, the maximum supported bandwidth is not currently shown.
Add max_bandwidth to report the maximum bandwidth permitted for a resource.
This helps users understand the limits of the associated resource control
group.
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
Documentation/filesystems/resctrl.rst | 6 +++++-
fs/resctrl/rdtgroup.c | 17 +++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
index 45dde8774128..94187dd3c244 100644
--- a/Documentation/filesystems/resctrl.rst
+++ b/Documentation/filesystems/resctrl.rst
@@ -224,7 +224,11 @@ Memory bandwidth(MB) subdirectory contains the following files
with respect to allocation:
"min_bandwidth":
- The minimum memory bandwidth percentage which
+ The minimum memory bandwidth percentage or units which
+ user can request.
+
+"max_bandwidth":
+ The maximum memory bandwidth percentage or units which
user can request.
"bandwidth_gran":
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index ae6c515f4c19..d2eab9007cc1 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -1153,6 +1153,16 @@ static int rdt_min_bw_show(struct kernfs_open_file *of,
return 0;
}
+static int rdt_max_bw_show(struct kernfs_open_file *of,
+ struct seq_file *seq, void *v)
+{
+ struct resctrl_schema *s = rdt_kn_parent_priv(of->kn);
+ struct rdt_resource *r = s->res;
+
+ seq_printf(seq, "%u\n", r->membw.max_bw);
+ return 0;
+}
+
static int rdt_num_rmids_show(struct kernfs_open_file *of,
struct seq_file *seq, void *v)
{
@@ -1959,6 +1969,13 @@ static struct rftype res_common_files[] = {
.seq_show = rdt_min_bw_show,
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
},
+ {
+ .name = "max_bandwidth",
+ .mode = 0444,
+ .kf_ops = &rdtgroup_kf_single_ops,
+ .seq_show = rdt_max_bw_show,
+ .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
+ },
{
.name = "bandwidth_gran",
.mode = 0444,
--
2.34.1