kernel/cgroup/cpuset-v1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
When running LTP's cpuset_memory_pressure program, an error can be
reproduced by the following steps:
(1) Create a cgroup, enable cpuset subsystem, set memory limit, and
then set cpuset_memory_pressure to 1
(2) In this cgroup, create a process to allocate a large amount of
memory and generate pressure counts
(3) Set cpuset_memory_pressure to 0
(4) Check cpuset.memory_pressure: LTP thinks it should be 0, but the
kernel returns a value of 1, so LTP determines it as FAIL
This patch modifies fmeter_getrate() to determine whether to return 0
based on cpuset_memory_pressure_enabled.
Signed-off-by: Jin Guojie <guojie.jin@gmail.com>
Acked-by: Michal Koutný <mkoutny@suse.com>
Acked-by: Waiman Long <longman@redhat.com>
---
kernel/cgroup/cpuset-v1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c
index 25c1d7b77e2f..14564e91e2b3 100644
--- a/kernel/cgroup/cpuset-v1.c
+++ b/kernel/cgroup/cpuset-v1.c
@@ -108,7 +108,7 @@ static int fmeter_getrate(struct fmeter *fmp)
fmeter_update(fmp);
val = fmp->val;
spin_unlock(&fmp->lock);
- return val;
+ return cpuset_memory_pressure_enabled ? val : 0;
}
/*
--
2.34.1
On 2/17/25 8:03 PM, Jin Guojie wrote: > When running LTP's cpuset_memory_pressure program, an error can be > reproduced by the following steps: > > (1) Create a cgroup, enable cpuset subsystem, set memory limit, and > then set cpuset_memory_pressure to 1 > (2) In this cgroup, create a process to allocate a large amount of > memory and generate pressure counts > (3) Set cpuset_memory_pressure to 0 > (4) Check cpuset.memory_pressure: LTP thinks it should be 0, but the > kernel returns a value of 1, so LTP determines it as FAIL > > This patch modifies fmeter_getrate() to determine whether to return 0 > based on cpuset_memory_pressure_enabled. > > Signed-off-by: Jin Guojie <guojie.jin@gmail.com> > Acked-by: Michal Koutný <mkoutny@suse.com> > Acked-by: Waiman Long <longman@redhat.com> > --- > kernel/cgroup/cpuset-v1.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c > index 25c1d7b77e2f..14564e91e2b3 100644 > --- a/kernel/cgroup/cpuset-v1.c > +++ b/kernel/cgroup/cpuset-v1.c > @@ -108,7 +108,7 @@ static int fmeter_getrate(struct fmeter *fmp) > fmeter_update(fmp); > val = fmp->val; > spin_unlock(&fmp->lock); > - return val; > + return cpuset_memory_pressure_enabled ? val : 0; > } > > /* Acked-by: Waiman Long <longman@redhat.com>
© 2016 - 2025 Red Hat, Inc.