Message ID | 20230403155258.309714-1-teo.coupriediaz@arm.com |
---|---|
State | Accepted |
Headers | show |
Series | [v2] ipc/msgstress03: Assume all forks will run concurently | expand |
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
On Mon, Apr 3, 2023 at 11:53 PM Teo Couprie Diaz <teo.coupriediaz@arm.com> 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> > --- > v2: > - Slightly change the computation, kind of similar to what is done > in msgstress04, to make the warning make sense with the change. > - Added comment to clarify. > > Maybe the message could be rephrased entirely ? Something along the lines > of: "Maximum number of used processes higher than limit [...]" > Yes, I think so, at least it can be rewriten by new API. Considering it is a msg stressful test, choose a proper range/limit of pressure is quite important. Btw, I help merged this patch, thanks!!
diff --git a/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c b/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c index 3cb70ab18a80..aa37d9058b3e 100644 --- a/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c +++ b/testcases/kernel/syscalls/ipc/msgstress/msgstress03.c @@ -110,11 +110,12 @@ int main(int argc, char **argv) } free_pids = tst_get_free_pids(cleanup); - if (nprocs >= free_pids) { + /* Each forked child forks once, take it into account here. */ + if (nprocs * 2 >= free_pids) { tst_resm(TINFO, "Requested number of processes higher than limit (%d > %d), " - "setting to %d", nprocs, free_pids, free_pids); - nprocs = free_pids; + "setting to %d", nprocs * 2, free_pids, free_pids); + nprocs = free_pids / 2; } srand(getpid());
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> --- v2: - Slightly change the computation, kind of similar to what is done in msgstress04, to make the warning make sense with the change. - Added comment to clarify. Maybe the message could be rephrased entirely ? Something along the lines of: "Maximum number of used processes higher than limit [...]" CI build: https://github.com/Teo-CD/ltp/actions/runs/4598445898 testcases/kernel/syscalls/ipc/msgstress/msgstress03.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)