Davide Libenzi a écrit :

+struct timerfd_ctx {
+       struct hrtimer tmr;
+       ktime_t tintv;
+       spinlock_t lock;
+       wait_queue_head_t wqh;
+       unsigned long ticks;
+};

+static struct kmem_cache *timerfd_ctx_cachep;

+       timerfd_ctx_cachep = kmem_cache_create("timerfd_ctx_cache",
+                                               sizeof(struct timerfd_ctx),
+                                               0, SLAB_PANIC, NULL, NULL);


Do we really expect thousands of active timerfd_ctx ?

If not, using kmalloc()/kfree() would be fine, because sizeof(struct timerfd_ctx) is so small.

on SMP / NUMA platforms, each new kmem_cache is rather expensive. (memory allocated at kmem_cache_create(), but also memory used when cache is not empty, with slabs in freelist for each cpu/node)

Using a general cache might be cheaper : No memory overhead for yet another kmem_cache.

I know individual caches are good to spot memory leaks, but in timerfd case, you dont have mem leaks, do you ? :)



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to