* keventd gives exceptional priority to usermode helpers
@ 2005-01-10 10:28 Jan Engelhardt
2005-01-10 11:42 ` Chris Wright
0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2005-01-10 10:28 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 702 bytes --]
Hi,
on SUSE 9.2, we experienced that plugging in an USB stick slows the system
down considerably. In the end, I tracked (one half of the problem) down to
kernelspace, where keventd starts the /sbin/hotplug usermode helper with
priority -20. This is bad because hotplug, udev or the programs that ship with
the whole hotplug subsystem (possibly including SUSE's own scripts) require
some CPU -- and with nice -20 get it definitely.
keventd itself should stay at nice level -20, since it also spawns kreiserfsd,
just to name one. So the (attached) patch reprioritizes *user*mode
helpers/tasks back to nice 0.
Signed-off-by: Jan Engelhardt <jengelh@linux01.gwdg.de>
Jan Engelhardt
--
ENOSPC
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1269 bytes --]
#==============================================================================
# Linux 2.6-HX MODIFICATION
# Copyright (C) Jan Engelhardt <jengelh [at] linux01 gwdg de>, 2004
# -- License restrictions apply (GPL2)
# -- For details see doc/GPL2.txt.
# http://linux01.org:2222/prog-hxtools.php
#==============================================================================
# File: utf8fix.diff
# Class:
#
# - udev and friends need a fair amount of CPU, and really bring down the
# system when they run -- usually in nice -20
# Fix it in that usermode helpers always get nice 0 by default
#
#------------------------------------------------------------------------------
diff -dpu usr_A/src/kotd/linux-2.6.8-20041204030200/kernel/kmod.c usr_B/src/kotd/linux-2.6.8-20041204030200/kernel/kmod.c
--- usr_A/src/kotd/linux-2.6.8-20041204030200/kernel/kmod.c 2004-12-06 14:28:44.000000000 +0100
+++ usr_B/src/kotd/linux-2.6.8-20041204030200/kernel/kmod.c 2005-01-06 11:44:04.130600000 +0100
@@ -165,6 +165,7 @@ static int ____call_usermodehelper(void
/* We can run anywhere, unlike our parent keventd(). */
set_cpus_allowed(current, CPU_MASK_ALL);
+ set_user_nice(current, 0);
retval = -EPERM;
if (current->fs->root)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: keventd gives exceptional priority to usermode helpers
2005-01-10 10:28 keventd gives exceptional priority to usermode helpers Jan Engelhardt
@ 2005-01-10 11:42 ` Chris Wright
2005-01-10 11:50 ` Jan Engelhardt
0 siblings, 1 reply; 4+ messages in thread
From: Chris Wright @ 2005-01-10 11:42 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: linux-kernel
* Jan Engelhardt (jengelh@linux01.gwdg.de) wrote:
> --- usr_A/src/kotd/linux-2.6.8-20041204030200/kernel/kmod.c 2004-12-06 14:28:44.000000000 +0100
> +++ usr_B/src/kotd/linux-2.6.8-20041204030200/kernel/kmod.c 2005-01-06 11:44:04.130600000 +0100
> @@ -165,6 +165,7 @@ static int ____call_usermodehelper(void
>
> /* We can run anywhere, unlike our parent keventd(). */
> set_cpus_allowed(current, CPU_MASK_ALL);
> + set_user_nice(current, 0);
Seems reasonable. Although, I don't see a niceval of -20, but -5 on
keventd (workqueues do set_user_nice(-5)). Also, this patch is
whitespace damaged, should be tab not spaces.
thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: keventd gives exceptional priority to usermode helpers
2005-01-10 11:42 ` Chris Wright
@ 2005-01-10 11:50 ` Jan Engelhardt
2005-01-11 12:11 ` Jan Engelhardt
0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2005-01-10 11:50 UTC (permalink / raw)
To: Chris Wright; +Cc: linux-kernel
>> @@ -165,6 +165,7 @@ static int ____call_usermodehelper(void
>>
>> /* We can run anywhere, unlike our parent keventd(). */
>> set_cpus_allowed(current, CPU_MASK_ALL);
>> + set_user_nice(current, 0);
>
>Seems reasonable. Although, I don't see a niceval of -20, but -5 on
>keventd (workqueues do set_user_nice(-5)). Also, this patch is
Right, `ps` only shows "<" for <0, "" for 0 and "N" for >0. But -5 is still a
hard thing.
>whitespace damaged, should be tab not spaces.
the neverending debate...
Jan Engelhardt
--
ENOSPC
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: keventd gives exceptional priority to usermode helpers
2005-01-10 11:50 ` Jan Engelhardt
@ 2005-01-11 12:11 ` Jan Engelhardt
0 siblings, 0 replies; 4+ messages in thread
From: Jan Engelhardt @ 2005-01-11 12:11 UTC (permalink / raw)
To: Chris Wright; +Cc: linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 488 bytes --]
Signed-off-by: Jan Engelhardt <jengelh@linux01.gwdg.de>
--- linux-2.6.8-20041204030200/kernel/kmod.c 2004-12-06 14:28:44.000000000 +0100
+++ linux-2.6.8-20041204030200/kernel/kmod.c 2005-01-06 11:44:04.130600000 +0100
@@ -165,6 +165,7 @@ static int ____call_usermodehelper(void
/* We can run anywhere, unlike our parent keventd(). */
set_cpus_allowed(current, CPU_MASK_ALL);
+ set_user_nice(current, 0);
retval = -EPERM;
if (current->fs->root)
Jan Engelhardt
--
ENOSPC
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1198 bytes --]
#==============================================================================
# Linux 2.6-HX MODIFICATION
# Copyright (C) Jan Engelhardt <jengelh [at] linux01 gwdg de>, 2004
# -- License restrictions apply (GPL2)
# -- For details see doc/GPL2.txt.
# http://linux01.org:2222/prog-hxtools.php
#==============================================================================
#
# - udev and friends need a fair amount of CPU, and really bring down the
# system when they run -- usually in nice -5
# Fix it in that usermode helpers always get nice 0 by default
#
#------------------------------------------------------------------------------
diff -dpu usr_A/src/kotd/linux-2.6.8-20041204030200/kernel/kmod.c usr_B/src/kotd/linux-2.6.8-20041204030200/kernel/kmod.c
--- linux-2.6.8-20041204030200/kernel/kmod.c 2004-12-06 14:28:44.000000000 +0100
+++ linux-2.6.8-20041204030200/kernel/kmod.c 2005-01-06 11:44:04.130600000 +0100
@@ -165,6 +165,7 @@ static int ____call_usermodehelper(void
/* We can run anywhere, unlike our parent keventd(). */
set_cpus_allowed(current, CPU_MASK_ALL);
+ set_user_nice(current, 0);
retval = -EPERM;
if (current->fs->root)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-01-11 12:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-10 10:28 keventd gives exceptional priority to usermode helpers Jan Engelhardt
2005-01-10 11:42 ` Chris Wright
2005-01-10 11:50 ` Jan Engelhardt
2005-01-11 12:11 ` Jan Engelhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).