对于给定任务跳过 account_process_tick 是否安全?

Is it safe to skip account_process_tick for a given task?

我有一个 Linux Loadable Kernel Module 挂钩 account_process_tick 内核函数。

此函数检查 tsk 是否有 PF_INVISIBLE 标志,如果有,则 returns void 跳过帐户进程标记。如果 tsk 没有 PF_INVISIBLE 标志,那么我们 return 原始的 account_process_tick 内核函数。

/* This is our hook function for account_process_tick */
static asmlinkage void hook_account_process_tick(struct task_struct *tsk, int user)
{
    if (tsk->flags & PF_INVISIBLE) {
        return;
    }

    return orig_account_process_tick(tsk, user);
}

此代码的目标是从 top 等命令中抑制给定 tsk.

的全局 CPU 用法

一切正常。现在我很想知道这样做是否有任何警告。这会使我的系统更加不稳定甚至崩溃吗?如果我们查看 Linux 内核源代码,我们可以看到我的代码正在为这些 tsk 跳过 vtime_flush 函数。这有多安全? vtime_flush 做什么很重要,还是它只是计算会计时间然后刷新它?

我已经 运行 OP 中提到的代码一段时间了,到目前为止我没有遇到任何问题。所以我相信它可以安全使用。