On Mon, 2006-01-23 at 17:27 +0900, MAEDA Naoaki wrote: > Hi Chandra, > > Chandra Seetharaman wrote: > > Hello All, > > > > I just uploaded f0.4 version of CKRM against 2.6.15 to the project > > website. It is the same as that f0.4 released against 2.6.14 on Dec 1st. > > > > from release notes: > > > > Download configfs patch from > > http://oss.oracle.com/projects/ocfs2/dist/files/patches/2.6.15- > > rc5/2005-12-14/01_configfs.patch > > --------------------- > > > > Please let me know if you see any problems. > Hi MAEDA,
> The f0.4 version of CKRM introduces a few microseconds overhead > on process fork and exit. It can be measured by running > "lat_proc fork" on both vanilla 2.6.15 and 2.6.15 configured with > f0.4 version ckrm. The overhead is about 3 microseconds in my laptop > and 8 microseconds in an ia64 server. The overhead is obviously > caused by ckrm_setclass() that hooks fork() and exit() path. > This is a lot of overhead. > Because these hooks are mandatory for CKRM, some overhead > must be introduced for these path. But problems are that > the overhead is not small enough to be neglected and is always > introduced even if a class is not defined. > > Originally, the setting class was done in the same process > context, but since f0.3 version, it has been done by the kernel events > daemon context using workqueue. Therefore, at least two context switch, > go to events daemon and return to the process, are needed now. I doubt > that design change is harmful to the performance. > > Could you explain why that design change was needed? ckrm_set_class() has to handle synchronous and asynchronous classification events. In order for it to be race free, we had a lock in class data structure, a lock in task data structure and a semaphore (to serialize all asynchronous classifications). It was complex. I changed it to workqueue based solution and got rid of the lock in task data structure and got rid of the asynchronous logic totally. -- Thinking now, i realize that fork() and exit() paths do not have to go through the workqueue as there is only one class involved in both the cases, we might as well get the class's lock and do all the needed operations right there in the ckrm_cb_[fork/exit]() functions. Try attached patch for functionality and please comment on the logic. Thanks & regards, chandra ============================================================================= fork() and exit() paths are critical, make the setting/clearing of class in the task data structure simple. Since only one task is involved in both these cases, there is no need to thru the workqueue option. ---------------------------------- kernel/ckrm/ckrm_tc.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) Index: linux-2.6.15/kernel/ckrm/ckrm_tc.c =================================================================== --- linux-2.6.15.orig/kernel/ckrm/ckrm_tc.c +++ linux-2.6.15/kernel/ckrm/ckrm_tc.c @@ -213,18 +213,26 @@ ckrm_taskfork(struct task_struct *tsk) pr_debug("fork: %p:%d:%s\n", tsk, tsk->pid, tsk->comm); - tsk->class = NULL; INIT_LIST_HEAD(&tsk->class_link); + spin_lock(&cls->class_lock); + tsk->class = cls; + list_add(&tsk->class_link, &cls->tasklist); + spin_unlock(&cls->class_lock); kref_get(&cls->refcnt); - ckrm_setclass(tsk, cls); } void ckrm_taskexit(struct task_struct *tsk) { + struct ckrm_class *cls; pr_debug("exit: %p:%d:%s\n", tsk, tsk->pid, tsk->comm); - ckrm_setclass(tsk, CKRM_NO_CLASS); + spin_lock(&tsk->class->class_lock); + cls = tsk->class; + tsk->class = CKRM_NO_CLASS; + list_del_init(&tsk->class_link); + spin_unlock(&cls->class_lock); + kref_put(&cls->refcnt, ckrm_release_class); } /* > > Thanks, > MAEDA Naoaki > > > > > > -- ---------------------------------------------------------------------- Chandra Seetharaman | Be careful what you choose.... - [EMAIL PROTECTED] | .......you may get it. ---------------------------------------------------------------------- ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ ckrm-tech mailing list https://lists.sourceforge.net/lists/listinfo/ckrm-tech