Skip to contentSkip to conversation

restore scheduler priority for udev children

PATCH In review Marco d'Itri 2 participants 2 messages Jun 26, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 restore scheduler priority for udev children

udevd has a nice level of -4, which is inherited by spawned children. This patch restores the usual level of 0, to help mitigating the effects of broken processes which consume all the available CPU.

(I don't know the real cause, I'm still investingating it, but the patch looks like a good idea anyway.)

Signature · 2 lines
ciao,
Marco
udev_utils.c +2 -0
diff -ruNp udev-20050622.orig/udev_utils.c udev-20050622/udev_utils.c
@@ -401,6 +401,8 @@ int execute_command(const char *command,
 	switch (pid) {
 	case 0:
 		/* child */
+		if (setpriority(PRIO_PROCESS, 0, 0) < 0)
+			err("setpriority failed");
 		devnull = open("/dev/null", O_RDWR);
 		if (devnull >= 0) {
 			dup2(devnull, STDIN_FILENO);
#1 lore raw
Quoted 1 line · Marco d'Itri

udevd has a nice level of -4, which is inherited by spawned children.

No, the childrens get an explicit level.

Quoted 5 lines

This patch restores the usual level of 0, to help mitigating the effects of broken processes which consume all the available CPU.

(I don't know the real cause, I'm still investingating it, but the patch looks like a good idea anyway.)

Old versions of udevd+event scripts started from udevsend had all a inherited nice level of -5 and therefore this was added. Just set the values in udevd.h, if you think they should be different:
#define UDEVD_PRIORITY -4
#define UDEV_PRIORITY -2

Kay

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel