[dm-devel] [PATCH] slab: introduce the flag SLAB_MINIMIZE_WASTE
Mikulas Patocka
mpatocka at redhat.com
Wed Mar 21 19:25:07 UTC 2018
On Wed, 21 Mar 2018, Christopher Lameter wrote:
> One other thought: If you want to improve the behavior for large scale
> objects allocated through kmalloc/kmemcache then we would certainly be
> glad to entertain those ideas.
>
> F.e. you could optimize the allcations > 2x PAGE_SIZE so that they do not
> allocate powers of two pages. It would be relatively easy to make
> kmalloc_large round the allocation to the next page size and then allocate
> N consecutive pages via alloc_pages_exact() and free the remainder unused
> pages or some such thing.
It may be possible, but we'd need to improve the horrible complexity of
alloc_pages_exact().
This is a trade-of between performance and waste. A power-of-two
allocation can be done quicky, but it wastes a lot of space.
alloc_pages_exact() wastes less space, but it is slow.
The question is - how many of these large-kmalloc allocations are
short-lived and how many are long-lived? I don't know, I haven't measured
it.
Mikulas
More information about the dm-devel
mailing list