From: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH][V4] Add reboot_pid_ns to handle the reboot syscall
Date: Wed, 14 Dec 2011 20:17:39 +0100 [thread overview]
Message-ID: <20111214191739.GA14693@redhat.com> (raw)
In-Reply-To: <20111213162242.1ab3cb1a.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
On 12/13, Andrew Morton wrote:
>
> > --- a/kernel/sys.c
> > +++ b/kernel/sys.c
> > @@ -444,6 +444,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
> > magic2 != LINUX_REBOOT_MAGIC2C))
> > return -EINVAL;
> >
> > + if (task_active_pid_ns(current) != &init_pid_ns)
> > + return reboot_pid_ns(task_active_pid_ns(current), cmd);
> > +
> > /* Instead of trying to make the power_off code look like
> > * halt when pm_power_off is not set do it the easy way.
> > */
>
> I'll repeat my cruelly-ignored review comment for v3:
>
> This adds a bunch of useless code if CONFIG_PID_NS=n.
Agreed.
> It would be
> better to do
>
> #ifdef CONFIG_PID_NS
> extern void pidns_handle_reboot(int cmd);
> #else
> static inline void pidns_handle_reboot(int cmd)
> {
> }
> #endif
Can't resist.
Why the kernel always prefers to do it this way, adding the ugly
do-nothing inlines?
Isn't it better to simply call pidns_handle_reboot(cmd) under
CONFIG_PID_NS in sys_reboot() ?
#ifdef CONFIG_PID_NS
if (task_active_pid_ns(current) != &init_pid_ns)
return reboot_pid_ns(cmd);
#endif
This way, if you look at sys_reboot() you can immediately see what
happens, no need to inspect the !CONFIG_PID_NS definition. Plus this
doesn't add the "unnecesary" entry into tag file.
OK, </flame> ;)
Otherwise,
Reviewed-by: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
next prev parent reply other threads:[~2011-12-14 19:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-12 0:17 [PATCH 0/1][V4] Handle reboot in a child pid namespace Daniel Lezcano
[not found] ` <1323649064-7960-1-git-send-email-daniel.lezcano-GANU6spQydw@public.gmane.org>
2011-12-12 0:17 ` [PATCH][V4] Add reboot_pid_ns to handle the reboot syscall Daniel Lezcano
[not found] ` <1323649064-7960-2-git-send-email-daniel.lezcano-GANU6spQydw@public.gmane.org>
2011-12-12 23:14 ` Serge E. Hallyn
2011-12-14 0:22 ` Andrew Morton
[not found] ` <20111213162242.1ab3cb1a.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2011-12-14 19:17 ` Oleg Nesterov [this message]
[not found] ` <20111214191739.GA14693-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-12-15 22:00 ` Andrew Morton
2011-12-13 22:09 ` [PATCH 0/1][V4] Handle reboot in a child pid namespace Daniel Lezcano
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=20111214191739.GA14693@redhat.com \
--to=oleg-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox