how to find thread that fork'd the current

From: Srinivas Murthy
Date: Fri Nov 01 2019 - 23:07:35 EST


>From the current thread (in kernel) is there a way to tell which
thread fork'd it?

systemd -> proc1 --fork--> thread2

thread2 detaches; thread2's parent set to systemd; thread2's tgid set
to its pid;

I see that the detached threads have their tgid set to its own pid and
its parent/real_parent set to the parent systemd

Is there a way to reliably tell the parent proc/thread (proc1) from
thread2's current (task_infostruct)?