Skip to content

Virtual Compound Page Support V1

Christoph Lameter linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest17 patches 3 repliesIn review

Changes in v1 from the cover letter

- Support for all compound functions for virtual compound pages (including the compound_nth_page() necessary for LBS mmap support)
- Fix various bugs
- Fix i386 build

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17Vmalloc: Move vmalloc_to_page to mm/vmalloc.include/linux/mm.h mm/memory.c mm/vmalloc.c+41 -420 replies
2/17vmalloc: add constinclude/linux/mm.h include/linux/vmalloc.h mm/vmalloc.c+13 -130 replies
3/17i386: Resolve dependency of asm-i386/pgtable.h on highmem.hinclude/asm-i386/highmem.h include/asm-i386/pgtable.h+8 -60 replies
4/17is_vmalloc_addr(): Check if an address is within the vmalloc boundariesdrivers/net/cxgb3/cxgb3_offload.c fs/ntfs/malloc.h fs/proc/kcore.c +4 more+14 -190 replies
5/17vmalloc: clean up page array indexingmm/vmalloc.c+11 -50 replies
6/17vunmap: return page array passed on vmap()include/linux/vmalloc.h mm/vmalloc.c+24 -110 replies
7/17vmalloc_address(): Determine vmalloc address from page structinclude/linux/mm.h mm/vmalloc.c+78 -00 replies
8/17GFP_VFALLBACK: Allow fallback of compound pages to virtual mappingsinclude/linux/gfp.h include/linux/mm.h include/linux/page-flags.h +2 more+179 -180 replies
9/17VFALLBACK: Debugging aidlib/Kconfig.debug mm/page_alloc.c+17 -00 replies
10/17Use GFP_VFALLBACK for sparsemem.mm/sparse.c+3 -200 replies
11/17GFP_VFALLBACK for zone wait table.mm/page_alloc.c+3 -10 replies
12/17Virtual Compound page allocation from interrupt context.mm/vmalloc.c+8 -20 replies
13/17Virtual compound page freeing in interrupt contextmm/page_alloc.c+22 -13 replies
14/17Allow bit_waitqueue to wait on a bit in a vmalloc areakernel/wait.c+1 -10 replies
15/17SLUB: Support virtual fallback via SLAB_VFALLBACKinclude/linux/slab.h include/linux/slub_def.h mm/slub.c+32 -220 replies
16/17Allow virtual fallback for buffer_headsfs/buffer.c+2 -10 replies
17/17Allow virtual fallback for dentriesfs/dcache.c+2 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [00/17] Virtual Compound Page Support V1

RFC->V1
- Support for all compound functions for virtual compound pages (including the compound_nth_page() necessary for LBS mmap support)
- Fix various bugs
- Fix i386 build

Currently there is a strong tendency to avoid larger page allocations in the kernel because of past fragmentation issues and the current defragmentation methods are still evolving. It is not clear to what extend they can provide reliable allocations for higher order pages (plus the definition of "reliable" seems to be in the eye of the beholder).

We use vmalloc allocations in many locations to provide a safe way to allocate larger arrays. That is due to the danger of higher order allocations failing. Virtual Compound pages allow the use of regular page allocator allocations that will fall back only if there is an actual problem with acquiring a higher order page.

This patch set provides a way for a higher page allocation to fall back. Instead of a physically contiguous page a virtually contiguous page is provided. The functionality of the vmalloc layer is used to provide the necessary page tables and control structures to establish a virtually contiguous area.

Advantages:

- If higher order allocations are failing then virtual compound pages consisting of a series of order-0 pages can stand in for those allocations.

- Reliability as long as the vmalloc layer can provide virtual mappings.

- Ability to reduce the use of vmalloc layer significantly by using physically contiguous memory instead of virtual contiguous memory. Most uses of vmalloc() can be converted to page allocator calls.

- The use of physically contiguous memory instead of vmalloc may allow the use larger TLB entries thus reducing TLB pressure. Also reduces the need for page table walks.

Disadvantages:

- In order to use fall back the logic accessing the memory must be aware that the memory could be backed by a virtual mapping and take precautions. virt_to_page() and page_address() may not work and vmalloc_to_page() and vmalloc_address() (introduced through this patch set) may have to be called.

- Virtual mappings are less efficient than physical mappings. Performance will drop once virtual fall back occurs.

- Virtual mappings have more memory overhead. vm_area control structures page tables, page arrays etc need to be allocated and managed to provide virtual mappings.

The patchset provides this functionality in stages. Stage 1 introduces the basic fall back mechanism necessary to replace vmalloc allocations with

	alloc_page(GFP_VFALLBACK, order, ....)

which signifies to the page allocator that a higher order is to be found but a virtual mapping may stand in if there is an issue with fragmentation.

Stage 1 functionality does not allow allocation and freeing of virtual mappings from interrupt contexts.

The stage 1 series ends with the conversion of a few key uses of vmalloc in the VM to alloc_pages() for the allocation of sparsemems memmap table and the wait table in each zone. Other uses of vmalloc could be converted in the same way.

Stage 2 functionality enhances the fallback even more allowing allocation and frees in interrupt context.

SLUB is then modified to use the virtual mappings for slab caches that are marked with SLAB_VFALLBACK. If a slab cache is marked this way then we drop all the restraints regarding page order and allocate good large memory areas that fit lots of objects so that we rarely have to use the slow paths.

Two slab caches--the dentry cache and the buffer_heads--are then flagged that way. Others could be converted in the same way.

The patch set also provides a debugging aid through setting

CONFIG_VFALLBACK_ALWAYS

If set then all GFP_VFALLBACK allocations fall back to the virtual mappings. This is useful for verification tests. The test of this patch set was done by enabling that options and compiling a kernel.

The patch set is also available via git from the largeblock git tree via

git pull
git://git.kernel.org/pub/scm/linux/kernel/git/christoph/largeblocksize.git
vcompound