Skip to content

proc: task->signal can't be NULL

Oleg Nesterov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3proc: get_nr_threads() doesn't need ->siglock any longerfs/proc/array.c fs/proc/base.c include/linux/sched.h+7 -141 reply
2/3proc: make collect_sigign_sigcatch() rcu-safefs/proc/array.c+6 -12 replies
3/3proc: make task_sig() locklessfs/proc/array.c+10 -1610 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchDavid HowellsRoland McGrath
1/3A-b
2/3
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH -mm 0/3] proc: task->signal can't be NULL

With the recent changes in -mm it is always safe to dereference task->signal. It can't be NULL and it is pinned to task_struct.

fs/proc becomes the only valid user of signal->count which should either die or become "int nr_threads".

Alexey, Eric.

Can't we kill this counter? Afaics, get_nr_threads() doesn't need to be "precise", we probably can estimate the number of threads using signal->live (yes sure, we can't use ->live as nr_threads).

Except: first_tid() uses get_nr_threads() for optimization. Is this optimization really important? Afaics, it only helps in the unlikely case, probably in that case the extra lockless while_each_thread() doesn't hurt.

IOW, how about

	--- a/fs/proc/base.c
	+++ b/fs/proc/base.c
	@@ -3071,11 +3071,6 @@ static struct task_struct *first_tid(str
				goto found;
		}
	 
	-	/* If nr exceeds the number of threads there is nothing todo */
	-	pos = NULL;
	-	if (nr && nr >= get_nr_threads(leader))
	-		goto out;
	-
		/* If we haven't found our starting place yet start
		 * with the leader and walk nr threads forward.
		 */

?

Not that I think it is terribly important to kill this counter, and probably signal->nr_threads can make sense anyway, so far I am just curious.

Oleg.