All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Neil Horman <nhorman@tuxdriver.com>, linux-kernel@vger.kernel.org
Subject: [PATCH -mm] call_usermodehelper: call info->init() after set_user_nice()
Date: Wed, 10 Mar 2010 19:44:39 +0100	[thread overview]
Message-ID: <20100310184439.GA3386@redhat.com> (raw)

Mostly cosmetic, but imho it makes sense to call sub_info->init() right
before kernel_execve(). This looks more natural and allows ->init() hook
to change the priority if needed.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---

 kernel/kmod.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

--- mm/kernel/kmod.c~5_MOVE_INIT_DOWN	2010-03-10 17:36:37.000000000 +0100
+++ mm/kernel/kmod.c	2010-03-10 19:40:24.000000000 +0100
@@ -159,6 +159,11 @@ static int ____call_usermodehelper(void 
 
 	/* We can run anywhere, unlike our parent keventd(). */
 	set_cpus_allowed_ptr(current, cpu_all_mask);
+	/*
+	 * Our parent is keventd, which runs with elevated scheduling priority.
+	 * Avoid propagating that into the userspace child.
+	 */
+	set_user_nice(current, 0);
 
 	if (sub_info->init) {
 		retval = sub_info->init(sub_info);
@@ -166,14 +171,7 @@ static int ____call_usermodehelper(void 
 			goto fail;
 	}
 
-	/*
-	 * Our parent is keventd, which runs with elevated scheduling priority.
-	 * Avoid propagating that into the userspace child.
-	 */
-	set_user_nice(current, 0);
-
 	retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp);
-
 	/* Exec failed? */
 fail:
 	sub_info->retval = retval;


             reply	other threads:[~2010-03-10 18:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 18:44 Oleg Nesterov [this message]
2010-03-10 18:45 ` [PATCH -mm] call_usermodehelper: call info->init() after set_user_nice() Oleg Nesterov
2010-03-10 20:18 ` Neil Horman

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=20100310184439.GA3386@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /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 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.