Messages in this thread | | | From | Roland Dreier <> | Date | Wed, 10 Nov 2004 09:17:00 -0800 | Subject | Re: [RFC] [PATCH] kmem_alloc (generic wrapper for kmalloc and vmalloc) |
| |
Carl-Daniel> OK, so how should I allocate memory for 512 struct Carl-Daniel> loop_device's? Because of its odd size (304 bytes) Carl-Daniel> it seems that if I use kmalloc seperately for each Carl-Daniel> struct, I'd waste 208 bytes per allocation. 68% Carl-Daniel> overhead would be a step backwards. Or am I missing Carl-Daniel> something here?
Would creating your own slab cache with kmem_cache_create() and allocating with kmem_cache_alloc() work? You can fit 13 304 byte objects in a 4K page, which wastes 4096 - 13*304 = 144 bytes per page or about 11 bytes per object. Less than 4% overhead seems OK to me.
- R. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |