diff options
| author | Andrew Morton <akpm@digeo.com> | 2002-11-25 17:56:58 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-11-25 17:56:58 -0800 |
| commit | 8b1f287bd226d1208fdc7acfec64fc489d07acb3 (patch) | |
| tree | 5db068c181ddfa2ab27581d3b15782c26bd9a459 /fs/proc/array.c | |
| parent | 10414c6ddb53f0580d62dd1a4bb310fb4c9ea791 (diff) | |
[PATCH] shrink task_struct by removing per_cpu utime and stime
Patch from Bill Irwin. It has the potential to break userspace
monitoring tools a little bit, and I'm a rater uncertain about
how useful the per-process per-cpu accounting is.
Bill sent this out as an RFC on July 29:
"These statistics severely bloat the task_struct and nothing in
userspace can rely on them as they're conditional on CONFIG_SMP. If
anyone is using them (or just wants them around), please speak up."
And nobody spoke up.
If we apply this, the contents of /proc/783/cpu will go from
cpu 1 1
cpu0 0 0
cpu1 0 0
cpu2 1 1
cpu3 0 0
to
cpu 1 1
And we shall save 256 bytes from the ia32 task_struct.
On my SMP build with NR_CPUS=32:
Without this patch, sizeof(task_struct) is 1824, slab uses a 1-order
allocation and we are getting 2 task_structs per page.
With this patch, sizeof(task_struct) is 1568, slab uses a 2-order
allocation and we are getting 2.5 task_structs per page.
So it seems worthwhile.
(Maybe this highlights a shortcoming in slab. For the 1824-byte case
it could have used a 0-order allocation)
Diffstat (limited to 'fs/proc/array.c')
| -rw-r--r-- | fs/proc/array.c | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 00e80906b170..2fa25e95712d 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -597,25 +597,3 @@ out_free1: out: return retval; } - -#ifdef CONFIG_SMP -int proc_pid_cpu(struct task_struct *task, char * buffer) -{ - int i, len; - - len = sprintf(buffer, - "cpu %lu %lu\n", - jiffies_to_clock_t(task->utime), - jiffies_to_clock_t(task->stime)); - - for (i = 0 ; i < NR_CPUS; i++) { - if (cpu_online(i)) - len += sprintf(buffer + len, "cpu%d %lu %lu\n", - i, - jiffies_to_clock_t(task->per_cpu_utime[i]), - jiffies_to_clock_t(task->per_cpu_stime[i])); - - } - return len; -} -#endif |
