Fixes/issue28 #38

Merged
merged 2 commits into from Mar 19, 2013
Commits on Jul 4, 2012
  1. @gajdusek

    scheduler: Do not reinitialize parent cgroups everytime a child group…

    gajdusek committed Jun 29, 2012
    … is created.
    
    Whenever scheduler find a process matching rule and correspondent cgroup
    does not yet exist, scheduler blindly tries to create all parental
    cgroups, ignoring they may already be there.
    
    adjust_new() functions are repeatedly called upon already existing
    cgroups and adjust() function is repeatedly added to them.
  2. @gajdusek

    core.lua: fix for cgroups removed outside ulatencyd (issue #28)

    gajdusek committed Jun 29, 2012
    fixes issue #28: CGroup properties not set.
    
    Reason:
    Whenever scheduler finds matching rule for scheduled process, it calls
    CGroup.get_group(name) to check if cgroup does exist. This used to check
    only if cgroup is contained in the internal _CGroup_Cache - not if it really
    does exist in cgroup filesystem.
    
    So if the cgroup was removed outside ulatencyd and therefore was not
    removed from _CGroup_Cache, cgroup will not be recreated and will loose
    all settings (default parameters, rule parameters, parameters adjusted
    by adjust_new).
    
     + CGroup.get_group(): test if cgroup is really present in filesystem,
       otherwise return false or nil.
     + CGroup.new(): always create requested cgroup. If it is already
       contained in _CGroup_Cache, replace it with new one. Code should check
       its existence before calling CGroup.new() anyway.
    
    Real fix would involve changing ulatencyd_cleanup.lua in a way it tells
    ulatencyd to remove that cgroup. Ulatencyd should also update its internal
    structures and do clean up, i.e. handle remaining memory charges.