Re: [patch] sched: schedstat needs a diet

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mathieu Desnoyers
Date: Thursday, October 18, 2007 - 3:19 pm

* Peter Zijlstra (peterz@infradead.org) wrote:

Good question indeed. How large is this memory footprint exactly ? If it
is as small as you say, I suspect that the real issue could be that
these variable are accessed by the scheduler critical paths and
therefore trash the caches.

(in bytes with 8 bytes longs)
(in 2.6.23-mm1)

task struct
  struct sched_entity 9 * 8 bytes
  struct sched_info 5 * 8 bytes
(as Ingo noted, this is only in -mm. It really hurts since it grows the
task structs)

struct sched_domain
  20 * 8 bytes
O(nr cpus) or a little more on tricky setups

struct rq
  struct sched_info 5 * 8 bytes
  10 * 8 bytes
O(nr cpus), which is not much.

If the memory footprint of struct sched_domain and struct rq really
matters, one should set its NR_CPUS to the lowest value required by his
setup to help reduce the memory size. And forget about per task
statistics.

Adding data to the task struct will turn out to be a real problem, both
for memory consumption and cache trashing. Could we think of allocating
the memory required for statistics (scheduler, vm, ...) only when stats
collection is required ? It could add one pointer to the task struct
(NULL by default, set to a memory location used to accumulate per-task
stats before we activate system wide stats counting). It could fit well
with the immediate values, which could be used to enable/disable the
statistic collection dynamically at runtime with minimal impact in the
scheduler code.

Mathieu

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch] sched: schedstat needs a diet, Ken Chen, (Tue Oct 16, 1:37 pm)
Re: [patch] sched: schedstat needs a diet, Ingo Molnar, (Wed Oct 17, 12:23 am)
Re: [patch] sched: schedstat needs a diet, Peter Zijlstra, (Wed Oct 17, 2:29 am)
Re: [patch] sched: schedstat needs a diet, Mathieu Desnoyers, (Thu Oct 18, 3:19 pm)
Re: [patch] sched: schedstat needs a diet, Ken Chen, (Thu Oct 18, 3:57 pm)
Re: [patch] sched: schedstat needs a diet, Mathieu Desnoyers, (Thu Oct 18, 4:13 pm)
Re: [patch] sched: schedstat needs a diet , Rick Lindsley, (Wed Oct 31, 2:06 am)