15 Dec, 2011

1 commit


20 Sep, 2011

1 commit


28 Oct, 2010

1 commit

  • The taskstats interface uses microsecond granularity for the user and
    system time values. The conversion from cputime to the taskstats values
    uses the cputime_to_msecs primitive which effectively limits the
    granularity to milliseconds. Add the cputime_to_usecs primitive for
    architectures that have better, more precise CPU time values. Remove
    cputime_to_msecs primitive because there are no more users left.

    Signed-off-by: Michael Holzheu
    Acked-by: Balbir Singh
    Cc: Luck Tony
    Cc: Shailabh Nagar
    Cc: Martin Schwidefsky
    Cc: Oleg Nesterov
    Cc: Benjamin Herrenschmidt
    Cc: Heiko Carstens
    Cc: Thomas Gleixner
    Cc: Shailabh Nagar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Holzheu
     

07 Mar, 2010

1 commit

  • Presently, per-mm statistics counter is defined by macro in sched.h

    This patch modifies it to
    - defined in mm.h as inlinf functions
    - use array instead of macro's name creation.

    This patch is for reducing patch size in future patch to modify
    implementation of per-mm counter.

    Signed-off-by: KAMEZAWA Hiroyuki
    Reviewed-by: Minchan Kim
    Cc: Christoph Lameter
    Cc: Lee Schermerhorn
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    KAMEZAWA Hiroyuki
     

09 Mar, 2009

1 commit

  • Frans Pop reported the crash below when running an s390 kernel under Hercules:

    Kernel BUG at 000738b4 verbose debug info unavailable!
    fixpoint divide exception: 0009 #1! SMP
    Modules linked in: nfs lockd nfs_acl sunrpc ctcm fsm tape_34xx
    cu3088 tape ccwgroup tape_class ext3 jbd mbcache dm_mirror dm_log dm_snapshot
    dm_mod dasd_eckd_mod dasd_mod
    CPU: 0 Not tainted 2.6.27.19 #13
    Process awk (pid: 2069, task: 0f9ed9b8, ksp: 0f4f7d18)
    Krnl PSW : 070c1000 800738b4 (acct_update_integrals+0x4c/0x118)
    R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:1 PM:0
    Krnl GPRS: 00000000 000007d0 7fffffff fffff830
    00000000 ffffffff 00000002 0f9ed9b8
    00000000 00008ca0 00000000 0f9ed9b8
    0f9edda4 8007386e 0f4f7ec8 0f4f7e98
    Krnl Code: 800738aa: a71807d0 lhi %r1,2000
    800738ae: 8c200001 srdl %r2,1
    800738b2: 1d21 dr %r2,%r1
    >800738b4: 5810d10e l %r1,270(%r13)
    800738b8: 1823 lr %r2,%r3
    800738ba: 4130f060 la %r3,96(%r15)
    800738be: 0de1 basr %r14,%r1
    800738c0: 5800f060 l %r0,96(%r15)
    Call Trace:
    ( ! blocking_notifier_call_chain+0x1e/0x2c)
    ! do_exit+0x106/0x7c0
    ! do_group_exit+0x7a/0xb4
    ! SyS_exit_group+0x1e/0x30
    ! sysc_do_restart+0x12/0x16
    ! 0x77e7e924

    Reason for this is that cpu time accounting usually only happens from
    interrupt context, but acct_update_integrals gets also called from
    process context with interrupts enabled.

    So in acct_update_integrals we may end up with the following scenario:

    Between reading tsk->stime/tsk->utime and tsk->acct_timexpd an interrupt
    happens which updates accouting values. This causes acct_timexpd to be
    greater than the former stime + utime. The subsequent calculation of

    dtime = cputime_sub(time, tsk->acct_timexpd);

    will be negative and the division performed by

    cputime_to_jiffies(dtime)

    will generate an exception since the result won't fit into a 32 bit
    register.

    In order to fix this just always disable interrupts while accessing any
    of the accounting values.

    Reported by: Frans Pop
    Tested by: Frans Pop
    Cc: stable@kernel.org
    Cc: Martin Schwidefsky
    Signed-off-by: Heiko Carstens
    Signed-off-by: Linus Torvalds

    Heiko Carstens
     

07 Jan, 2009

