Skip to contentSkip to conversation

worker_thread: don't play with SIGCHLD

PATCH In review Oleg Nesterov 2 participants 4 messages Apr 13, 2007 Workqueue

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 worker_thread: don't play with SIGCHLD

depends on Eric's

kthread-dont-depend-on-work-queues-take-2.patch

worker_thread() inherits ignored SIGCHLD from its parent, kthreadd. We can remove unneeded do_sigaction().

kernel/workqueue.c renamed from kernel/workqueue.c~wt +0 -7
@@ -289,7 +289,6 @@ static int worker_thread(void *__cwq)
 {
 	struct cpu_workqueue_struct *cwq = __cwq;
 	DEFINE_WAIT(wait);
-	struct k_sigaction sa;
 
 	if (!cwq->wq->freezeable)
 		current->flags |= PF_NOFREEZE;
@@ -300,12 +299,6 @@ static int worker_thread(void *__cwq)
 	 */
 	numa_default_policy();
 
-	/* SIG_IGN makes children autoreap: see do_notify_parent(). */
-	sa.sa.sa_handler = SIG_IGN;
-	sa.sa.sa_flags = 0;
-	siginitset(&sa.sa.sa_mask, sigmask(SIGCHLD));
-	do_sigaction(SIGCHLD, &sa, (struct k_sigaction *)0);
-
 	for (;;) {
 		if (cwq->wq->freezeable)
 			try_to_freeze();
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Oleg Nesterov

depends on Eric's

kthread-dont-depend-on-work-queues-take-2.patch

worker_thread() inherits ignored SIGCHLD from its parent, kthreadd. We can remove unneeded do_sigaction().

Looks good.

We could delete all of:

Quoted 10 lines
	set_user_nice(current, -5);

	/* Block and flush all signals */
	sigfillset(&blocked);
	sigprocmask(SIG_BLOCK, &blocked, NULL);
	flush_signals(current);

	/*
	 * We inherited MPOL_INTERLEAVE from the booting kernel.
	 * Set MPOL_DEFAULT to insure node local allocations.
Quoted 8 lines
	 */
	numa_default_policy();

	/* SIG_IGN makes children autoreap: see do_notify_parent(). */
	sa.sa.sa_handler = SIG_IGN;
	sa.sa.sa_flags = 0;
	siginitset(&sa.sa.sa_mask, sigmask(SIGCHLD));
	do_sigaction(SIGCHLD, &sa, (struct k_sigaction *)0);

If we wanted to, as that all comes by default from kthreadd.

Eric

#2 lore raw
Quoted 7 lines · Eric W. Biederman
Quoted 4 lines · Oleg Nesterov

depends on Eric's

kthread-dont-depend-on-work-queues-take-2.patch

Quoted 15 lines
Quoted 2 lines

worker_thread() inherits ignored SIGCHLD from its parent, kthreadd. We can remove unneeded do_sigaction().

Looks good.

We could delete all of:

Quoted 6 lines
	set_user_nice(current, -5);

	/* Block and flush all signals */
	sigfillset(&blocked);
	sigprocmask(SIG_BLOCK, &blocked, NULL);
	flush_signals(current);

this one is already deleted in -mm...

Quoted 5 lines
Quoted 5 lines
	/*
	 * We inherited MPOL_INTERLEAVE from the booting kernel.
	 * Set MPOL_DEFAULT to insure node local allocations.
	 */
	numa_default_policy();

Yes, I forgot about this!

Quoted 1 line

If we wanted to, as that all comes by default from kthreadd.

Thanks, will send an update.

Oleg.

#3 lore raw

PATCH 1/1 worker_thread: don't play with SIGCHLD and numa policy

depends on Eric's

kthread-dont-depend-on-work-queues-take-2.patch

worker_thread() inherits ignored SIGCHLD and numa_default_policy() from its parent, kthreadd. No need to setup this again.

kernel/workqueue.c renamed from kernel/workqueue.c~wt +0 -13
@@ -289,23 +289,10 @@ static int worker_thread(void *__cwq)
 {
 	struct cpu_workqueue_struct *cwq = __cwq;
 	DEFINE_WAIT(wait);
-	struct k_sigaction sa;
 
 	if (!cwq->wq->freezeable)
 		current->flags |= PF_NOFREEZE;
 
-	/*
-	 * We inherited MPOL_INTERLEAVE from the booting kernel.
-	 * Set MPOL_DEFAULT to insure node local allocations.
-	 */
-	numa_default_policy();
-
-	/* SIG_IGN makes children autoreap: see do_notify_parent(). */
-	sa.sa.sa_handler = SIG_IGN;
-	sa.sa.sa_flags = 0;
-	siginitset(&sa.sa.sa_mask, sigmask(SIGCHLD));
-	do_sigaction(SIGCHLD, &sa, (struct k_sigaction *)0);
-
 	for (;;) {
 		if (cwq->wq->freezeable)
 			try_to_freeze();