From: Will Deacon <will@kernel.org> To: Peter Zijlstra <peterz@infradead.org> Cc: rjw@rjwysocki.net, oleg@redhat.com, mingo@kernel.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de, linux-kernel@vger.kernel.org, tj@kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH v3 2/6] freezer,umh: Clean up freezer/initrd interaction Date: Thu, 14 Oct 2021 10:13:05 +0100 [thread overview] Message-ID: <20211014091304.GB8135@willie-the-truck> (raw) In-Reply-To: <20211009101444.912374035@infradead.org> On Sat, Oct 09, 2021 at 12:07:56PM +0200, Peter Zijlstra wrote: > handle_initrd() marks itself as PF_FREEZER_SKIP in order to ensure > that the UMH, which is going to freeze the system, doesn't > indefinitely wait for it's caller. > > Rework things by adding UMH_FREEZABLE to indicate the completion is > freezable. > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> > --- > include/linux/umh.h | 9 +++++---- > init/do_mounts_initrd.c | 10 +--------- > kernel/umh.c | 8 ++++++++ > 3 files changed, 14 insertions(+), 13 deletions(-) This looks much better to me: Acked-by: Will Deacon <will@kernel.org> Just a question on the old code: > --- a/include/linux/umh.h > +++ b/include/linux/umh.h > @@ -11,10 +11,11 @@ > struct cred; > struct file; > > -#define UMH_NO_WAIT 0 /* don't wait at all */ > -#define UMH_WAIT_EXEC 1 /* wait for the exec, but not the process */ > -#define UMH_WAIT_PROC 2 /* wait for the process to complete */ > -#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ > +#define UMH_NO_WAIT 0x00 /* don't wait at all */ > +#define UMH_WAIT_EXEC 0x01 /* wait for the exec, but not the process */ > +#define UMH_WAIT_PROC 0x02 /* wait for the process to complete */ > +#define UMH_KILLABLE 0x04 /* wait for EXEC/PROC killable */ > +#define UMH_FREEZABLE 0x08 /* wait for EXEC/PROC freezable */ > > struct subprocess_info { > struct work_struct work; > --- a/init/do_mounts_initrd.c > +++ b/init/do_mounts_initrd.c > @@ -79,19 +79,11 @@ static void __init handle_initrd(void) > init_mkdir("/old", 0700); > init_chdir("/old"); > > - /* > - * In case that a resume from disk is carried out by linuxrc or one of > - * its children, we need to tell the freezer not to wait for us. > - */ > - current->flags |= PF_FREEZER_SKIP; > - > info = call_usermodehelper_setup("/linuxrc", argv, envp_init, > GFP_KERNEL, init_linuxrc, NULL, NULL); > if (!info) > return; > - call_usermodehelper_exec(info, UMH_WAIT_PROC); > - > - current->flags &= ~PF_FREEZER_SKIP; How was this supposed to work if it raced with the freezer checking the flag? Will
next prev parent reply other threads:[~2021-10-14 9:13 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-09 10:07 [PATCH v3 0/6] Freezer rewrite Peter Zijlstra 2021-10-09 10:07 ` [PATCH v3 1/6] freezer: Have {,un}lock_system_sleep() save/restore flags Peter Zijlstra 2021-10-14 8:58 ` Will Deacon 2021-10-09 10:07 ` [PATCH v3 2/6] freezer,umh: Clean up freezer/initrd interaction Peter Zijlstra 2021-10-14 9:13 ` Will Deacon [this message] 2021-10-09 10:07 ` [PATCH v3 3/6] ptrace: Order and comment PT_flags Peter Zijlstra 2021-10-14 9:31 ` Will Deacon 2021-10-14 14:27 ` Peter Zijlstra 2021-10-09 10:07 ` [PATCH v3 4/6] ptrace: Track __TASK_TRACED state in p->ptrace Peter Zijlstra 2021-10-09 10:07 ` [PATCH v3 5/6] sched,ptrace: Avoid relying on __TASK_TRACED | __TASK_STOPPED Peter Zijlstra 2021-10-09 10:08 ` [PATCH v3 6/6] freezer,sched: Rewrite core freezer logic Peter Zijlstra 2021-10-18 13:36 ` Peter Zijlstra
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211014091304.GB8135@willie-the-truck \ --to=will@kernel.org \ --cc=dietmar.eggemann@arm.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=mgorman@suse.de \ --cc=mingo@kernel.org \ --cc=oleg@redhat.com \ --cc=peterz@infradead.org \ --cc=rjw@rjwysocki.net \ --cc=rostedt@goodmis.org \ --cc=tj@kernel.org \ --cc=vincent.guittot@linaro.org \ --subject='Re: [PATCH v3 2/6] freezer,umh: Clean up freezer/initrd interaction' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.