Hi Chandra, I believe that simplifying CKRM is the right thing to do. At first glance, I have some questions and comments.
Chandra Seetharaman wrote: > This patch has the core infrastructure code. It includes support for > resource controllers, basic interface definitions and other framework to > support for task based resource management. > > Signed-Off-By: Chandra Seetharaman <[EMAIL PROTECTED]> > Signed-Off-By: Hubertus Franke <[EMAIL PROTECTED]> > Signed-Off-By: Shailabh Nagar <[EMAIL PROTECTED]> > Signed-Off-By: Gerrit Huizenga <[EMAIL PROTECTED]> > Signed-Off-By: Vivek Kashyap <[EMAIL PROTECTED]> > > include/linux/ckrm.h | 77 ++++++++ > include/linux/ckrm_rc.h | 82 +++++++++ > init/Kconfig | 15 + > kernel/Makefile | 1 > kernel/ckrm/Makefile | 5 > kernel/ckrm/ckrm.c | 411 ++++++++++++++++++++++++++++++++++++++++ > ++++++++ > kernel/ckrm/ckrmutils.c | 151 +++++++++++++++++ > 7 files changed, 742 insertions(+) > > Index: linux-2.6.13/include/linux/ckrm_rc.h > =================================================================== > --- /dev/null > +++ linux-2.6.13/include/linux/ckrm_rc.h > @@ -0,0 +1,82 @@ > +/* > + * ckrm_rc.h - Header file to be used by Resource controllers of CKRM > + * > + * Copyright (C) Hubertus Franke, IBM Corp. 2003 > + * (C) Shailabh Nagar, IBM Corp. 2003 > + * (C) Chandra Seetharaman, IBM Corp. 2003, 2004, 2005 > + * (C) Vivek Kashyap , IBM Corp. 2004 > + * > + * Provides data structures, macros and kernel API of CKRM for > + * resource controllers. > + * > + * More details at http://ckrm.sf.net > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + */ > + > +#ifndef _LINUX_CKRM_RC_H > +#define _LINUX_CKRM_RC_H > + > +#ifdef CONFIG_CKRM > + > +#include <linux/list.h> > +#include <linux/seq_file.h> > +#include <linux/ckrm.h> > + > +#define CKRM_NO_RES -1 /* No Resource */ > +#define CKRM_NO_CLASS ((struct ckrm_class *)-1)/* No class associated > */ > + > +/* > + * RESOURCE CONTROLLERS > + */ > +/* resource controller callback structure */ > +struct ckrm_res_ctlr { > + char res_name[CKRM_MAX_RES_NAME]; > + int res_hdepth; /* maximum hierarchy */ Nobody seems to care the res_hdepth member. Why? > + int resid; /* (for now) same as the enum resid */ > + > + /* allocate/free new resource class object for resource controller */ > + void *(*res_alloc) (struct ckrm_class *, struct ckrm_class *); > + void (*res_free) (void *); > + > + /* set/get limits/guarantees for a resource controller class */ > + int (*set_share_values) (void *, struct ckrm_shares *); > + int (*get_share_values) (void *, struct ckrm_shares *); > + > + /* statistics and configuration access */ > + int (*show_stats) (void *, struct seq_file *); > + int (*reset_stats) (void *, const char *); > + int (*show_config) (void *, struct seq_file *); > + int (*set_config) (void *, const char *); > + int (*show_attrib) (void *, struct seq_file *); > + int (*set_attrib) (void *, const char *); > + > + void (*change_resclass) (void *, void *, void *); > +}; > + > +/* > + * Interfaces provided by core to the resource controllers. > + */ > +#define ckrm_get_res_class(cls, resid, type) \ > + ((type*) (((resid != CKRM_NO_RES) && ((cls) != NULL) \ > + && ((cls) != CKRM_NO_CLASS)) ? (cls)->res_class[resid] : NULL)) > + > +extern int ckrm_register_res_ctlr(struct ckrm_res_ctlr *); > +extern int ckrm_unregister_res_ctlr(struct ckrm_res_ctlr *); > + > +extern void ckrm_lock_hier(struct ckrm_class *); > +extern void ckrm_unlock_hier(struct ckrm_class *); > +extern struct ckrm_class *ckrm_get_next_child(struct ckrm_class *, > + struct ckrm_class *); > + > +extern void child_guarantee_changed(struct ckrm_shares *, int, int); > +extern void child_maxlimit_changed(struct ckrm_shares *, int); > +extern int set_shares(struct ckrm_shares *, struct ckrm_shares *, > + struct ckrm_shares *); > + > +#endif /* CONFIG_CKRM */ > +#endif /* _LINUX_CKRM_RC_H */ > Index: linux-2.6.13/kernel/ckrm/ckrm.c > =================================================================== > --- /dev/null > +++ linux-2.6.13/kernel/ckrm/ckrm.c > @@ -0,0 +1,411 @@ > +/* ckrm.c - Class-based Kernel Resource Management (CKRM) > + * > + * Copyright (C) Hubertus Franke, IBM Corp. 2003, 2004 > + * (C) Shailabh Nagar, IBM Corp. 2003, 2004 > + * (C) Chandra Seetharaman, IBM Corp. 2003, 2004, 2005 > + * (C) Vivek Kashyap, IBM Corp. 2004 > + * > + * > + * Provides kernel API of CKRM for in-kernel,per-resource controllers > + * (one each for cpu, memory, io, network) and callbacks for > + * classification modules. > + * > + * Latest version, more details at http://ckrm.sf.net > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + */ > + > +#include <linux/config.h> > +#include <linux/init.h> > +#include <linux/linkage.h> > +#include <linux/kernel.h> > +#include <linux/errno.h> > +#include <linux/mm.h> > +#include <linux/string.h> > +#include <linux/list.h> > +#include <linux/spinlock.h> > +#include <linux/module.h> > +#include <linux/ckrm.h> > +#include <linux/ckrm_rc.h> > + > +#include <asm/uaccess.h> > +#include <asm/errno.h> > + > +int max_resid; /* max resid used */ > +atomic_t nr_resusers[CKRM_MAX_RES_CTLRS]; > +struct ckrm_res_ctlr *res_ctlrs[CKRM_MAX_RES_CTLRS]; Since these symbols, max_resid, nr_resusers and res_ctrlrs are globally exported in kernel, some prefix such as "ckrm_" should be added to these symbols to avoid future naming conflict. > +static long bit_res_ctlrs; /* bitmap of resource ID used */ > +static spinlock_t res_ctlrs_lock; /* protect res ctlr related data */ > + > +/* state about my classes */ > +struct ckrm_class ckrm_default_class = { > + .tasklist = LIST_HEAD_INIT(ckrm_default_class.tasklist), > + .class_lock = SPIN_LOCK_UNLOCKED, > + .name = CKRM_DEFAULT_CLASS_NAME, > + .dead = 0, > + .clslist = LIST_HEAD_INIT(ckrm_default_class.clslist), > + .siblings = LIST_HEAD_INIT(ckrm_default_class.siblings), > + .children = LIST_HEAD_INIT(ckrm_default_class.children), > +}; > +EXPORT_SYMBOL_GPL(ckrm_default_class); > + > +LIST_HEAD(classes);/* link all classes */ > +int num_classes; > +rwlock_t ckrm_class_lock = RW_LOCK_UNLOCKED; /* protects classlists */ These symbols, classes, num_classes and ckrm_class_lock should be declared as static, because only this file uses these symbols. > + > +/* > + * Helper Functions > + */ > +/* > + * Interfaces to manipulate class hierarchy > + * Must be Called with parent's class_lock held. > + */ > +static void > +ckrm_add_child(struct ckrm_class *parent, struct ckrm_class *child) > +{ > + if (!parent) > + return; > + > + INIT_LIST_HEAD(&child->children); > + INIT_LIST_HEAD(&child->siblings); > + > + list_add(&child->siblings, &parent->children); > + > + return; > +} > + > +/* Must be called with parent's class_lock held */ > +static int > +ckrm_remove_child(struct ckrm_class *child) > +{ > + /* ensure that the node does not have children */ > + if (!list_empty(&child->children)) > + return 0; > + > + list_del(&child->siblings); > + > + return 1; > +} > + > +void > +ckrm_lock_hier(struct ckrm_class *parent) > +{ > + spin_lock(&parent->class_lock); > +} > + > +void > +ckrm_unlock_hier(struct ckrm_class *parent) > +{ > + spin_unlock(&parent->class_lock); > +} > + > +/* > + * class_lock of the parent class must held. > + * external callers should 've called ckrm_lock_hier before calling > this > + * function. > + */ > +struct ckrm_class * > +ckrm_get_next_child(struct ckrm_class *parent, > + struct ckrm_class *child) > +{ > + struct list_head *cnode; > + > + if (list_empty(&parent->children)) > + return NULL; > + > + cnode = child ? child->siblings.next : parent->children.next; > + > + if (cnode == &parent->children) /* back at the anchor */ > + return NULL; > + > + return container_of(cnode, struct ckrm_class, siblings); > + > +} > + > +/* Must be called with parent's class_lock held */ > +static inline int > +ckrm_children_present(struct ckrm_class *parent) > +{ > + return !list_empty(&parent->children); > +} > + > +EXPORT_SYMBOL_GPL(ckrm_lock_hier); > +EXPORT_SYMBOL_GPL(ckrm_unlock_hier); > +EXPORT_SYMBOL_GPL(ckrm_get_next_child); > + > +static void > +ckrm_alloc_res_class(struct ckrm_class *cls, > + struct ckrm_class *parent, int resid) > +{ > + struct ckrm_res_ctlr *rcbs; > + BUG_ON(cls->res_class[resid]); > + > + /* > + * Allocate a resource class only if the resource controller has > + * registered with core and the engine requests for the class. > + */ > + if (!test_bit(resid, &bit_res_ctlrs)) > + return; > + > + atomic_inc(&nr_resusers[resid]); > + rcbs = res_ctlrs[resid]; > + > + if (rcbs && rcbs->res_alloc) { > + cls->res_class[resid] = (*rcbs->res_alloc) (cls, parent); > + if (cls->res_class[resid]) > + return; > + printk(KERN_ERR "Error creating %s resource class " > + "for class %s\n", > + res_ctlrs[resid]->res_name, cls->name); > + } > + atomic_dec(&nr_resusers[resid]); > +} > + > +struct ckrm_class * > +ckrm_alloc_class(struct ckrm_class *parent, const char *name) > +{ > + int i; > + struct ckrm_class *cls; > + > + if (!parent) > + return NULL; > + > + cls = kmalloc(sizeof(struct ckrm_class), GFP_KERNEL); > + if (!cls) > + return NULL; > + > + memset(cls, 0, sizeof(struct ckrm_class)); > + write_lock(&ckrm_class_lock); > + spin_lock(&parent->class_lock); > + if (parent->dead) { > + spin_unlock(&parent->class_lock); > + write_unlock(&ckrm_class_lock); > + kfree(cls); > + return NULL; > + } > + cls->parent = parent; > + cls->name = name; > + cls->class_lock = SPIN_LOCK_UNLOCKED; > + > + kref_init(&cls->refcnt); > + > + INIT_LIST_HEAD(&cls->tasklist); > + list_add_tail(&cls->clslist, &classes); > + > + num_classes++; > + ckrm_add_child(parent, cls); > + spin_unlock(&parent->class_lock); > + write_unlock(&ckrm_class_lock); > + > + for (i = 0; i < max_resid; i++) > + ckrm_alloc_res_class(cls, parent, i); > + > + if (parent) > + kref_get(&parent->refcnt); > + > + kref_get(&cls->refcnt); > + return cls; > +} > + > +static void > +ckrm_free_res_class(struct ckrm_class *cls, int resid) > +{ > + struct ckrm_res_ctlr *rcbs; > + > + /* > + * Free a resource class only if the resource controller has > + * registered with core > + */ > + if (cls->res_class[resid] == NULL) > + return; > + > + atomic_inc(&nr_resusers[resid]); I do not understand why nr_resusers[resid] is incremented here. Is it intentional? > + rcbs = res_ctlrs[resid]; > + > + if (rcbs->res_free) { > + (*rcbs->res_free) (cls->res_class[resid]); > + /* compensate inc in alloc */ > + atomic_dec(&nr_resusers[resid]); > + } > + atomic_dec(&nr_resusers[resid]); > + cls->res_class[resid] = NULL; > +} > + > +/* > + * Release a core class > + * requires that all tasks were previously reassigned to another > class > + * > + * Returns 0 on success -errno on failure. > + */ > +void > +ckrm_release_class(struct kref *kref) > +{ > + int i; > + struct ckrm_class *cls = container_of(kref, > + struct ckrm_class, refcnt); > + struct ckrm_class *parent = cls->parent; > + > + pr_debug("core class=%p:%s parent=%p:%s\n", cls, cls->name, parent, > + parent ? parent->name : "NULL"); > + > + if (cls == &ckrm_default_class) > + return; > + > + BUG_ON(parent == NULL); > + write_lock(&ckrm_class_lock); > + spin_lock(&parent->class_lock); > + if (ckrm_remove_child(cls) == 0) > + printk("Core class removal failed. Chilren present\n"); > + spin_unlock(&parent->class_lock); > + > + for (i = 0; i < max_resid; i++) > + ckrm_free_res_class(cls, i); > + > + > + /* Remove this core class from its linked list. */ > + list_del(&cls->clslist); > + num_classes--; > + write_unlock(&ckrm_class_lock); > + > + kref_put(&parent->refcnt, ckrm_release_class); > + > + kfree(cls); > +} > +EXPORT_SYMBOL_GPL(ckrm_release_class); > + > +int > +ckrm_free_class(struct ckrm_class *cls) > +{ > + if (cls == &ckrm_default_class) > + return 0; > + spin_lock(&cls->class_lock); > + if (ckrm_children_present(cls)) { > + spin_unlock(&cls->class_lock); > + return -EBUSY; > + } > + cls->dead = 1; > + spin_unlock(&cls->class_lock); > + kref_put(&cls->refcnt, ckrm_release_class); > + return 0; > +} > + > +/* > + * Interfaces for the resource controller > + */ > +/* > + * Registering a callback structure by the resource controller. > + * > + * Returns the resource id(0 or +ve) on success, -errno for failure. > + */ > +static int > +ckrm_register_res_ctlr_intern(struct ckrm_res_ctlr * rcbs) > +{ > + int resid, ret; > + > + if (!rcbs) > + return -EINVAL; > + > + resid = rcbs->resid; > + ret = -ENOMEM; > + > + spin_lock(&res_ctlrs_lock); > + if (resid < 0) > + for (resid = 0; resid < CKRM_MAX_RES_CTLRS; resid++) > + if (res_ctlrs[resid] == NULL) > + break; > + > + if (resid < CKRM_MAX_RES_CTLRS) { > + if (res_ctlrs[resid] == NULL) { > + res_ctlrs[resid] = rcbs; > + atomic_set(&nr_resusers[resid], 0); > + set_bit(resid, &bit_res_ctlrs); > + ret = resid; > + if (resid >= max_resid) > + max_resid = resid + 1; > + pr_debug("Registered resource: resid:%d name:%s\n", > + resid, res_ctlrs[resid]->res_name); > + } else > + ret = -EBUSY; > + } > + spin_unlock(&res_ctlrs_lock); > + return (-ENOMEM); Shouldn't be "return ret;" ? Otherwise calling this function is never success. > +} > + > +static void > +add_resctrl(struct ckrm_class *cls, int resid) > +{ > +} > + > +int > +ckrm_register_res_ctlr(struct ckrm_res_ctlr *rcbs) > +{ > + struct ckrm_class *cls; > + int resid; > + > + resid = ckrm_register_res_ctlr_intern(rcbs); > + > + if (resid >= 0) { > + /* run through all classes and create the resource class > + * object and if necessary "initialize" class in context > + * of this resource > + */ > + read_lock(&ckrm_class_lock); > + list_for_each_entry(cls, &classes, clslist) { > + printk(KERN_NOTICE "CKRM .. create resource object " > + "for resource <%s> class <%s:%p> parent " > + "<%s:%p>\n", rcbs->res_name, > + cls->name, cls, cls->parent->name, > + cls->parent); > + ckrm_alloc_res_class(cls, cls->parent, resid); > + > + add_resctrl(cls, resid); > + } > + read_unlock(&ckrm_class_lock); > + } > + return resid; > +} > + > +/* > + * Unregistering a callback structure by the resource controller. > + * > + * Returns 0 on success -errno for failure. > + */ > +int > +ckrm_unregister_res_ctlr(struct ckrm_res_ctlr *rcbs) > +{ > + struct ckrm_class *cls = NULL; > + int resid = rcbs->resid; > + > + if (resid < 0) > + return -EINVAL; > + > + read_lock(&ckrm_class_lock); > + > + /* free up this resource from all the classes */ > + list_for_each_entry(cls, &classes, clslist) > + ckrm_free_res_class(cls, resid); > + > + read_unlock(&ckrm_class_lock); > + > + if (atomic_read(&nr_resusers[resid])) > + return -EBUSY; > + > + spin_lock(&res_ctlrs_lock); > + res_ctlrs[resid] = NULL; > + clear_bit(resid, &bit_res_ctlrs); > + max_resid = fls(bit_res_ctlrs); > + rcbs->resid = CKRM_NO_RES; > + spin_unlock(&res_ctlrs_lock); > + return 0; > +} > + > +EXPORT_SYMBOL_GPL(ckrm_register_res_ctlr); > +EXPORT_SYMBOL_GPL(ckrm_unregister_res_ctlr); > + > +EXPORT_SYMBOL_GPL(ckrm_alloc_class); > +EXPORT_SYMBOL_GPL(ckrm_free_class); > + > Index: linux-2.6.13/kernel/ckrm/ckrmutils.c > =================================================================== > --- /dev/null > +++ linux-2.6.13/kernel/ckrm/ckrmutils.c > @@ -0,0 +1,151 @@ > +/* > + * ckrmutils.c - Utility functions for CKRM > + * > + * Copyright (C) Chandra Seetharaman, IBM Corp. 2003, 2004, 2005 > + * (C) Hubertus Franke , IBM Corp. 2004 > + * > + * Provides simple utility functions for the core module, CE and > resource > + * controllers. > + * > + * Latest version, more details at http://ckrm.sf.net > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + */ > + > +#include <linux/mm.h> > +#include <linux/err.h> > +#include <linux/mount.h> > +#include <linux/module.h> > +#include <linux/ckrm_rc.h> > + > +/* > + * Caller is responsible for protecting 'parent' > + * Caller is responsible for making sure that the new guarantee doesn't > + * overflow parent's total guarantee. > + */ > +void > +child_guarantee_changed(struct ckrm_shares *parent, int cur, int new) > +{ > + if (new == cur || !parent) > + return; > + > + if (new != CKRM_SHARE_DONTCARE) > + parent->unused_guarantee -= new; > + > + if (cur != CKRM_SHARE_DONTCARE) > + parent->unused_guarantee += cur; > + > + return; > +} > + > +/* > + * Caller is responsible for procting 'parent' > + * Caller is responsible for making sure that the new limit is not more > + * than parent's max_limit > + */ > +void > +child_maxlimit_changed(struct ckrm_shares *parent, int new_limit) > +{ > + if (parent && parent->cur_max_limit < new_limit) > + parent->cur_max_limit = new_limit; > + return; > +} > + > +/* > + * Caller is responsible for holding any lock to protect the data > + * structures passed to this function > + */ > +int > +set_shares(struct ckrm_shares *new, struct ckrm_shares *cur, > + struct ckrm_shares *par) > +{ > + int rc = -EINVAL; > + int cur_usage_guar = cur->total_guarantee - cur->unused_guarantee; > + int increase_by; > + > + if (cur->my_guarantee < 0) /* DONTCARE or UNCHANGED */ > + increase_by = new->my_guarantee; > + else > + increase_by = new->my_guarantee - cur->my_guarantee; > + > + /* Check total_guarantee for correctness */ > + if (new->total_guarantee <= CKRM_SHARE_DONTCARE) > + goto set_share_err; > + else if (new->total_guarantee == CKRM_SHARE_UNCHANGED) > + /* do nothing */; > + else if (cur_usage_guar > new->total_guarantee) > + goto set_share_err; > + > + /* Check max_limit for correctness */ > + if (new->max_limit <= CKRM_SHARE_DONTCARE) > + goto set_share_err; > + else if (new->max_limit == CKRM_SHARE_UNCHANGED) > + /* do nothing */; > + else if (cur->cur_max_limit > new->max_limit) > + goto set_share_err; > + > + /* Check my_guarantee for correctness */ > + if (new->my_guarantee == CKRM_SHARE_UNCHANGED) > + /* do nothing */; > + else if (new->my_guarantee == CKRM_SHARE_DONTCARE) > + /* do nothing */; > + else if (par && increase_by > par->unused_guarantee) > + goto set_share_err; > + > + /* Check my_limit for correctness */ > + if (new->my_limit == CKRM_SHARE_UNCHANGED) > + /* do nothing */; > + else if (new->my_limit == CKRM_SHARE_DONTCARE) > + /* do nothing */; > + else if (par && new->my_limit > par->max_limit) > + /* I can't get more limit than my parent's limit */ > + goto set_share_err; > + > + /* make sure guarantee is lesser than limit */ > + if (new->my_limit == CKRM_SHARE_DONTCARE) > + /* do nothing */; > + else if (new->my_limit == CKRM_SHARE_UNCHANGED) { > + if (new->my_guarantee == CKRM_SHARE_DONTCARE) > + /* do nothing */; > + else if (new->my_guarantee == CKRM_SHARE_UNCHANGED) > + /* > + * do nothing; earlier setting would have > + * taken care of it > + */; > + else if (new->my_guarantee > cur->my_limit) > + goto set_share_err; > + } else /* new->my_limit has a valid value */ > + if (new->my_guarantee == CKRM_SHARE_DONTCARE) > + /* do nothing */; > + else if (new->my_guarantee == CKRM_SHARE_UNCHANGED) { > + if (cur->my_guarantee > new->my_limit) > + goto set_share_err; > + } else if (new->my_guarantee > new->my_limit) > + goto set_share_err; > + > + if (new->my_guarantee != CKRM_SHARE_UNCHANGED) > + child_guarantee_changed(par, cur->my_guarantee, > + new->my_guarantee); > + cur->my_guarantee = new->my_guarantee; > + > + if (new->my_limit != CKRM_SHARE_UNCHANGED) > + child_maxlimit_changed(par, new->my_limit); > + cur->my_limit = new->my_limit; > + > + if (new->total_guarantee != CKRM_SHARE_UNCHANGED) > + cur->unused_guarantee = new->total_guarantee - cur_usage_guar; > + cur->total_guarantee = new->total_guarantee; > + > + if (new->max_limit != CKRM_SHARE_UNCHANGED) > + cur->max_limit = new->max_limit; > + > + rc = 0; > +set_share_err: > + return rc; > +} > + > +EXPORT_SYMBOL_GPL(child_guarantee_changed); > +EXPORT_SYMBOL_GPL(child_maxlimit_changed); > +EXPORT_SYMBOL_GPL(set_shares); > Index: linux-2.6.13/include/linux/ckrm.h > =================================================================== > --- /dev/null > +++ linux-2.6.13/include/linux/ckrm.h > @@ -0,0 +1,77 @@ > +/* > + * ckrm.h - Header file to be used by CKRM > + * > + * Copyright * (C) Chandra Seetharaman, IBM Corp. 2005 > + * > + * Provides data structures, macros and kernel API of CKRM > + * > + * More details at http://ckrm.sf.net > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + */ > + > +#ifndef _LINUX_CKRM_H > +#define _LINUX_CKRM_H > + > +#ifdef CONFIG_CKRM > +#include <linux/kref.h> > + > +#define CKRM_MAX_RES_CTLRS 8 /* maximum controllers per classtype */ > +#define CKRM_MAX_RES_NAME 128 /* maximum name length of controller */ > + > +#define CKRM_DEFAULT_CLASS_NAME "task" > + > +/* > + * basic data structure for holding the class information. > + */ > +struct ckrm_class { > + void *res_class[CKRM_MAX_RES_CTLRS]; /* resource classes */ > + > + struct list_head tasklist; /* this class's tasks */ > + spinlock_t class_lock; /* protects list,array above */ > + > + struct list_head clslist; /* peer classtype classes */ What is the purpose of clslist member and peer classtype mean? Isn't it a former classtype specific member? > + > + struct kref refcnt; > + const char *name; > + int dead; > + > + /* Hierarchy information */ > + struct ckrm_class *parent; > + struct list_head siblings; > + struct list_head children; /* protected by class_lock */ > +}; > + > +/* > + * Share specifications > + */ > +struct ckrm_shares { > + int my_guarantee; > + int my_limit; > + int total_guarantee; > + int max_limit; > + int unused_guarantee; /* not used as parameters */ > + int cur_max_limit; /* not used as parameters */ > +}; > + > +#define CKRM_SHARE_UNCHANGED (-1) > +#define CKRM_SHARE_DONTCARE (-2) > +#define CKRM_SHARE_DFLT_TOTAL_GUARANTEE (100) > +#define CKRM_SHARE_DFLT_MAX_LIMIT (100) > + > +extern struct ckrm_class ckrm_default_class; > +extern int max_resid; > +extern atomic_t nr_resusers[]; > +extern struct ckrm_res_ctlr *res_ctlrs[]; > + > +extern struct ckrm_class *ckrm_alloc_class(struct ckrm_class *, > + const char *); > +extern int ckrm_free_class(struct ckrm_class *); > +extern void ckrm_release_class(struct kref *); > +#endif /* CONFIG_CKRM */ > + > +#endif > Index: linux-2.6.13/kernel/Makefile > =================================================================== > --- linux-2.6.13.orig/kernel/Makefile > +++ linux-2.6.13/kernel/Makefile > @@ -30,6 +30,7 @@ obj-$(CONFIG_SYSFS) += ksysfs.o > obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ > obj-$(CONFIG_CRASH_DUMP) += crash_dump.o > obj-$(CONFIG_SECCOMP) += seccomp.o > +obj-$(CONFIG_CKRM) += ckrm/ > > ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y) > # According to Alan Modra <[EMAIL PROTECTED]>, the -fno-omit-frame- > pointer is > Index: linux-2.6.13/kernel/ckrm/Makefile > =================================================================== > --- /dev/null > +++ linux-2.6.13/kernel/ckrm/Makefile > @@ -0,0 +1,5 @@ > +# > +# Makefile for CKRM > +# > + > +obj-y = ckrm.o ckrmutils.o > Index: linux-2.6.13/init/Kconfig > =================================================================== > --- linux-2.6.13.orig/init/Kconfig > +++ linux-2.6.13/init/Kconfig > @@ -146,6 +146,21 @@ config BSD_PROCESS_ACCT_V3 > for processing it. A preliminary version of these tools is available > at <http://www.physik3.uni-rostock.de/tim/kernel/utils/acct/>. > > +menu "Class Based Kernel Resource Management" > + > +config CKRM > + bool "Class Based Kernel Resource Management Core" > + depends on EXPERIMENTAL > + help > + Class-based Kernel Resource Management is a framework for > controlling > + and monitoring resource allocation of user-defined groups of tasks > or > + incoming socket connections. For more information, please visit > + http://ckrm.sf.net. > + > + If you say Y here, enable the Resource Class File System and at > least > + one of the resource controllers below. Say N if you are unsure. > + > +endmenu > config SYSCTL > bool "Sysctl support" > ---help--- > Thanks, MAEDA Naoaki ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ ckrm-tech mailing list https://lists.sourceforge.net/lists/listinfo/ckrm-tech
