• Christoph Lameter's avatar
    [PATCH] Move accounting function calls out of critical vm code paths · 545a604c
    Christoph Lameter authored
    In the 2.6.11 development cycle function calls have been added to lots
    of hot vm paths to do accounting. I think these should not go into the
    final 2.6.1 release because these statistics can be collected in a different
    way that does not require the updating of counters from frequently used
    vm code paths and is consistent with the methods use elsewhere in the kernel
    to obtain statistics.
    
    These function calls are
    
    acct_update_integrals	-> Account for processes based on stime changes
    update_mem_hiwater	-> takes rss and total_vm hiwater marks.
    
    acct_update_integrals is only useful to call if stime changes otherwise
    it will simply return. It is therefore best to relocate the function call
    to acct_update_integral into the function that updates stime which is
    account_system_time and remove it from the vm code paths.
    
    update_mem_hiwater finds the rss hiwater mark.  We call that from timer
    context as well.  This means that processes' high-water marks are now
    sampled statistically, at timer-interrupt time rather than
    deterministically.  This may or may not be a problem..
    
    This means that the rss limit is not always updated if rss is increased
    and thus not as accurate. But the benefit is that the rss checks do no
    pollute the vm paths and that it is consistent with the rss limit check.
    
    The following patch removes acct_update_integrals and update_mem_hiwater
    from the hot vm paths.
    Signed-off-by: default avatarChristoph Lameter <clameter@sgi.com>
    
    From: Jay Lan <jlan@sgi.com>
    
    The new "move-accounting-function-calls-out-of-critical-vm-code-paths"
    patch in 2.6.11-rc3-mm2 was different from the code i tested.
    
    In particular, it mistakenly dropped the accounting routine calls
    in fs/exec.c. The calls in do_execve() are needed to properly
    initialize accounting fields. Specifically, the tsk->acct_stimexpd
    needs to be initialized to tsk->stime.
    
    I have discussed this with Christoph Lameter and he gave me full
    blessings to bring the calls back.
    Signed-off-by: default avatarJay Lan <jlan@sgi.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    545a604c
exec.c 33.5 KB