login
Header Space

 
 

Re: [RFC/PATCH -v2] Add sysfs control to modify a user's cpu share

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Bill Davidsen <davidsen@...>
Cc: Heiko Carstens <heiko.carstens@...>, Ingo Molnar <mingo@...>, Dhaval Giani <dhaval@...>, Mike Galbraith <efault@...>, Peter Zijlstra <a.p.zijlstra@...>, Dmitry Adamushko <dmitry.adamushko@...>, lkml <linux-kernel@...>, <maneesh@...>, Andrew Morton <akpm@...>, Sudhir Kumar <skumar@...>
Date: Thursday, October 4, 2007 - 1:20 pm

On Thu, Oct 04, 2007 at 12:02:01PM -0400, Bill Davidsen wrote:

Although the need seems very real, I am thinking about the implementation 
aspect of this in the kernel i.e how will this be implementable?

1. The current patch proposes a sysfs based interface, where a new
   directory is created for every new user created who logs into the 
   system. To meet the requirement Ingo suggested, it would require the
   ability to create directories in sysfs in advance of (user_struct) objects 
   that aren't yet there - which is not possible to implement in sysfs
   afaik

2. configfs seems to allow creation of directories (i.e kernel objects) from 
   userland. Every new directory created should translate to a
   user_struct object being created in the kernel (and inserted in
   uid_hash table). Would this be acceptable?

Also, IMHO, CONFIG_FAIR_USER_SCHED is there only as a toy, to test fair group 
scheduling and I expect distros to support CONFIG_FAIR_CGROUP_SCHED instead 
which allows "control group" (or process containers) based fair group 
scheduling.

Using CONFIG_FAIR_CGROUP_SCHED it is still possible to provide user-id based 
fair group scheduling, in two ways:

	1. Have a daemon which listens for UID change events
	   (PROC_EVENT_UID) and move the task to appropriate "control
	   groups" and set the "control group" shares
	2. Implement a "user" subsystem registered with "cgroup" core,
  	   which automatically creates new "control groups" whenever
 	   a new user is being added to the system. This is very similar
	   to "ns" subsystem (kernel/ns_cgroup.c in -mm tree).
 	   Thus in order to provide fair user scheduling with this option,
	   distro needs to modify initrd to:

		# mkdir /dev/usercpucontrol
		# mount -t cgroup -ouser,cpu none /dev/usercpucontrol

Using a combination of these two options and a /etc configuration file
which specifies the cpu shares to be given to a user, it should be
possible for distro to give a good fair-user based scheduler.


We seem to be going by the real uid of a task (which is what tsk->user
points at) to decide its CPU bandwidth. Is that a cause of concern?

-- 
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, 12:37 pm)
[PATCH sched-devel] Generate uevents for user creation/destr..., Srivatsa Vaddagiri, (Tue Oct 9, 11:12 am)
Re: [RFC/PATCH -v2] Add sysfs control to modify a user's cpu..., Srivatsa Vaddagiri, (Fri Oct 5, 3:01 am)
Re: [RFC/PATCH -v2] Add sysfs control to modify a user's cpu..., Srivatsa Vaddagiri, (Thu Oct 4, 1:20 pm)
Re: [RFC/PATCH] Add sysfs control to modify a user's cpu share, Srivatsa Vaddagiri, (Wed Oct 3, 12:09 am)
Re: [RFC/PATCH] Add sysfs control to modify a user's cpu share, Srivatsa Vaddagiri, (Mon Oct 1, 11:32 am)
speck-geostationary