public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] cpuset_memory_spread: set lowerlimit according to pagesize
@ 2023-08-30  6:42 Hongchen Zhang
  2023-08-30  7:45 ` Richard Palethorpe
  0 siblings, 1 reply; 5+ messages in thread
From: Hongchen Zhang @ 2023-08-30  6:42 UTC (permalink / raw)
  To: Richard Palethorpe; +Cc: ltp, Hongchen Zhang

When I test the cpuset_memory_spread case,this case FAIL too often.
After dig into the code, I find out that the fowlloing things trigger
the FAIL:
1) random events,the probability is very small and can be ignored
2) get_meminfo which before send signal to test_pid
3) account_memsinfo before result_check

About 2) and 3), we can increase the value of lowerlimit to keep
the result as SUCCESS.

After discussing with Richard, we all agree to use the following
formula to calculate the lowerlimit:
lowerlimit(kb) = pagesize(byte) * 512 / 1024

Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
---
 .../cpuset_memory_spread_testset.sh                    | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
index e2767ef05..f7230a4ea 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
@@ -38,7 +38,15 @@ nr_mems=$N_NODES
 # on which it is running. The other nodes' slab space has littler change.(less
 # than 1000 kb).
 upperlimit=10000
-lowerlimit=2000
+
+# set lowerlimit according to pagesize
+# pagesize(bytes)  | lowerlimit(kb)
+# ------------------------------------
+#  4096            | 2048
+#  16384           | 8192
+
+PAGE_SIZE=`tst_getconf PAGESIZE`
+lowerlimit=$((PAGE_SIZE * 512 / 1024))
 
 cpus_all="$(seq -s, 0 $((nr_cpus-1)))"
 mems_all="$(seq -s, 0 $((nr_mems-1)))"

base-commit: 020f3985a5ca86c8bbece27eef8fb0315a10463e
-- 
2.33.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH v2] cpuset_memory_spread: set lowerlimit according to pagesize
  2023-08-30  6:42 [LTP] [PATCH v2] cpuset_memory_spread: set lowerlimit according to pagesize Hongchen Zhang
@ 2023-08-30  7:45 ` Richard Palethorpe
  2023-08-30 10:46   ` Hongchen Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Palethorpe @ 2023-08-30  7:45 UTC (permalink / raw)
  To: Hongchen Zhang; +Cc: ltp

Hello,

Hongchen Zhang <zhanghongchen@loongson.cn> writes:

> When I test the cpuset_memory_spread case,this case FAIL too often.
> After dig into the code, I find out that the fowlloing things trigger
> the FAIL:
> 1) random events,the probability is very small and can be ignored
> 2) get_meminfo which before send signal to test_pid
> 3) account_memsinfo before result_check
>
> About 2) and 3), we can increase the value of lowerlimit to keep
> the result as SUCCESS.
>
> After discussing with Richard, we all agree to use the following
> formula to calculate the lowerlimit:
> lowerlimit(kb) = pagesize(byte) * 512 / 1024
>
> Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
> ---
>  .../cpuset_memory_spread_testset.sh                    | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git
> a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
> b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
> index e2767ef05..f7230a4ea 100755
> --- a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
> +++ b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
> @@ -38,7 +38,15 @@ nr_mems=$N_NODES
>  # on which it is running. The other nodes' slab space has littler change.(less
>  # than 1000 kb).
>  upperlimit=10000
> -lowerlimit=2000
> +
> +# set lowerlimit according to pagesize
> +# pagesize(bytes)  | lowerlimit(kb)
> +# ------------------------------------
> +#  4096            | 2048
> +#  16384           | 8192
> +
> +PAGE_SIZE=`tst_getconf PAGESIZE`
> +lowerlimit=$((PAGE_SIZE * 512 / 1024))
>  
>  cpus_all="$(seq -s, 0 $((nr_cpus-1)))"
>  mems_all="$(seq -s, 0 $((nr_mems-1)))"
>
> base-commit: 020f3985a5ca86c8bbece27eef8fb0315a10463e

If we don't set the upperlimit what happens if we have 64Kb pages and
the lowerlimit > upperlimit?

-- 
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH v2] cpuset_memory_spread: set lowerlimit according to pagesize
  2023-08-30  7:45 ` Richard Palethorpe
@ 2023-08-30 10:46   ` Hongchen Zhang
  2023-08-31  8:27     ` Richard Palethorpe
  0 siblings, 1 reply; 5+ messages in thread
