Skip to contentSkip to conversation

ipc/msgstress03: Assume all forks will run concurently

PATCH In review Teo Couprie Diaz 3 participants 3 messages Apr 3, 2023 – Apr 13, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ipc/msgstress03: Assume all forks will run concurently

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.

---
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(-)
testcases/kernel/syscalls/ipc/msgstress/msgstress03.c +4 -3
index 3cb70ab18a80..aa37d9058b3e 100644
@@ -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());
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Teo Couprie Diaz
Quoted 9 lines · Teo Couprie Diaz

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.

Quoted 9 lines

---
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!!

Signature · 5 lines
Regards,
Li Wang

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