Re: [RFC][PATCH 0/2] Add is_user_thread() and is_kernel_thread() helper functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 25 Apr 2025 16:14:49 -0700
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> Seems sensible.  Please consider renaming PF_KTHREAD in order to break
> missed conversion sites.

It's not wrong to use the thread. I just find using these helper
functions a bit easier to review code. There's also some places that
have special tests where it can't use the flag:

kernel/sched/core.c:    if (!curr->mm || (curr->flags & (PF_EXITING | PF_KTHREAD)) ||
kernel/sched/fair.c:    if (!curr->mm || (curr->flags & (PF_EXITING | PF_KTHREAD)) || work->next != work)
kernel/trace/bpf_trace.c:                    current->flags & (PF_KTHREAD | PF_EXITING)))
kernel/trace/bpf_trace.c:       if (unlikely(task->flags & (PF_KTHREAD | PF_EXITING)))

Maybe we can have a: is_user_exiting_or_kthread() ?

Note, for coccinelle patches, I would wait till the end of the merge
window, run the scripts on what's in Linus's tree, run my tests, and
then submit. This way it catches most of the conversions with the least
amount of conflicts.

-- Steve




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux