This sounds so mad it needs more context. You don't need to detect when a process is forked, it's an action issued from inside the process?
Also, what sort of raving lunatic had a busy loop checking the current process PID? Who allowed such a person access to a compiler? That seems like the bigger problem.
Somehow I doubt the code for getpid as a vdso would meaningfully impact the amount of memory used on a running system nor would I expect any meaningful impact to the number of page table entries. Do you have any supporting evidence for your claim otherwise?
Why aren't the pages shared like other dynamic libraries?
We could use the rseq area for PID and TID.
Having said that I agree that it's probably not worth it to put getpid() into vDSO.
If we're going to add all sorts of dross to the vdso, like getpid(), who knows what else will end up there?