[LTP] [PATCH] shmget03: fix test when some shm segments already exist
xuyang2018.jy@fujitsu.com
xuyang2018.jy@fujitsu.com
Thu Jul 8 04:24:10 CEST 2021
Hi Li
How about using CLONE_NEWIPC to test this, so we can avoid this race
situation.
Best Regards
Yang Xu
> Hi Li
>> Hi Xu,
>>
>> xuyang2018.jy@fujitsu.com<mailto:xuyang2018.jy@fujitsu.com>
>> <xuyang2018.jy@fujitsu.com<mailto:xuyang2018.jy@fujitsu.com>> wrote:
>>
>> If we use this old format, then we can not ensure whether we trigger
>> the
>> ENOSPC errer correctly when reaching the expected nums.
>>
>> So to avoid the existed memory segments error, I think we should alter
>> get_used_queus api to count the existed memory segments by adding a
>> file argument.
>>
>>
>> Just as Alex pointed, if there are some resources be freedafter invoking
>> get_used_queus, then the value of existed_cntwill be imprecise, how do
>> you think that affects the test result?
>
> We can move this count api and the create phase into verify* function,
> but still exist the chance to free resource after invoking get_used_queues.
>
> We can't avoid it because /proc/sys/kernel/shmmni is designed for all
> user instead of the calling process.
>
> I think it is common in ltp because user also can set a different value
> after we use ltp api to set proc value.
>
> But if we only use for loop to trigger the ENOSPC error, it goes against
> the test's aim(see old shmget03.c, it also does the same thing as I do,
> it doesn't trigger error because it uses a big value than default 4096).
>
> Since this case only wastes a little time when run, I don't think we
> should avoid rare race to give up to test the ENOSPC error when reaching
> the expected num.
>
> Also, Let's listen advise from other maintainers.
> @Cyril,Petr
>
> Best Regards
> Yang Xu
>
>>
>>
>> --
>> Regards,
>> Li Wang
>
More information about the ltp
mailing list