All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -mm] call_usermodehelper: call info->init() after set_user_nice()
@ 2010-03-10 18:44 Oleg Nesterov
  2010-03-10 18:45 ` Oleg Nesterov
  2010-03-10 20:18 ` Neil Horman
  0 siblings, 2 replies; 3+ messages in thread
From: Oleg Nesterov @ 2010-03-10 18:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Neil Horman, linux-kernel

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;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -mm] call_usermodehelper: call info->init() after set_user_nice()
  2010-03-10 18:44 [PATCH -mm] call_usermodehelper: call info->init() after set_user_nice() Oleg Nesterov
@ 2010-03-10 18:45 ` Oleg Nesterov
  2010-03-10 20:18 ` Neil Horman
  1 sibling, 0 replies; 3+ messages in thread
From: Oleg Nesterov @ 2010-03-10 18:45 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Neil Horman, linux-kernel

On 03/10, Oleg Nesterov wrote:
>
> 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.

Forgot t mention...

This is on top of "umh && creds" patches I sent.

And this is the last change I was going to do ;)

Oleg.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -mm] call_usermodehelper: call info->init() after set_user_nice()
  2010-03-10 18:44 [PATCH -mm] call_usermodehelper: call info->init() after set_user_nice() Oleg Nesterov
  2010-03-10 18:45 ` Oleg Nesterov
@ 2010-03-10 20:18 ` Neil Horman
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Horman @ 2010-03-10 20:18 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, linux-kernel

On Wed, Mar 10, 2010 at 07:44:39PM +0100, Oleg Nesterov wrote:
> 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;
> 
> 
> 

Sure, why not. :)

Acked-by: Neil Horman <nhorman@tuxdriver.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-10 20:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-10 18:44 [PATCH -mm] call_usermodehelper: call info->init() after set_user_nice() Oleg Nesterov
2010-03-10 18:45 ` Oleg Nesterov
2010-03-10 20:18 ` Neil Horman

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.