From: Hongchen Zhang @ 2023-08-30 10:46 UTC (permalink / raw)
  To: rpalethorpe; +Cc: ltp

Hi Richard,

On 2023/8/30 下午3:45, Richard Palethorpe wrote:
> Hello,
> 
> Hongchen Zhang <zhanghongchen@loongson.cn> writes:
> 
>> When I test the cpuset_memory_spread case,this case FAIL too often.
>> After dig into the code, I find out that the fowlloing things trigger
>> the FAIL:
>> 1) random events,the probability is very small and can be ignored
>> 2) get_meminfo which before send signal to test_pid
>> 3) account_memsinfo before result_check
>>
>> About 2) and 3), we can increase the value of lowerlimit to keep
>> the result as SUCCESS.
>>
>> After discussing with Richard, we all agree to use the following
>> formula to calculate the lowerlimit:
>> lowerlimit(kb) = pagesize(byte) * 512 / 1024
>>
>> Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
>> ---
>>   .../cpuset_memory_spread_testset.sh                    | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git
>> a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>> b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>> index e2767ef05..f7230a4ea 100755
>> --- a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>> +++ b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>> @@ -38,7 +38,15 @@ nr_mems=$N_NODES
>>   # on which it is running. The other nodes' slab space has littler change.(less
>>   # than 1000 kb).
>>   upperlimit=10000
>> -lowerlimit=2000
>> +
>> +# set lowerlimit according to pagesize
>> +# pagesize(bytes)  | lowerlimit(kb)
>> +# ------------------------------------
>> +#  4096            | 2048
>> +#  16384           | 8192
>> +
>> +PAGE_SIZE=`tst_getconf PAGESIZE`
>> +lowerlimit=$((PAGE_SIZE * 512 / 1024))
>>   
>>   cpus_all="$(seq -s, 0 $((nr_cpus-1)))"
>>   mems_all="$(seq -s, 0 $((nr_mems-1)))"
>>
>> base-commit: 020f3985a5ca86c8bbece27eef8fb0315a10463e
> 
> If we don't set the upperlimit what happens if we have 64Kb pages and
> the lowerlimit > upperlimit?

The lowerlimit is used to limit the max value on other nodes and the
upperlimit is used to limit the min value on the expected node.
So there is no problem if lowerlimit > upperlimit.
> 


-- 
Best Regards
Hongchen Zhang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH v2] cpuset_memory_spread: set lowerlimit according to pagesize
  2023-08-30 10:46   ` Hongchen Zhang
@ 2023-08-31  8:27     ` Richard Palethorpe
  2023-08-31  8:51       ` Hongchen Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Palethorpe @ 2023-08-31  8:27 UTC (permalink / raw)
  To: Hongchen Zhang; +Cc: ltp

Hello,

Hongchen Zhang <zhanghongchen@loongson.cn> writes:

> Hi Richard,
>
> On 2023/8/30 下午3:45, Richard Palethorpe wrote:
>> Hello,
>> Hongchen Zhang <zhanghongchen@loongson.cn> writes:
>> 
>>> When I test the cpuset_memory_spread case,this case FAIL too often.
>>> After dig into the code, I find out that the fowlloing things trigger
>>> the FAIL:
>>> 1) random events,the probability is very small and can be ignored
>>> 2) get_meminfo which before send signal to test_pid
>>> 3) account_memsinfo before result_check
>>>
>>> About 2) and 3), we can increase the value of lowerlimit to keep
>>> the result as SUCCESS.
>>>
>>> After discussing with Richard, we all agree to use the following
>>> formula to calculate the lowerlimit:
>>> lowerlimit(kb) = pagesize(byte) * 512 / 1024
>>>
>>> Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
>>> ---
>>>   .../cpuset_memory_spread_testset.sh                    | 10 +++++++++-
>>>   1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git
>>> a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>>> b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>>> index e2767ef05..f7230a4ea 100755
>>> --- a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>>> +++ b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>>> @@ -38,7 +38,15 @@ nr_mems=$N_NODES
>>>   # on which it is running. The other nodes' slab space has littler change.(less
>>>   # than 1000 kb).
>>>   upperlimit=10000
>>> -lowerlimit=2000
>>> +
>>> +# set lowerlimit according to pagesize
>>> +# pagesize(bytes)  | lowerlimit(kb)
>>> +# ------------------------------------
>>> +#  4096            | 2048
>>> +#  16384           | 8192
>>> +
>>> +PAGE_SIZE=`tst_getconf PAGESIZE`
>>> +lowerlimit=$((PAGE_SIZE * 512 / 1024))
>>>     cpus_all="$(seq -s, 0 $((nr_cpus-1)))"
>>>   mems_all="$(seq -s, 0 $((nr_mems-1)))"
>>>
>>> base-commit: 020f3985a5ca86c8bbece27eef8fb0315a10463e
>> If we don't set the upperlimit what happens if we have 64Kb pages
>> and
>> the lowerlimit > upperlimit?
>
> The lowerlimit is used to limit the max value on other nodes and the
> upperlimit is used to limit the min value on the expected node.
> So there is no problem if lowerlimit > upperlimit.
>> 

Won't this cause false negatives on systems with larger page sizes?

I have merged it however because right now the test is most likely just
a source of false positives.

-- 
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH v2] cpuset_memory_spread: set lowerlimit according to pagesize
  2023-08-31  8:27     ` Richard Palethorpe
