2006-10-26 23:21:57

by Oleg Nesterov

[permalink] [raw]
Subject: [PATCH 4/6] taskstats_tgid_alloc: optimization

Every subthread (except first) does unneeded kmem_cache_alloc/kmem_cache_free.

Signed-off-by: Oleg Nesterov <[email protected]>

--- STATS/include/linux/taskstats_kern.h~4_alloc 2006-10-27 01:28:31.000000000 +0400
+++ STATS/include/linux/taskstats_kern.h 2006-10-27 01:39:10.000000000 +0400
@@ -32,6 +32,9 @@ static inline void taskstats_tgid_alloc(
struct taskstats *stats;
unsigned long flags;

+ if (sig->stats != NULL)
+ return;
+
stats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
if (!stats)
return;