1 commit

  • xacct_add_tsk() relies on do_exit()->update_hiwater_xxx() and uses
    mm->hiwater_xxx directly, this leads to 2 problems:

    - taskstats_user_cmd() can call fill_pid()->xacct_add_tsk() at any
    moment before the task exits, so we should check the current values of
    rss/vm anyway.

    - do_exit()->update_hiwater_xxx() calls are racy. An exiting thread can
    be preempted right before mm->hiwater_xxx = new_val, and another thread
    can use A_LOT of memory and exit in between. When the first thread
    resumes it can be the last thread in the thread group, in that case we
    report the wrong hiwater_xxx values which do not take A_LOT into
    account.

    Introduce get_mm_hiwater_rss() and get_mm_hiwater_vm() helpers and change
    xacct_add_tsk() to use them. The first helper will also be used by
    rusage->ru_maxrss accounting.

    Kill do_exit()->update_hiwater_xxx() calls. Unless we are going to
    decrease rss/vm there is no point to update mm->hiwater_xxx, and nobody
    can look at this mm_struct when exit_mmap() actually unmaps the memory.

    Signed-off-by: Oleg Nesterov
    Acked-by: Hugh Dickins
    Reviewed-by: KOSAKI Motohiro
    Acked-by: Balbir Singh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

14 Nov, 2008

2 commits

  • Use RCU to access another task's creds and to release a task's own creds.
    This means that it will be possible for the credentials of a task to be
    replaced without another task (a) requiring a full lock to read them, and (b)
    seeing deallocated memory.

    Signed-off-by: David Howells
    Acked-by: James Morris
    Acked-by: Serge Hallyn
    Signed-off-by: James Morris

    David Howells
     
  • Separate the task security context from task_struct. At this point, the
    security data is temporarily embedded in the task_struct with two pointers
    pointing to it.

    Note that the Alpha arch is altered as it refers to (E)UID and (E)GID in
    entry.S via asm-offsets.

    With comment fixes Signed-off-by: Marc Dionne

    Signed-off-by: David Howells
    Acked-by: James Morris
    Acked-by: Serge Hallyn
    Signed-off-by: James Morris

    David Howells
     

28 Jul, 2008

2 commits

  • Simplify the code of include/linux/task_io_accounting.h.

    It is also more reasonable to have all the task i/o-related statistics in a
    single struct (task_io_accounting).

    Signed-off-by: Andrea Righi
    Signed-off-by: Oleg Nesterov
    Signed-off-by: Linus Torvalds

    Andrea Righi
     
  • Put all i/o statistics in struct proc_io_accounting and use inline functions to
    initialize and increment statistics, removing a lot of single variable
    assignments.

    This also reduces the kernel size as following (with CONFIG_TASK_XACCT=y and
    CONFIG_TASK_IO_ACCOUNTING=y).

    text data bss dec hex filename
    11651 0 0 11651 2d83 kernel/exit.o.before
    11619 0 0 11619 2d63 kernel/exit.o.after
    10886 132 136 11154 2b92 kernel/fork.o.before
    10758 132 136 11026 2b12 kernel/fork.o.after

    3082029 807968 4818600 8708597 84e1f5 vmlinux.o.before
    3081869 807968 4818600 8708437 84e155 vmlinux.o.after

    Signed-off-by: Andrea Righi
    Acked-by: Oleg Nesterov
    Signed-off-by: Linus Torvalds

    Andrea Righi
     

26 Jul, 2008

2 commits

  • Fix bacct_add_tsk()'s use of do_div() on an s64 by making ac_etime a u64
    instead and dividing that.

    Possibly this should be guarded lest the interval calculation turn up
    negative, but the possible negativity of the result of the division is
    cast away, and it shouldn't end up negative anyway.

    This was introduced by patch f3cef7a99469afc159fec3a61b42dc7ca5b6824f.

    Signed-off-by: David Howells
    Cc: Jay Lan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Adapt acct_update_integrals() to include user time when calculating the time
    difference. The units of acct_rss_mem1 and acct_vm_mem1 are also changed from
    pages-jiffies to pages-usecs to avoid calling jiffies_to_usecs() in
    xacct_add_tsk() which might overflow.

    Signed-off-by: Jonathan Lim
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jonathan Lim
     

19 Oct, 2007

1 commit

  • This adds items to the taststats struct to account for user and system
    time based on scaling the CPU frequency and instruction issue rates.

    Adds account_(user|system)_time_scaled callbacks which architectures
    can use to account for time using this mechanism.

    Signed-off-by: Michael Neuling
    Cc: Balbir Singh
    Cc: Jay Lan
    Cc: Paul Mackerras
    Cc: Benjamin Herrenschmidt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Neuling
     

26 Jul, 2007

