What is the internal of suspending a Linux process?

Viewed 74

I am trying to test suspend a specific process in Linux-5.8.18.
I wrote modified kernel to export freeze_task() (and also removed basic checking from it) as follows,

spin_lock_irqsave(&freezer_lock, flags);

if (!(p->flags & PF_KTHREAD))
    fake_signal_wake_up(p);
else
    wake_up_state(p, TASK_INTERRUPTIBLE);

spin_unlock_irqrestore(&freezer_lock, flags);
return true;

Then I wrote another kernel module to call this simplified freeze_task to suspend a specific process.
But I tried many times, that process is still running even after freeze_task() is being called.
So what is the internal mechanism to suspend a process in Linux?

0 Answers
Related