• KAMEZAWA Hiroyuki's avatar
    cgroup: CSS ID support · 38460b48
    KAMEZAWA Hiroyuki authored
    Patch for Per-CSS(Cgroup Subsys State) ID and private hierarchy code.
    
    This patch attaches unique ID to each css and provides following.
    
     - css_lookup(subsys, id)
       returns pointer to struct cgroup_subysys_state of id.
     - css_get_next(subsys, id, rootid, depth, foundid)
       returns the next css under "root" by scanning
    
    When cgroup_subsys->use_id is set, an id for css is maintained.
    
    The cgroup framework only parepares
    	- css_id of root css for subsys
    	- id is automatically attached at creation of css.
    	- id is *not* freed automatically. Because the cgroup framework
    	  don't know lifetime of cgroup_subsys_state.
    	  free_css_id() function is provided. This must be called by subsys.
    
    There are several reasons to develop this.
    	- Saving space .... For example, memcg's swap_cgroup is array of
    	  pointers to cgroup. But it is not necessary to be very fast.
    	  By replacing pointers(8bytes per ent) to ID (2byes per ent), we can
    	  reduce much amount of memory usage.
    
    	- Scanning without l...
    38460b48
idr.c 21.3 KB