delayacct: Default disabled
Assuming this stuff isn't actually used much; disable it by default and avoid allocating and tracking the task_delay_info structure. taskstats is changed to still report the regular sched and sched_info and only skip the missing task_delay_info fields instead of not reporting anything. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@kernel.org> Link: https://lkml.kernel.org/r/20210505111525.308018373@infradead.org
This commit is contained in:
+11
-8
@@ -14,23 +14,23 @@
|
||||
#include <linux/delayacct.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
DEFINE_STATIC_KEY_TRUE(delayacct_key);
|
||||
int delayacct_on __read_mostly = 1; /* Delay accounting turned on/off */
|
||||
DEFINE_STATIC_KEY_FALSE(delayacct_key);
|
||||
int delayacct_on __read_mostly; /* Delay accounting turned on/off */
|
||||
struct kmem_cache *delayacct_cache;
|
||||
|
||||
static int __init delayacct_setup_disable(char *str)
|
||||
static int __init delayacct_setup_enable(char *str)
|
||||
{
|
||||
delayacct_on = 0;
|
||||
delayacct_on = 1;
|
||||
return 1;
|
||||
}
|
||||
__setup("nodelayacct", delayacct_setup_disable);
|
||||
__setup("delayacct", delayacct_setup_enable);
|
||||
|
||||
void delayacct_init(void)
|
||||
{
|
||||
delayacct_cache = KMEM_CACHE(task_delay_info, SLAB_PANIC|SLAB_ACCOUNT);
|
||||
delayacct_tsk_init(&init_task);
|
||||
if (!delayacct_on)
|
||||
static_branch_disable(&delayacct_key);
|
||||
if (delayacct_on)
|
||||
static_branch_enable(&delayacct_key);
|
||||
}
|
||||
|
||||
void __delayacct_tsk_init(struct task_struct *tsk)
|
||||
@@ -83,7 +83,7 @@ void __delayacct_blkio_end(struct task_struct *p)
|
||||
delayacct_end(&delays->lock, &delays->blkio_start, total, count);
|
||||
}
|
||||
|
||||
int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
|
||||
int delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
|
||||
{
|
||||
u64 utime, stime, stimescaled, utimescaled;
|
||||
unsigned long long t2, t3;
|
||||
@@ -118,6 +118,9 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
|
||||
d->cpu_run_virtual_total =
|
||||
(tmp < (s64)d->cpu_run_virtual_total) ? 0 : tmp;
|
||||
|
||||
if (!tsk->delays)
|
||||
return 0;
|
||||
|
||||
/* zero XXX_total, non-zero XXX_count implies XXX stat overflowed */
|
||||
|
||||
raw_spin_lock_irqsave(&tsk->delays->lock, flags);
|
||||
|
||||
Reference in New Issue
Block a user