All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/mallinfo01: Disable free fastbin blocks
@ 2021-05-13  8:54 Yang Xu
  2021-05-13  9:05 ` Martin Doucha
  0 siblings, 1 reply; 4+ messages in thread
From: Yang Xu @ 2021-05-13  8:54 UTC (permalink / raw)
  To: ltp

When using malloc to allocate small space, it will use fastbin block firstly if
we have free fastbin free blocks, it is more quickly.
In here, we just test oldblks free chunks, it is the number of ordinary
(i.e. non-fastbin) free blocks. So use mallopt(M_MXFAST, 0) to disable
free fastbin block.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/mallinfo/mallinfo01.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/mallinfo/mallinfo01.c b/testcases/kernel/syscalls/mallinfo/mallinfo01.c
index 48fce0132..4e10e352e 100644
--- a/testcases/kernel/syscalls/mallinfo/mallinfo01.c
+++ b/testcases/kernel/syscalls/mallinfo/mallinfo01.c
@@ -64,6 +64,8 @@ static void setup(void)
 {
 	if (sizeof(info1.arena) != sizeof(int))
 		tst_res(TFAIL, "The member of mallinfo struct is not int");
+	if (mallopt(M_MXFAST, 0) == 0)
+		tst_res(TFAIL, "mallopt(M_MXFAST, 0) failed");
 
 	info1 = mallinfo();
 	print_mallinfo("Start", &info1);
-- 
2.23.0


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

* [LTP] [PATCH] syscalls/mallinfo01: Disable free fastbin blocks
  2021-05-13  8:54 [LTP] [PATCH] syscalls/mallinfo01: Disable free fastbin blocks Yang Xu
@ 2021-05-13  9:05 ` Martin Doucha
  2021-05-13 10:00   ` xuyang2018.jy
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Doucha @ 2021-05-13  9:05 UTC (permalink / raw)
  To: ltp

Hello,

On 13. 05. 21 10:54, Yang Xu wrote:
> When using malloc to allocate small space, it will use fastbin block firstly if
> we have free fastbin free blocks, it is more quickly.
> In here, we just test oldblks free chunks, it is the number of ordinary
> (i.e. non-fastbin) free blocks. So use mallopt(M_MXFAST, 0) to disable
> free fastbin block.
> 
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  testcases/kernel/syscalls/mallinfo/mallinfo01.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/testcases/kernel/syscalls/mallinfo/mallinfo01.c b/testcases/kernel/syscalls/mallinfo/mallinfo01.c
> index 48fce0132..4e10e352e 100644
> --- a/testcases/kernel/syscalls/mallinfo/mallinfo01.c
> +++ b/testcases/kernel/syscalls/mallinfo/mallinfo01.c
> @@ -64,6 +64,8 @@ static void setup(void)
>  {
>  	if (sizeof(info1.arena) != sizeof(int))
>  		tst_res(TFAIL, "The member of mallinfo struct is not int");
> +	if (mallopt(M_MXFAST, 0) == 0)
> +		tst_res(TFAIL, "mallopt(M_MXFAST, 0) failed");
>  
>  	info1 = mallinfo();
>  	print_mallinfo("Start", &info1);
> 

Sorry but this does not fix the problem. The failing subtest assumes that:
- malloc() will never increase ordblks
- free() will allways increase ordblks

mallinfo01 is failing because both of these assumptions are wrong.
Disabling fastbin block usage will not fix the failure.

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

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

* [LTP] [PATCH] syscalls/mallinfo01: Disable free fastbin blocks
  2021-05-13 10:00   ` xuyang2018.jy
@ 2021-05-13  9:47     ` Cyril Hrubis
  0 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2021-05-13  9:47 UTC (permalink / raw)
  To: ltp

Hi!
>   I don't have a proper fix. So you can remove it from runtest file.

I've pushed a patch that removes it from the runtest file, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

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

* [LTP] [PATCH] syscalls/mallinfo01: Disable free fastbin blocks
  2021-05-13  9:05 ` Martin Doucha
@ 2021-05-13 10:00   ` xuyang2018.jy
  2021-05-13  9:47     ` Cyril Hrubis
  0 siblings, 1 reply; 4+ messages in thread
From: xuyang2018.jy @ 2021-05-13 10:00 UTC (permalink / raw)
  To: ltp

Hi Martin
  I don't have a proper fix. So you can remove it from runtest file.

Best Regards
Yang Xu
> Hello,
>
> On 13. 05. 21 10:54, Yang Xu wrote:
>> When using malloc to allocate small space, it will use fastbin block firstly if
>> we have free fastbin free blocks, it is more quickly.
>> In here, we just test oldblks free chunks, it is the number of ordinary
>> (i.e. non-fastbin) free blocks. So use mallopt(M_MXFAST, 0) to disable
>> free fastbin block.
>>
>> Signed-off-by: Yang Xu<xuyang2018.jy@fujitsu.com>
>> ---
>>   testcases/kernel/syscalls/mallinfo/mallinfo01.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/testcases/kernel/syscalls/mallinfo/mallinfo01.c b/testcases/kernel/syscalls/mallinfo/mallinfo01.c
>> index 48fce0132..4e10e352e 100644
>> --- a/testcases/kernel/syscalls/mallinfo/mallinfo01.c
>> +++ b/testcases/kernel/syscalls/mallinfo/mallinfo01.c
>> @@ -64,6 +64,8 @@ static void setup(void)
>>   {
>>   	if (sizeof(info1.arena) != sizeof(int))
>>   		tst_res(TFAIL, "The member of mallinfo struct is not int");
>> +	if (mallopt(M_MXFAST, 0) == 0)
>> +		tst_res(TFAIL, "mallopt(M_MXFAST, 0) failed");
>>
>>   	info1 = mallinfo();
>>   	print_mallinfo("Start",&info1);
>>
>
> Sorry but this does not fix the problem. The failing subtest assumes that:
> - malloc() will never increase ordblks
> - free() will allways increase ordblks
>
> mallinfo01 is failing because both of these assumptions are wrong.
> Disabling fastbin block usage will not fix the failure.
>

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

end of thread, other threads:[~2021-05-13 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13  8:54 [LTP] [PATCH] syscalls/mallinfo01: Disable free fastbin blocks Yang Xu
2021-05-13  9:05 ` Martin Doucha
2021-05-13 10:00   ` xuyang2018.jy
2021-05-13  9:47     ` Cyril Hrubis

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.