Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nommu: clamp zone_batchsize() to 0 under NOMMU conditions

Clamp zone_batchsize() to 0 under NOMMU conditions to stop
free_hot_cold_page() from queueing and batching frees.

The problem is that under NOMMU conditions it is really important to be
able to allocate large contiguous chunks of memory, but when munmap() or
exit_mmap() releases big stretches of memory, return of these to the buddy
allocator can be deferred, and when it does finally happen, it can be in
small chunks.

Whilst the fragmentation this incurs isn't so much of a problem under MMU
conditions as userspace VM is glued together from individual pages with
the aid of the MMU, it is a real problem if there isn't an MMU.

By clamping the page freeing queue size to 0, pages are returned to the
allocator immediately, and the buddy detector is more likely to be able to
glue them together into large chunks immediately, and fragmentation is
less likely to occur.

By disabling batching of frees, and by turning off the trimming of excess
space during boot, Coldfire can manage to boot.

Reported-by: Lanttor Guo <lanttor.guo@freescale.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Lanttor Guo <lanttor.guo@freescale.com>
Cc: Greg Ungerer <gerg@snapgear.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Howells and committed by
Linus Torvalds
3a6be87f 9155203a

+18
+18
mm/page_alloc.c
··· 2681 2681 2682 2682 static int zone_batchsize(struct zone *zone) 2683 2683 { 2684 + #ifdef CONFIG_MMU 2684 2685 int batch; 2685 2686 2686 2687 /* ··· 2710 2709 batch = rounddown_pow_of_two(batch + batch/2) - 1; 2711 2710 2712 2711 return batch; 2712 + 2713 + #else 2714 + /* The deferral and batching of frees should be suppressed under NOMMU 2715 + * conditions. 2716 + * 2717 + * The problem is that NOMMU needs to be able to allocate large chunks 2718 + * of contiguous memory as there's no hardware page translation to 2719 + * assemble apparent contiguous memory from discontiguous pages. 2720 + * 2721 + * Queueing large contiguous runs of pages for batching, however, 2722 + * causes the pages to actually be freed in smaller chunks. As there 2723 + * can be a significant delay between the individual batches being 2724 + * recycled, this leads to the once large chunks of space being 2725 + * fragmented and becoming unavailable for high-order allocations. 2726 + */ 2727 + return 0; 2728 + #endif 2713 2729 } 2714 2730 2715 2731 static void setup_pageset(struct per_cpu_pageset *p, unsigned long batch)