[PATCH sched-devel] Generate uevents for user creation/destruction

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Srivatsa Vaddagiri
Date: Tuesday, October 9, 2007 - 8:12 am

On Thu, Oct 04, 2007 at 10:54:51AM +0200, Heiko Carstens wrote:

Heiko,
	Thanks for the hint. Here's a patch to enable generation of
uevents for user creation/deletion. These uevents can be handled in
userspace to configure a new user's cpu share.

Note : After bootup I could test that new user's cpu share is configured
as per a configuration file (/etc/user_cpu_share.conf). However this
mechanism didnt work for root user. Perhaps uevent for root user is
generated way too early?

A HOWTO text file is also attached explaining how to make use of these
uevents in userspace.

Ingo,
	This patch applies on top of latest sched-devel tree. Pls review
and apply ..


---

Generate uevents when a user is being created/destroyed. These events
could be used to configure cpu share of a new user.

Signed-off-by : Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
Signed-off-by : Dhaval Giani <dhaval@linux.vnet.ibm.com>


---
 kernel/user.c |    4 ++++
 1 files changed, 4 insertions(+)

Index: current/kernel/user.c
===================================================================
--- current.orig/kernel/user.c
+++ current/kernel/user.c
@@ -174,6 +174,8 @@ static int user_kobject_create(struct us
 	if (error)
 		kobject_del(kobj);
 
+	kobject_uevent(kobj, KOBJ_ADD);
+
 done:
 	return error;
 }
@@ -189,6 +191,7 @@ int __init uids_kobject_init(void)
 
 	/* create under /sys/kernel dir */
 	uids_kobject.parent = &kernel_subsys.kobj;
+	uids_kobject.kset = &kernel_subsys;
 	kobject_set_name(&uids_kobject, "uids");
 	kobject_init(&uids_kobject);
 
@@ -228,6 +231,7 @@ static void remove_user_sysfs_dir(struct
 		goto done;
 
 	sysfs_remove_file(kobj, &up->user_attr.attr);
+	kobject_uevent(kobj, KOBJ_REMOVE);
 	kobject_del(kobj);
 
 	sched_destroy_user(up);



-- 
Regards,
vatsa
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [RFC/PATCH] Add sysfs control to modify a user's cpu share, Srivatsa Vaddagiri, (Mon Oct 1, 8:32 am)
Re: [RFC/PATCH] Add sysfs control to modify a user's cpu share, Srivatsa Vaddagiri, (Mon Oct 1, 9:37 am)
Re: [RFC/PATCH] Add sysfs control to modify a user's cpu share, Srivatsa Vaddagiri, (Tue Oct 2, 9:09 pm)
Re: [RFC/PATCH -v2] Add sysfs control to modify a user's c ..., Srivatsa Vaddagiri, (Thu Oct 4, 10:20 am)
Re: [RFC/PATCH -v2] Add sysfs control to modify a user's c ..., Srivatsa Vaddagiri, (Fri Oct 5, 12:01 am)
[PATCH sched-devel] Generate uevents for user creation/des ..., Srivatsa Vaddagiri, (Tue Oct 9, 8:12 am)