ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
* [LTP] [PATCH] ipc/msgstress03: Assume all forks will run concurently
@ 2023-03-23 16:04 Teo Couprie Diaz
  2023-03-28  3:50 ` Leo Liang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Teo Couprie Diaz @ 2023-03-23 16:04 UTC (permalink / raw)
  To: ltp; +Cc: Richard Palethorpe

It appears that msgstress03 doesn't account for all PIDs that its children
can use, as it expects the tasks will terminate quickly and not reach
the PID limit.
On some systems, this assumption can be invalid and the PID limit
will be hit.
Change the limit to account for all possible children at once, knowning
that each child will fork as well.

Signed-off-by: Teo Couprie Diaz <teo.coupriediaz@arm.com>
Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
---
This patch was already reviewed as part of a larger series[0]. The rest of
the series needs a large rework to be merged, but I felt this patch was a
simple and independnt enough to warrant a resend.
No changes were made.

CI Build: https://github.com/Teo-CD/ltp/actions/runs/4502197808

[0]: https://lists.linux.it/pipermail/ltp/2023-February/033007.html

 testcases/kernel/syscalls/ipc/msgstress/msgstress03.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
index 3cb70ab18..0c46927b8 100644
--- a/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
+++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
@@ -109,7 +109,7 @@ int main(int argc, char **argv)
 		}
 	}
 
-	free_pids = tst_get_free_pids(cleanup);
+	free_pids = tst_get_free_pids(cleanup) / 2;
 	if (nprocs >= free_pids) {
 		tst_resm(TINFO,
 			 "Requested number of processes higher than limit (%d > %d), "
-- 
2.25.1


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

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

* Re: [LTP] [PATCH] ipc/msgstress03: Assume all forks will run concurently
  2023-03-23 16:04 [LTP] [PATCH] ipc/msgstress03: Assume all forks will run concurently Teo Couprie Diaz
@ 2023-03-28  3:50 ` Leo Liang
  2023-03-28  7:44 ` Li Wang
  2023-03-30 11:32 ` Cyril Hrubis
  2 siblings, 0 replies; 5+ messages in thread
From: Leo Liang @ 2023-03-28  3:50 UTC (permalink / raw)
  To: Teo Couprie Diaz; +Cc: Richard Palethorpe, ltp

On Thu, Mar 23, 2023 at 04:04:42PM +0000, Teo Couprie Diaz wrote:
> It appears that msgstress03 doesn't account for all PIDs that its children
> can use, as it expects the tasks will terminate quickly and not reach
> the PID limit.
> On some systems, this assumption can be invalid and the PID limit
> will be hit.
> Change the limit to account for all possible children at once, knowning
> that each child will fork as well.
> 
> Signed-off-by: Teo Couprie Diaz <teo.coupriediaz@arm.com>
> Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
> ---
> This patch was already reviewed as part of a larger series[0]. The rest of
> the series needs a large rework to be merged, but I felt this patch was a
> simple and independnt enough to warrant a resend.
> No changes were made.
> 
> CI Build: https://github.com/Teo-CD/ltp/actions/runs/4502197808
> 
> [0]: https://lists.linux.it/pipermail/ltp/2023-February/033007.html
> 
>  testcases/kernel/syscalls/ipc/msgstress/msgstress03.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM!
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

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

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

