vfork: don't freezer_count() for in-kernel users of CLONE_VFORK
Subsystems (7)
PATCH 1/5 vfork: don't freezer_count() for in-kernel users of CLONE_VFORK
We don't need to call freezer_do_not_count() for in-kernel users of CLONE_VFORK since exec will get called in bounded time.
We don't want to call freezer_count() for in-kernel users because they may be holding locks. freezer_count() calls try_to_freeze(). We don't want to freeze an in-kernel user because it may be holding locks.
In a follow-up patch, I call debug_check_no_locks_held() from try_to_freeze(). After applying this patch, I get no lockdep warnings with that patch.
--- kernel/fork.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/fork.c +4 -2
@@ -722,9 +722,11 @@ static int wait_for_vfork_done(struct task_struct *child, {int killed; -freezer_do_not_count (); +if (current->mm) +freezer_do_not_count (); killed =wait_for_completion_killable (vfork); -freezer_count (); +if (current->mm) +freezer_count ();if (killed) {task_lock (child);
Signature · 1 line
1.8.1
PATCH 2/5 lockdep: check that no locks held at freeze time
We shouldn't try_to_freeze if locks are held. Verified that I get no lockdep warnings after applying this patch and "vfork: don't freezer_count() for in-kernel users of CLONE_VFORK".
--- include/linux/freezer.h | 2 ++ kernel/lockdep.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-)
include/linux/freezer.h +2 -0
@@ -3,6 +3,7 @@#ifndef FREEZER_H_INCLUDED #define FREEZER_H_INCLUDED +#include <linux/debug_locks.h> #include <linux/sched.h> #include <linux/wait.h> #include <linux/atomic.h>
@@ -43,6 +44,7 @@ extern void thaw_kernel_threads(void);static inline bool try_to_freeze (void ) { +debug_check_no_locks_held (current);might_sleep ();if (likely (!freezing (current)))return false;
kernel/lockdep.c +3 -3
@@ -4091,10 +4091,10 @@ static void print_held_locks_bug(struct task_struct *curr)return ;printk ("\n" ); -printk ("=====================================\n" ); -printk ("[ BUG: lock held at task exit time! ]\n" ); +printk ("=======================================\n" ); +printk ("[ BUG: lock held at exit/freeze time! ]\n" );print_kernel_ident (); -printk ("-------------------------------------\n" ); +printk ("---------------------------------------\n" );printk ("%s/%d is exiting with locks still held!\n" , curr->comm,task_pid_nr (curr));lockdep_print_held_locks (curr);
Signature · 1 line
1.8.1
Re: [PATCH 2/5] lockdep: check that no locks held at freeze time
kernel/lockdep.c static void print_held_locks_bug(struct task_struct *curr) · line 4095
Quoted 10 lines · Mandeep Singh Baines
kernel/lockdep.c +2
-2@@ -4091,10 +4091,10 @@ static void print_held_locks_bug(struct task_struct *curr)return ;printk ("\n" ); -printk ("=====================================\n" ); -printk ("[ BUG: lock held at task exit time! ]\n" ); +printk ("=======================================\n" ); +printk ("[ BUG: lock held at exit/freeze time! ]\n" );
Looks good, but to make it more apparent which case triggers, please pass in a 'msg' string that gets printed - and the msg is either "exit" or "freeze", depending on from where it's called.
Thanks,
Ingo
Re: [PATCH 2/5] lockdep: check that no locks held at freeze time
In reply to Mandeep Singh BainesQuoted 4 lines · Mandeep Singh Baines
We shouldn't
try_to_freezeif locks are held. Verified that I get no lockdep warnings after applying this patch and "vfork: don'tfreezer_count()for in-kernel users ofCLONE_VFORK".
Ah. Now I understand why you did 1/5. Beacuse you call debug_check_no_locks_held() right at the start of try_to_freeze(), even if the caller can't be frozen.
include/linux/freezer.h extern void thaw_kernel_threads(void); · line 50
Quoted 6 lines
static inline bool
try_to_freeze(void)
{include/linux/freezer.h +1
-0+debug_check_no_locks_held (current);might_sleep ();if (likely (!freezing (current)))return false;
Up to maintainers, but perhaps you should check !PF_NOFREEZE at least?
Oleg.
PATCH 3/5 coredump: cleanup the waiting for coredump_finish code
In reply to Mandeep Singh BainesReplace the for loop with a simple if.
--- kernel/exit.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
kernel/exit.c +2 -5
@@ -479,12 +479,9 @@ static void exit_mm(struct task_struct * tsk)if (atomic_dec_and_test (&core_state->nr_threads))complete (&core_state->startup); -for (;;) { -set_task_state (tsk,TASK_UNINTERRUPTIBLE ); -if (!self.task)/* see coredump_finish() */ -break ; +set_task_state (tsk,TASK_UNINTERRUPTIBLE ); +if (self.task)/* see coredump_finish() */ schedule (); - }__set_task_state (tsk,TASK_RUNNING );down_read (&mm->mmap_sem); }
Signature · 1 line
1.8.1
Re: [PATCH 3/5] coredump: cleanup the waiting for coredump_finish code
Quoted 2 lines · Mandeep Singh Baines
Replace the for loop with a simple if.
Why?
Quoted 4 lines
kernel/exit.c +0
-0@@ -479,12 +479,9 @@ static void exit_mm(struct task_struct * tsk)if (atomic_dec_and_test (&core_state->nr_threads))
kernel/exit.c static void exit_mm(struct task_struct * tsk) · line 487
Quoted 10 lines
kernel/exit.c +2
-5complete (&core_state->startup); -for (;;) { -set_task_state (tsk,TASK_UNINTERRUPTIBLE ); -if (!self.task)/* see coredump_finish() */ -break ; +set_task_state (tsk,TASK_UNINTERRUPTIBLE ); +if (self.task)/* see coredump_finish() */ schedule (); - }
If you think we should not worry about spurious wakeups you can simplify this code even more, you do not need mb() to set TASK_UNINTERRUPTIBLE (just move it before dec_and_test), you do not need "if (self.task)", you do not need __set_task_state(tsk, TASK_RUNNING).
But I think we should always worry, so why?
Oleg.
Andrew Morton
maintainerRe: [PATCH 3/5] coredump: cleanup the waiting for coredump_finish code
In reply to Mandeep Singh BainesQuoted 1 line · On Thu, 14 Feb 2013 15:38:14 -0800 Mandeep Singh Baines <[email protected]>…
Replace the for loop with a simple if.
Well OK, but why? Presumably the loop was added for a reason and presumably you believe that reason to be (no longer?) correct. Please describe all these things.
Quoted 14 lines
kernel/exit.c +2
-5@@ -479,12 +479,9 @@ static void exit_mm(struct task_struct * tsk)if (atomic_dec_and_test (&core_state->nr_threads))complete (&core_state->startup); -for (;;) { -set_task_state (tsk,TASK_UNINTERRUPTIBLE ); -if (!self.task)/* see coredump_finish() */ -break ; +set_task_state (tsk,TASK_UNINTERRUPTIBLE ); +if (self.task)/* see coredump_finish() */ schedule (); - }
PATCH 4/5 coredump: use a freezable_schedule for the coredump_finish wait
In reply to Mandeep Singh BainesPrevents hung_task detector from panicing the machine. This is also needed to prevent this wait from blocking suspend.
(It doesnt' currently block suspend but it would once the next patch in this series is applied.)
--- kernel/exit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/exit.c +2 -1
@@ -20,6 +20,7 @@#include <linux/tsacct_kern.h> #include <linux/file.h> #include <linux/fdtable.h> +#include <linux/freezer.h> #include <linux/binfmts.h> #include <linux/nsproxy.h> #include <linux/pid_namespace.h>
@@ -481,7 +482,7 @@ static void exit_mm(struct task_struct * tsk)set_task_state (tsk,TASK_UNINTERRUPTIBLE );if (self.task)/* see coredump_finish() */ -schedule (); +freezable_schedule ();__set_task_state (tsk,TASK_RUNNING );down_read (&mm->mmap_sem); }
Signature · 1 line
1.8.1
PATCH 5/5 coredump: abort core dump piping only due to a fatal signal
In reply to Mandeep Singh BainesFrom: Ben Chan <[email protected]>
This patch makes wait_for_dump_helpers() not to abort piping the core dump data when the crashing process has received any but a fatal signal (SIGKILL). The rationale is that a crashing process may still receive uninteresting signals such as SIGCHLD when its core dump data is being redirected to a helper application. While it's necessary to allow terminating the core dump piping via SIGKILL, it's practically more useful for the purpose of debugging and crash reporting if the core dump piping is not aborted due to other non-fatal signals.
--- fs/coredump.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/coredump.c +5 -1
@@ -32,6 +32,7 @@#include <linux/pipe_fs_i.h> #include <linux/oom.h> #include <linux/compat.h> +#include <linux/freezer.h> #include <asm/uaccess.h> #include <asm/mmu_context.h>
@@ -417,10 +418,13 @@ static void wait_for_dump_helpers(struct file *file) pipe->readers++; pipe->writers--; -while ((pipe->readers >1 ) && (!signal_pending (current))) { +while ((pipe->readers >1 ) && (!fatal_signal_pending (current))) {wake_up_interruptible_sync (&pipe->wait);kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN );pipe_wait (pipe); +pipe_unlock (pipe); +try_to_freeze (); +pipe_lock (pipe); } pipe->readers--;
Signature · 1 line
1.8.1
Re: [PATCH 5/5] coredump: abort core dump piping only due to a fatal signal
Quoted 6 lines · Mandeep Singh Baines
This patch makes
wait_for_dump_helpers()not to abort piping the core dump data when the crashing process has received any but a fatal signal (SIGKILL). The rationale is that a crashing process may still receive uninteresting signals such as SIGCHLD when its core dump data is being redirected to a helper application.
You already sent this change in the past ;) and I already reviewed it.
It is not enough and imho not good. Damn, I'll try very much to make the patches on weekend...
fs/coredump.c static void wait_for_dump_helpers(struct file *file) · line 421
Quoted 2 lines
fs/coredump.c +1
-1-while ((pipe->readers >1 ) && (!signal_pending (current))) { +while ((pipe->readers >1 ) && (!fatal_signal_pending (current))) {
This turns pipe_wait() belowe into the busy-wait loop if signal_pending(). Not good. And not enough, there are other reasons why coredump can fail if the signal is pending.
fs/coredump.c static void wait_for_dump_helpers(struct file *file) · line 426
Quoted 5 lines
fs/coredump.c +2
-0wake_up_interruptible_sync (&pipe->wait);kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN );pipe_wait (pipe); +pipe_unlock (pipe); +try_to_freeze ();
Oh, yes. One of the problems with coredump/signals is freezer. Not sure what should we do...
But if we add try_to_freeze() here, we need to add more try_to_freeze's, think about dumping the huge core on the slow media.
Oleg.
Re: [PATCH 5/5] coredump: abort core dump piping only due to a fatal signal
Quoted 10 lines · Oleg Nesterov
Quoted 6 lines · Mandeep Singh Baines
This patch makes
wait_for_dump_helpers()not to abort piping the core dump data when the crashing process has received any but a fatal signal (SIGKILL). The rationale is that a crashing process may still receive uninteresting signals such as SIGCHLD when its core dump data is being redirected to a helper application.You already sent this change in the past ;) and I already reviewed it.
Quoted 7 lines
It is not enough and imho not good. Damn, I'll try very much to make the patches on weekend...
fs/coredump.c static void wait_for_dump_helpers(struct file *file) · line 421
Quoted 2 lines
fs/coredump.c +1
-1-while ((pipe->readers >1 ) && (!signal_pending (current))) { +while ((pipe->readers >1 ) && (!fatal_signal_pending (current))) {This turns
pipe_wait()belowe into the busy-wait loop ifsignal_pending().
D'oh. Thanks for catching that.
Fixed in v3 by blocking non-fatal signals.
Quoted 2 lines
Not good. And not enough, there are other reasons why coredump can fail if the signal is pending.
What other reasons did you have in mind?
Since applying an earlier version of this patch, truncated/missing coredumps are no longer any issue for us.
Maybe it could fail in binfmt->core_dump().
Could the other reasons be addressed in another patch?
Quoted 7 lines
fs/coredump.c static void wait_for_dump_helpers(struct file *file) · line 426
Quoted 6 lines
wake_up_interruptible_sync(&pipe->wait); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); pipe_wait(pipe);fs/coredump.c +2
-0+pipe_unlock (pipe); +try_to_freeze ();
Quoted 6 lines
Oh, yes. One of the problems with coredump/signals is freezer. Not sure what should we do...
But if we add
try_to_freeze()here, we need to add more try_to_freeze's, think about dumping the huge core on the slow media.
We could add more try_to_freeze()s in the dump_write paths to work even better with freezer. Do you see any issues with just adding it here for a start. It fixes the non-slow media case.
Thanks much for reviewing this patch.
Regards,
Mandeep
Quoted 2 lines
Oleg.
Re: [PATCH 5/5] coredump: abort core dump piping only due to a fatal signal
Quoted 6 lines · Mandeep Singh Baines
Quoted 4 lines · Oleg Nesterov
It is not enough and imho not good. Damn, I'll try very much to make the patches on weekend...
Quoted 8 lines
Quoted 4 lines
fs/coredump.c static void wait_for_dump_helpers(struct file *file) · line 421
Quoted 2 lines
fs/coredump.c +1
-1-while ((pipe->readers >1 ) && (!signal_pending (current))) { +while ((pipe->readers >1 ) && (!fatal_signal_pending (current))) {This turns
pipe_wait()belowe into the busy-wait loop ifsignal_pending().D'oh. Thanks for catching that.
Fixed in v3 by blocking non-fatal signals.
Doesn't look correct...
Quoted 4 lines
Quoted 2 lines
Not good. And not enough, there are other reasons why coredump can fail if the signal is pending.
What other reasons did you have in mind?
Say, pipe_write() can fail if signal_pending() == T.
Quoted 2 lines
Since applying an earlier version of this patch, truncated/missing coredumps are no longer any issue for us.
Sure, this "almost works". But this is doesn't really work.
And more importantly, we should fix another problem, SIGKILL should really stop the coredumping, and I do not see a simple solution, the main problem is the races with the exiting threads...
Quoted 1 line
Could the other reasons be addressed in another patch?
Well. Personally I believe we should fix the problems with signals first, then add the freezer changes...
Quoted 9 lines
Quoted 9 lines
fs/coredump.c static void wait_for_dump_helpers(struct file *file) · line 426
Quoted 5 lines
wake_up_interruptible_sync(&pipe->wait); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); pipe_wait(pipe);fs/coredump.c +2
-0+pipe_unlock (pipe); +try_to_freeze ();Oh, yes. One of the problems with coredump/signals is freezer. Not sure what should we do...
Quoted 7 lines
Quoted 3 lines
But if we add
try_to_freeze()here, we need to add more try_to_freeze's, think about dumping the huge core on the slow media.We could add more try_to_freeze()s in the
dump_writepaths to work even better with freezer. Do you see any issues with just adding it here for a start. It fixes the non-slow media case.
The only issue is that, again, this change pretends to work but it doesn't ;) IOW, imho you fix the symptom only.
Lets forget about the slow media, consider the piped coredump (the case you are trying to fix). Suppose that try_to_freeze_tasks() is in progress, the user-space coredump handler is already frozen, and the dumping thread does pipe_write()->pipe_wait().
If only we could change pipe_wait() to do freezable_schedule()...
Oleg.
Andrew Morton
maintainerRe: [PATCH 5/5] coredump: abort core dump piping only due to a fatal signal
In reply to Mandeep Singh BainesQuoted 10 lines · On Thu, 14 Feb 2013 15:38:16 -0800 Mandeep Singh Baines <[email protected]>…
From: Ben Chan <[email protected]>
This patch makes
wait_for_dump_helpers()not to abort piping the core dump data when the crashing process has received any but a fatal signal (SIGKILL). The rationale is that a crashing process may still receive uninteresting signals such as SIGCHLD when its core dump data is being redirected to a helper application. While it's necessary to allow terminating the core dump piping via SIGKILL, it's practically more useful for the purpose of debugging and crash reporting if the core dump piping is not aborted due to other non-fatal signals.
Sounds sensible. The changelog is rather hard to understand. Is the below accurate?
: Make wait_for_dump_helpers() not abort piping the core dump data when the : crashing process has received a non-fatal signal. The abort still occurs : in the case of SIGKILL.
:
: The rationale is that a crashing process may still receive uninteresting : signals such as SIGCHLD when its core dump data is being redirected to a : helper application. While it's necessary to allow terminating the core : dump piping via SIGKILL, it's practically more useful for the purpose of : debugging and crash reporting if the core dump piping is not aborted due : to other non-fatal signals.
Quoted 13 lines
fs/coredump.c +1
-0@@ -32,6 +32,7 @@#include <linux/pipe_fs_i.h> #include <linux/oom.h> #include <linux/compat.h> +#include <linux/freezer.h> #include <asm/uaccess.h> #include <asm/mmu_context.h> @@ -417,10 +418,13 @@ static void wait_for_dump_helpers(struct file *file) pipe->readers++; pipe->writers--;
fs/coredump.c static void wait_for_dump_helpers(struct file *file) · line 428
Quoted 10 lines
fs/coredump.c +4
-1-while ((pipe->readers >1 ) && (!signal_pending (current))) { +while ((pipe->readers >1 ) && (!fatal_signal_pending (current))) {wake_up_interruptible_sync (&pipe->wait);kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN );pipe_wait (pipe); +pipe_unlock (pipe); +try_to_freeze (); +pipe_lock (pipe); }
The new call to try_to_freeze() is unchangelogged and uncommented. Can we please fix both these things?
PATCH v3 1/1 coredump: ignore non-fatal signals when core dumping to a pipe
In reply to Mandeep Singh BainesFrom: Ben Chan <[email protected]>
Make wait_for_dump_helpers() not abort piping the core dump data when the crashing process has received a non-fatal signal. The abort still occurs in the case of SIGKILL.
Addresses http://crosbug.com/21559
Changes since v1:
* Mandeep Singh Baines
* To prevent blocking suspend, add try_to_freeze().
Changes since v2:
* LKML: <[email protected]> Oleg Nestorov
* Block non-fatal signals to avoid poll_wait busy waiting.
* LKML: <[email protected]> Andrew Morton
* Added comment re: try_to_freeze and clarified commit message.
--- fs/coredump.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
fs/coredump.c +16 -0
@@ -32,6 +32,7 @@#include <linux/pipe_fs_i.h> #include <linux/oom.h> #include <linux/compat.h> +#include <linux/freezer.h> #include <asm/uaccess.h> #include <asm/mmu_context.h>
@@ -410,6 +411,11 @@ static void coredump_finish(struct mm_struct *mm)static void wait_for_dump_helpers (struct file *file) {struct pipe_inode_info *pipe; +sigset_t blocked, previous; + +/* Block all but fatal signals. */ +siginitsetinv (&blocked,sigmask (SIGKILL )); +sigprocmask (SIG_BLOCK , &blocked, &previous); pipe = file->f_path.dentry->d_inode->i_pipe;
@@ -421,12 +427,22 @@ static void wait_for_dump_helpers(struct file *file)wake_up_interruptible_sync (&pipe->wait);kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN );pipe_wait (pipe); + +/* +* Non-fatal signals are blocked. So we need to try +* to freeze in order to not block suspend. +*/ +pipe_unlock (pipe); +try_to_freeze (); +pipe_lock (pipe); } pipe->readers--; pipe->writers++;pipe_unlock (pipe); +/* Restore signals. */ +sigprocmask (SIG_SETMASK , &previous,NULL ); }/*
Signature · 1 line
1.7.12.4
PATCH v4 1/1 coredump: ignore non-fatal signals when core dumping to a pipe
From: Ben Chan <[email protected]>
Make wait_for_dump_helpers() not abort piping the core dump data when the crashing process has received a non-fatal signal. The abort still occurs in the case of SIGKILL.
Testing:
localhost ~ # echo "|/usr/bin/sleep 1d" > /proc/sys/kernel/core_pattern localhost ~ # sleep 1d &
[1] 2514
localhost ~ # kill -ABRT $! # Cause coredump
localhost ~ # kill -USR1 $! # Send non-fatal signal
localhost ~ # top -p $! -n1 -b # Verify that we aren't dead or busy waiting top - 16:45:34 up 2 min, 0 users, load average: 0.71, 0.42, 0.17
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie Cpu(s): 26.0%us, 8.5%sy, 0.0%ni, 65.1%id, 0.2%wa, 0.0%hi, 0.1%si, 0.0%st Mem: 991516k total, 418556k used, 572960k free, 5948k buffers Swap: 0k total, 0k used, 0k free, 289928k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2514 root 20 0 1868 392 336 S 0 0.0 0:00.00 sleep
localhost ~ # echo mem > /sys/power/state # Suspend
localhost ~ # top -p $! -n1 -b # Verify that we aren't dead or busy waiting top - 16:46:46 up 3 min, 0 users, load average: 1.68, 0.69, 0.28
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie Cpu(s): 24.1%us, 7.7%sy, 0.0%ni, 67.9%id, 0.2%wa, 0.0%hi, 0.1%si, 0.0%st Mem: 991516k total, 419956k used, 571560k free, 5996k buffers Swap: 0k total, 0k used, 0k free, 290208k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2514 root 20 0 1868 392 336 S 0 0.0 0:00.00 sleep
Addresses http://crosbug.com/21559
Changes since v1:
* Mandeep Singh Baines
* To prevent blocking suspend, add try_to_freeze().
Changes since v2:
* LKML: <[email protected]> Oleg Nestorov
* Block non-fatal signals to avoid poll_wait busy waiting.
* LKML: <[email protected]> Andrew Morton
* Added comment re: try_to_freeze and clarified commit message.
Changes since v3:
* Mandeep Singh Baines
* Clear signal pending caused by fake signal from freeze_task().
* Document how the patch was tested.
--- fs/coredump.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
fs/coredump.c +20 -1
@@ -32,6 +32,7 @@#include <linux/pipe_fs_i.h> #include <linux/oom.h> #include <linux/compat.h> +#include <linux/freezer.h> #include <asm/uaccess.h> #include <asm/mmu_context.h>
@@ -410,6 +411,11 @@ static void coredump_finish(struct mm_struct *mm)static void wait_for_dump_helpers (struct file *file) {struct pipe_inode_info *pipe; +sigset_t blocked, previous; + +/* Block all but fatal signals. */ +siginitsetinv (&blocked,sigmask (SIGKILL )); +sigprocmask (SIG_BLOCK , &blocked, &previous); pipe = file->f_path.dentry->d_inode->i_pipe;
@@ -417,16 +423,29 @@ static void wait_for_dump_helpers(struct file *file) pipe->readers++; pipe->writers--; -while ((pipe->readers >1 ) && (!signal_pending (current))) { +while ((pipe->readers >1 ) && (!fatal_signal_pending (current))) {wake_up_interruptible_sync (&pipe->wait);kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN );pipe_wait (pipe); + +/* +* Non-fatal signals are blocked. So we need to try +* to freeze in order to not block suspend. +*/ +pipe_unlock (pipe); +try_to_freeze (); +pipe_lock (pipe); + +/* Clear fake signal from freeze_task. */ +recalc_sigpending (); } pipe->readers--; pipe->writers++;pipe_unlock (pipe); +/* Restore signals. */ +sigprocmask (SIG_SETMASK , &previous,NULL ); }/*
Signature · 1 line
1.7.12.4
Quoted 3 lines · Mandeep Singh Baines
We don't need to call
freezer_do_not_count()for in-kernel users ofCLONE_VFORKsince exec will get called in bounded time.
OK,
Quoted 2 lines
We don't want to call
freezer_count()for in-kernel users because they may be holding locks.
Who? We should not do this anyway. And __call_usermodehelper() doesn't afaics.
OK, its caller (process_one_work) does lock_map_acquire() for debugging purposes, this can "confuse" print_held_locks_bug(). But this thread is PF_NOFREEZE ?
kernel/fork.c static int wait_for_vfork_done(struct task_struct *child, · line 726
Quoted 7 lines
kernel/fork.c +2
-1@@ -722,9 +722,11 @@ static int wait_for_vfork_done(struct task_struct *child, {int killed; -freezer_do_not_count (); +if (current->mm) +freezer_do_not_count ();
And if you want to exclude in-kernel users, then perhaps PF_KTHREAD check will look a bit better.
Oleg.