Re: [PATCH] sched/core: Introduce task_*() helpers for PF_ flags

Steven Rostedt
2025-04-28T12:12:19Z

On Sat, 26 Apr 2025 20:42:21 +0200
Ingo Molnar <mingo@kernel.org> wrote:

> I'll send out a full series if there's no better suggestions for the
> general approach.

Fine, you can take over. I have other things to work on.

Unless you add a task_user() or something similar that makes it very easy
to see that a task is a user thread other than testing if it's not a kernel
thread, it doesn't solve the issue that was my original motivation for my
patches. That is, there's places in the code that needs to only work on
user threads, and it would be nice to quickly see that the if statement is
checking if it is or not.

We have places that check if it's a kernel thread to exit out early:

if (task_kernel(task))
goto out;

And places that do something if it's a user thread:

if (task_user(task))
// do something special

By explicitly stating "user" in the test, makes that very easy to see,
where as:

if (task_kernel(task))
goto out;

and

if (!task_kernel(task))
// do something special

makes you have to look a bit harder. The kernel is complex enough, I
believe we should make it easier where there's low hanging fruit to do so.

-- Steve