@ 2023-08-31  8:51       ` Hongchen Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Hongchen Zhang @ 2023-08-31  8:51 UTC (permalink / raw)
  To: rpalethorpe; +Cc: ltp

On 2023/8/31 下午4:27, Richard Palethorpe wrote:
> Hello,
> 
> Hongchen Zhang <zhanghongchen@loongson.cn> writes:
> 
>> Hi Richard,
>>
>> On 2023/8/30 下午3:45, Richard Palethorpe wrote:
>>> Hello,
>>> Hongchen Zhang <zhanghongchen@loongson.cn> writes:
>>>
>>>> When I test the cpuset_memory_spread case,this case FAIL too often.
>>>> After dig into the code, I find out that the fowlloing things trigger
>>>> the FAIL:
>>>> 1) random events,the probability is very small and can be ignored
>>>> 2) get_meminfo which before send signal to test_pid
>>>> 3) account_memsinfo before result_check
>>>>
>>>> About 2) and 3), we can increase the value of lowerlimit to keep
>>>> the result as SUCCESS.
>>>>
>>>> After discussing with Richard, we all agree to use the following
>>>> formula to calculate the lowerlimit:
>>>> lowerlimit(kb) = pagesize(byte) * 512 / 1024
>>>>
>>>> Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
>>>> ---
>>>>    .../cpuset_memory_spread_testset.sh                    | 10 +++++++++-
>>>>    1 file changed, 9 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git
>>>> a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>>>> b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>>>> index e2767ef05..f7230a4ea 100755
>>>> --- a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>>>> +++ b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
>>>> @@ -38,7 +38,15 @@ nr_mems=$N_NODES
>>>>    # on which it is running. The other nodes' slab space has littler change.(less
>>>>    # than 1000 kb).
>>>>    upperlimit=10000
>>>> -lowerlimit=2000
>>>> +
>>>> +# set lowerlimit according to pagesize
>>>> +# pagesize(bytes)  | lowerlimit(kb)
>>>> +# ------------------------------------
>>>> +#  4096            | 2048
>>>> +#  16384           | 8192
>>>> +
>>>> +PAGE_SIZE=`tst_getconf PAGESIZE`
>>>> +lowerlimit=$((PAGE_SIZE * 512 / 1024))
>>>>      cpus_all="$(seq -s, 0 $((nr_cpus-1)))"
>>>>    mems_all="$(seq -s, 0 $((nr_mems-1)))"
>>>>
>>>> base-commit: 020f3985a5ca86c8bbece27eef8fb0315a10463e
>>> If we don't set the upperlimit what happens if we have 64Kb pages
>>> and
>>> the lowerlimit > upperlimit?
>>
>> The lowerlimit is used to limit the max value on other nodes and the
>> upperlimit is used to limit the min value on the expected node.
>> So there is no problem if lowerlimit > upperlimit.
>>>
> 
> Won't this cause false negatives on systems with larger page sizes?
Yes, no problem with larger page size.
> 
> I have merged it however because right now the test is most likely just
> a source of false positives.
OK,thanks.
If there are any problem, we can continue to discuss.
> 


-- 
Best Regards
Hongchen Zhang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-31  8:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-30  6:42 [LTP] [PATCH v2] cpuset_memory_spread: set lowerlimit according to pagesize Hongchen Zhang
2023-08-30  7:45 ` Richard Palethorpe
2023-08-30 10:46   ` Hongchen Zhang
2023-08-31  8:27     ` Richard Palethorpe
2023-08-31  8:51       ` Hongchen Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox