Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

change thread_group_empty() to use task_struct->thread_node

Patch series "kill task_struct->thread_group".


This patch (of 2):

It could use list_is_singular() but this way it is cheaper. Plus the
thread_group_leader() check makes it clear that thread_group_empty() can
only return true if p is a group leader. This was not immediately obvious
before this patch.

task_struct->thread_group no longer has users, it can die.

Link: https://lkml.kernel.org/r/20230826111200.GA22982@redhat.com
Link: https://lkml.kernel.org/r/20230826111406.GA23238@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Oleg Nesterov and committed by
Andrew Morton
e34a35ee d639cf4a

+2 -1
+2 -1
include/linux/sched/signal.h
··· 733 733 734 734 static inline int thread_group_empty(struct task_struct *p) 735 735 { 736 - return list_empty(&p->thread_group); 736 + return thread_group_leader(p) && 737 + list_is_last(&p->thread_node, &p->signal->thread_head); 737 738 } 738 739 739 740 #define delay_group_leader(p) \