* Re: [LTP] [PATCH] ipc/msgstress03: Assume all forks will run concurently
  2023-03-23 16:04 [LTP] [PATCH] ipc/msgstress03: Assume all forks will run concurently Teo Couprie Diaz
  2023-03-28  3:50 ` Leo Liang
@ 2023-03-28  7:44 ` Li Wang
  2023-03-30 11:32 ` Cyril Hrubis
  2 siblings, 0 replies; 5+ messages in thread
From: Li Wang @ 2023-03-28  7:44 UTC (permalink / raw)
  To: Teo Couprie Diaz; +Cc: Richard Palethorpe, ltp

Reviewed-by: Li Wang <liwang@redhat.com>


-- 
Regards,
Li Wang


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

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

* Re: [LTP] [PATCH] ipc/msgstress03: Assume all forks will run concurently
  2023-03-23 16:04 [LTP] [PATCH] ipc/msgstress03: Assume all forks will run concurently Teo Couprie Diaz
  2023-03-28  3:50 ` Leo Liang
  2023-03-28  7:44 ` Li Wang
@ 2023-03-30 11:32 ` Cyril Hrubis
  2023-04-03 15:52   ` Teo Couprie Diaz
  2 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2023-03-30 11:32 UTC (permalink / raw)
  To: Teo Couprie Diaz; +Cc: Richard Palethorpe, ltp

Hi!
> It appears that msgstress03 doesn't account for all PIDs that its children
> can use, as it expects the tasks will terminate quickly and not reach
> the PID limit.
> On some systems, this assumption can be invalid and the PID limit
> will be hit.
> Change the limit to account for all possible children at once, knowning
> that each child will fork as well.
> 
> Signed-off-by: Teo Couprie Diaz <teo.coupriediaz@arm.com>
> Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
> ---
> This patch was already reviewed as part of a larger series[0]. The rest of
> the series needs a large rework to be merged, but I felt this patch was a
> simple and independnt enough to warrant a resend.
> No changes were made.
> 
> CI Build: https://github.com/Teo-CD/ltp/actions/runs/4502197808
> 
> [0]: https://lists.linux.it/pipermail/ltp/2023-February/033007.html
> 
>  testcases/kernel/syscalls/ipc/msgstress/msgstress03.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
> index 3cb70ab18..0c46927b8 100644
> --- a/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
> +++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
> @@ -109,7 +109,7 @@ int main(int argc, char **argv)
>  		}
>  	}
>  
> -	free_pids = tst_get_free_pids(cleanup);
> +	free_pids = tst_get_free_pids(cleanup) / 2;
>  	if (nprocs >= free_pids) {
>  		tst_resm(TINFO,
>  			 "Requested number of processes higher than limit (%d > %d), "

The logic behind the change is good, however I wonder if this would
produce a bit confusing message in case that we are over limit and
setting the value to the current maximum. Can we at least multiply the
values printed in the TINFO message by 2 so that we get real limits
instead of halves?

Generally the nprocs is actually the number of message queues, which is
confusing itself, but that is probably left for a bigger cleanup of the
testcase...

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

* Re: [LTP] [PATCH] ipc/msgstress03: Assume all forks will run concurently
  2023-03-30 11:32 ` Cyril Hrubis
@ 2023-04-03 15:52   ` Teo Couprie Diaz
  0 siblings, 0 replies; 5+ messages in thread
From: Teo Couprie Diaz @ 2023-04-03 15:52 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,

Thanks for the review, sorry for the delay in responding.

On 30/03/2023 12:32, Cyril Hrubis wrote:
> Hi!
>> It appears that msgstress03 doesn't account for all PIDs that its children
>> can use, as it expects the tasks will terminate quickly and not reach
>> the PID limit.
>> On some systems, this assumption can be invalid and the PID limit
>> will be hit.
>> Change the limit to account for all possible children at once, knowning
>> that each child will fork as well.
>>
>> Signed-off-by: Teo Couprie Diaz <teo.coupriediaz@arm.com>
>> Reviewed-by: Richard Palethorpe <rpalethorpe@suse.com>
>> ---
>> This patch was already reviewed as part of a larger series[0]. The rest of
>> the series needs a large rework to be merged, but I felt this patch was a
>> simple and independnt enough to warrant a resend.
>> No changes were made.
>>
>> CI Build: https://github.com/Teo-CD/ltp/actions/runs/4502197808
>>
>> [0]: https://lists.linux.it/pipermail/ltp/2023-February/033007.html
>>
>>   testcases/kernel/syscalls/ipc/msgstress/msgstress03.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
>> index 3cb70ab18..0c46927b8 100644
>> --- a/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
>> +++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c
>> @@ -109,7 +109,7 @@ int main(int argc, char **argv)
>>   		}
>>   	}
>>   
>> -	free_pids = tst_get_free_pids(cleanup);
>> +	free_pids = tst_get_free_pids(cleanup) / 2;
>>   	if (nprocs >= free_pids) {
>>   		tst_resm(TINFO,
>>   			 "Requested number of processes higher than limit (%d > %d), "
> The logic behind the change is good, however I wonder if this would
> produce a bit confusing message in case that we are over limit and
> setting the value to the current maximum. Can we at least multiply the
> values printed in the TINFO message by 2 so that we get real limits
> instead of halves?
You're right, and without the patch it could be weird as well as the 
maximum could be hit and the warning not appear.
I will send a v2 that does something similar to msgstress04 where I 
don't change the free_pids itself.
>
> Generally the nprocs is actually the number of message queues, which is
> confusing itself, but that is probably left for a bigger cleanup of the
> testcase...
It seems that msgstress04 is a bit clearer on this point, as it has 
nr_msgqs on top of nprocs.
But I agree, if I had the time I would have been happy cleaning up the 
test more.
In the meantime I hope this fix can be useful for some.

Thanks again for the review,
Best regards
Téo-CD

> -- 
> Cyril Hrubis
> chrubis@suse.cz
>

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

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

end of thread, other threads:[~2023-04-03 15:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 16:04 [LTP] [PATCH] ipc/msgstress03: Assume all forks will run concurently Teo Couprie Diaz
2023-03-28  3:50 ` Leo Liang
2023-03-28  7:44 ` Li Wang
2023-03-30 11:32 ` Cyril Hrubis
2023-04-03 15:52   ` Teo Couprie Diaz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).