If no client is using the process accounting shadow files, like the atop.service is masked, or atopacct.service restarts but atop.service not, which happens from time to time in production environments, there is no need to run pass2shadow() or even read new process accounting record(s) from pacct_source file.
Thus move semaphore checking more earlier to avoid the unnecessary read SYSCALL.
Reading and truncation of the source process accounting file is a permanent task for atopacctd, so this has to be done before leaving the function in the piece of code that you propose to move.
If no client is using the process accounting shadow files, like the atop.service is masked, or atopacct.service restarts but atop.service not, which happens from time to time in production environments, there is no need to run pass2shadow() or even read new process accounting record(s) from pacct_source file.
Thus move semaphore checking more earlier to avoid the unnecessary read SYSCALL.
Signed-off-by: Fei Li lifei.shirley@bytedance.com