Page MenuHomeFreeBSD

proc: always store parent pid in p_oppid
ClosedPublic

Authored by mjg on Nov 3 2018, 5:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 30, 1:30 PM
Unknown Object (File)
Mar 23 2024, 1:22 AM
Unknown Object (File)
Feb 27 2024, 4:43 PM
Unknown Object (File)
Feb 11 2024, 7:33 PM
Unknown Object (File)
Jan 7 2024, 11:55 AM
Unknown Object (File)
Dec 20 2023, 1:25 AM
Unknown Object (File)
Dec 15 2023, 6:55 AM
Unknown Object (File)
Dec 12 2023, 11:57 PM
Subscribers

Details

Summary

Doing so removes the dependency on proctree lock from sysctl process list export which further reduces contention during poudriere -j 128 runs.

While here adjust getppid.

Test Plan

kyua, poudriere

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

The patch seems to be generated on top of D17817 and is not applicable.

I do not like proc_reparent_ptrace() addition, just expand the signature of proc_reparent() with the new arg.

sys/kern/kern_exit.c
115 ↗(On Diff #49972)

Now that the condition is simplified, it can be written as

return (child->p_pptr->p_pid == child->p_oppid ? child->p_pptr : initproc);
sys/kern/kern_prot.c
127 ↗(On Diff #49972)

ppid is not needed. Just

return (p->p_oppid);

is enough.

sys/sys/proc.h
597 ↗(On Diff #49972)

The comment needs updating, it no longer has anything to do with ptrace.

  • address feedback
  • regen against head
  • i did not change the condition in proc_realparent as it goes way over the 80 char limit
sys/kern/kern_exit.c
111 ↗(On Diff #50071)

I think it really useful to add MPASS(child->p_oppid != 0) asserts at all places where old chode checked for p_oppid == 0.

117 ↗(On Diff #50071)

Can this list walk replaced by lookup by p_oppid ?

115 ↗(On Diff #49972)

The line would just wrap, I still think that saving three lines is good.

mjg marked 3 inline comments as done.Nov 13 2018, 7:23 PM
mjg added inline comments.
sys/kern/kern_exit.c
111 ↗(On Diff #50071)

we can't easily assert here. the original condition has ||. I don't think it adds much to the other place.

117 ↗(On Diff #50071)

it would require adding allproc here. (or the relevant hash lock after they get added later). i think this is a consideration unrelated to the patch.

115 ↗(On Diff #49972)

well i can put this if you insist:

+       if ((child->p_treeflag & P_TREE_ORPHANED) == 0)
+               return (child->p_pptr->p_pid == child->p_oppid ?
+                           child->p_pptr : initproc);

I'm temporarily on a very slow connection and can't upload the 300KB+ diff arc requires without timing out

sys/kern/kern_exit.c
111 ↗(On Diff #50071)

I do not understand why. It should be non-conditional case now.

115 ↗(On Diff #49972)

Assuming the continuation line uses +4 spaces, this looks fine.

This revision is now accepted and ready to land.Nov 16 2018, 2:03 PM
This revision was automatically updated to reflect the committed changes.