summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-01 10:47:21 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-01 10:47:21 -0800
commitc00a8791646a226b77d24980ffad0c5e8e268b07 (patch)
tree68a0333e0c5fe15ee02375fc54b2571e71862538 /include
parente53ada651abea14481336091fbe2428ff05a8eee (diff)
parent76ed27608f7dd235b727ebbb12163438c2fbb617 (diff)
Merge tag 'perf-urgent-2026-02-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf events fix from Ingo Molnar: "Fix a race in the user-callchains code" * tag 'perf-urgent-2026-02-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf: sched: Fix perf crash with new is_user_task() helper
Diffstat (limited to 'include')
-rw-r--r--include/linux/sched.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index da0133524d08..5f00b5ed0f3b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1776,6 +1776,11 @@ static __always_inline bool is_percpu_thread(void)
(current->nr_cpus_allowed == 1);
}
+static __always_inline bool is_user_task(struct task_struct *task)
+{
+ return task->mm && !(task->flags & (PF_KTHREAD | PF_USER_WORKER));
+}
+
/* Per-process atomic flags. */
#define PFA_NO_NEW_PRIVS 0 /* May not gain new privileges. */
#define PFA_SPREAD_PAGE 1 /* Spread page cache over cpuset */