1 commit

  • This avoids use of the kernel-internal "xtime" variable directly outside
    of the actual time-related functions. Instead, use the helper functions
    that we already have available to us.

    This doesn't actually change any behaviour, but this will allow us to
    fix the fact that "xtime" isn't updated very often with CONFIG_NO_HZ
    (because much of the realtime information is maintained as separate
    offsets to 'xtime'), which has caused interfaces that use xtime directly
    to get a time that is out of sync with the real-time clock by up to a
    third of a second or so.

    Signed-off-by: John Stultz
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Linus Torvalds

    john stultz
     

17 Feb, 2007

1 commit

  • In preparation for the x86_64 generic time conversion, this patch splits out
    TSC and HPET related code from arch/x86_64/kernel/time.c into respective
    hpet.c and tsc.c files.

    [akpm@osdl.org: fix printk timestamps]
    [akpm@osdl.org: cleanup]
    Signed-off-by: John Stultz
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Andi Kleen
    Cc: Roman Zippel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    john stultz
     

11 Dec, 2006

1 commit


31 Oct, 2006

1 commit


29 Oct, 2006

1 commit

  • 1. ts = timespec_sub(uptime, current->group_leader->start_time);

    It is possible that current != tsk. Probably it was supposed
    to be 'tsk->group_leader->start_time. But why we are reading
    group_leader's start_time ? This accounting is per thread,
    not per procees, I changed this to 'tsk->start_time.
    Please corect me.

    2. stats->ac_ppid = (tsk->parent) ? tsk->parent->pid : 0;

    tsk->parent never == NULL, and it is unsafe to dereference it.
    Both the task and it's parent may exit after the caller unlocks
    tasklist_lock, the memory could be unmapped (DEBUG_SLAB).
    (And we should use ->real_parent->tgid in fact).

    Q: I don't understand the 'if (thread_group_leader(tsk))' check.
    Why it is needed ?

    Signed-off-by: Oleg Nesterov
    Cc: Shailabh Nagar
    Cc: Balbir Singh
    Acked-by: Jay Lan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

01 Oct, 2006

4 commits

  • ChangeLog:
    Feedbacks from Andrew Morton:
    - define TS_COMM_LEN to 32
    - change acct_stimexpd field of task_struct to be of
    cputime_t, which is to be used to save the tsk->stime
    of last timer interrupt update.
    - a new Documentation/accounting/taskstats-struct.txt
    to describe fields of taskstats struct.

    Feedback from Balbir Singh:
    - keep the stime of a task to be zero when both stime
    and utime are zero as recoreded in task_struct.

    Misc:
    - convert accumulated RSS/VM from platform dependent
    pages-ticks to MBytes-usecs in the kernel

    Cc: Shailabh Nagar
    Cc: Balbir Singh
    Cc: Jes Sorensen
    Cc: Chris Sturtivant
    Cc: Tony Ernst
    Cc: Guillaume Thouvenin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jay Lan
     
  • There were a few accounting data/macros that are used in CSA but are #ifdef'ed
    inside CONFIG_BSD_PROCESS_ACCT. This patch is to change those ifdef's from
    CONFIG_BSD_PROCESS_ACCT to CONFIG_TASK_XACCT. A few defines are moved from
    kernel/acct.c and include/linux/acct.h to kernel/tsacct.c and
    include/linux/tsacct_kern.h.

    Signed-off-by: Jay Lan
    Cc: Shailabh Nagar
    Cc: Balbir Singh
    Cc: Jes Sorensen
    Cc: Chris Sturtivant
    Cc: Tony Ernst
    Cc: Guillaume Thouvenin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jay Lan
     
  • Add extended system accounting handling over taskstats interface. A
    CONFIG_TASK_XACCT flag is created to enable the extended accounting code.

    Signed-off-by: Jay Lan
    Cc: Shailabh Nagar
    Cc: Balbir Singh
    Cc: Jes Sorensen
    Cc: Chris Sturtivant
    Cc: Tony Ernst
    Cc: Guillaume Thouvenin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jay Lan
     
  • Add some basic accounting fields to the taskstats struct, add a new
    kernel/tsacct.c to handle basic accounting data handling upon exit. A handle
    is added to taskstats.c to invoke the basic accounting data handling.

    Signed-off-by: Jay Lan
    Cc: Shailabh Nagar
    Cc: Balbir Singh
    Cc: Jes Sorensen
    Cc: Chris Sturtivant
    Cc: Tony Ernst
    Cc: Guillaume Thouvenin
    Cc: "Michal Piotrowski"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jay Lan