slub: Use __GFP_MOVABLE for slabs of HPAGE_SIZE This is the same trick as done by the hugetlb support in the kernel. If we allocate a huge page use __GFP_MOVABLE because an allocation of a HUGE_PAGE size is the large allocation unit that cannot cause fragmentation. This will make a system that was booted with slub_min_order = 9 not have any reclaimable slab allocations anymore. All slab allocations will be of type MOVABLE (although they are not movable like huge pages are also not movable). This means that we only have MOVABLE and UNMOVABLE sections of memory which reduces the types of sections and therefore the danger of fragmenting memory. Signed-off-by: Christoph Lameter --- mm/slub.c | 4 ++++ 1 file changed, 4 insertions(+) Index: linux-2.6/mm/slub.c =================================================================== --- linux-2.6.orig/mm/slub.c 2008-02-13 20:27:18.167740404 -0800 +++ linux-2.6/mm/slub.c 2008-02-13 22:14:46.661590312 -0800 @@ -2363,6 +2363,10 @@ static int calculate_sizes(struct kmem_c if (s->flags & SLAB_CACHE_DMA) s->allocflags |= SLUB_DMA; + if (s->order && s->order == get_order(HPAGE_SIZE)) + /* Huge pages are always allocated as movable */ + s->allocflags |= __GFP_MOVABLE; + else if (s->flags & SLAB_RECLAIM_ACCOUNT) s->allocflags |= __GFP_RECLAIMABLE;