Page MenuHomeFreeBSD

Manage process-related IDs with bitmaps

Authored by mjg on Dec 5 2018, 3:28 PM.



Currently unique pid allocation on fork often requires a full walk of process, group, session lists to make sure it is not used by anything. This has a side effect of requiring proctree to be held along with allproc, which adds more contention in poudriere -j 128.

The patch below implements trivial bitmaps which gets rid of the problem. Dedicated lock is introduced to manage IDs.

While here a bug was discovered: all processes would inherit reap id from the first process spawned by init. This had a side effect of keeping the ID used and when allocation rolls over to the beginning it keeps being skipped.

Test Plan

Added the new scheme alongside the old one and modified do_fork to compare results from both. No mismatches during an entire poudriere run.

Diff Detail

Lint Skipped
Unit Tests Skipped
Build Status
Buildable 21366

Event Timeline

mjg created this revision.Dec 5 2018, 3:28 PM
kib accepted this revision.Dec 5 2018, 5:18 PM

I think this can be changed to avoid procid_lock at all.

This revision is now accepted and ready to land.Dec 5 2018, 5:18 PM
mjg closed this revision.Dec 19 2018, 9:29 PM

This already landed in r342237, I see I forgot to add the line.