Skip to contentSkip to conversation

kobject: don't block for each kobject_uevent

PATCH In review Arjan van de Ven 2 participants 2 messages Mar 19, 2009 – Mar 20, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kobject: don't block for each kobject_uevent

Quoted 1 line

From d44701ae98a2c43a898dd7a7765d8894fd2e6caa Mon Sep 17 00:00:00 2001

From: Arjan van de Ven <[email protected]>
Date: Thu, 19 Mar 2009 09:02:17 -0700
Subject: [PATCH] kobject: don't block for each kobject_uevent

Right now, the kobject_uevent code blocks for each uevent that's being generated, due to using (for hystoric reasons) UHM_WAIT_EXEC as flag to call_usermode_helper(). Specifically, the effect is that each uevent that is being sent causes the code to wake up keventd, then block until keventd has processed the work. Needless to say, this happens many times during the system boot.

This patches changes that to UHN_NO_WAIT (brilliant name for a constant btw) so that we only schedule the work to fire the uevent message, but do not wait for keventd to process the work.

This removes one of the bottlenecks during boot; each one of them is only a small effect, but the sum of them does add up.

---
 lib/kobject_uevent.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
lib/kobject_uevent.c +1 -1
index 318328d..0b63523 100644
@@ -248,7 +248,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
 			goto exit;
 
 		retval = call_usermodehelper(argv[0], argv,
-					     env->envp, UMH_WAIT_EXEC);
+					     env->envp, UMH_NO_WAIT);
 	}
 
 exit:
Signature · 8 lines
1.6.0.6



-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#1 lore raw
Quoted 11 lines · Arjan van de Ven

From d44701ae98a2c43a898dd7a7765d8894fd2e6caa Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <[email protected]>
Date: Thu, 19 Mar 2009 09:02:17 -0700
Subject: [PATCH] kobject: don't block for each kobject_uevent

Right now, the kobject_uevent code blocks for each uevent that's being generated, due to using (for hystoric reasons) UHM_WAIT_EXEC as flag to call_usermode_helper(). Specifically, the effect is that each uevent that is being sent causes the code to wake up keventd, then block until keventd has processed the work. Needless to say, this happens many times during the system boot.

Quoted 6 lines

This patches changes that to UHN_NO_WAIT (brilliant name for a constant btw) so that we only schedule the work to fire the uevent message, but do not wait for keventd to process the work.

This removes one of the bottlenecks during boot; each one of them is only a small effect, but the sum of them does add up.

A faster/easier way to remove this issue is to just set the kernel helper application to "" in the kernel config. That's what sane distros do :)

Not to say this patch will not help things, just overall, it doesn't do much, as your kernel shouldn't even be taking this codepath on modern distros. If it is, I suggest filing a bug against that distro.

I'll queue it up.

thanks,

greg k-h