Skip to content

RFC Variable Order Page Cache

Christoph Lameter lkml 1 version In review

Get series with b4
b4 am 20070419163504.11948.58487.sendpatchset@schroedinger.engr.sgi.com

Versions newest first

  1. v1 RFC Latest8 patches 49 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8Add order field to address_space structfs/inode.c include/linux/fs.h+2 -00 replies
2/8Basic allocation for higher order page cache pagesinclude/linux/pagemap.h mm/filemap.c+14 -101 reply
3/8Flushing and zeroing higher order page cache pagesinclude/linux/pagemap.h+27 -03 replies
4/8Enhance fallback functions in libs to support higher order pagesfs/libfs.c+10 -612 replies
5/8Enhance generic_read/write to support higher order pagesmm/filemap.c+32 -310 replies
6/8Account for pages in the page cache in terms of base pagesmm/filemap.c+4 -23 replies
7/8Enhance ramfs to support higher order pagesfs/ramfs/file-mmu.c fs/ramfs/inode.c include/linux/ramfs.h+24 -312 replies
8/8Add some debug outputfs/ramfs/inode.c mm/filemap.c+9 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC 0/8] Variable Order Page Cache

Variable Order Page Cache Patchset

This patchset modifies the core VM so that higher order page cache pages become possible. The higher order page cache pages are compound pages and can be handled in the same way as regular pages.

The order of the pages is determined by the order set up in the mapping (struct address_space). By default the order is set to zero. This means that higher order pages are optional. There is no attempt here to generally change the page order of the page cache. 4K pages are effective for small files.

However, it would be good if the VM would support I/O to higher order pages to enable efficient support for large scale I/O. If one wants to write a long file of a few gigabytes then the filesystem should have a choice of selecting a larger page size for that file and handle larger chunks of memory at once.

The support here is only for buffered I/O and only for one filesystem (ramfs). Modification of other filesystems to support higher order pages may require extensive work of other components of the kernel. But I hope this shows that there is a relatively easy way to that goal that could be taken in steps..

Note that the higher order pages are subject to reclaim. This works in general since we are always operating on a single page struct. Reclaim is fooled to think that it is touching page sized objects (there are likely issues to be fixed there if we want to go down this road).

What is currently not supported:
- Buffer heads for higher order pages (possible with the compound pages in mm that do not use page->private requires upgrade of the buffer cache layers).
- Higher order pages in the block layer etc.
- Mmapping higher order pages

Note that this is proof-of-concept. Lots of functionality is missing and various issues have not been dealt with. Use of higher order pages may cause memory fragmentation. Mel Gorman's anti-fragmentation work is probably essential if we want to do this. We likely need actual defragmentation support.

The main point of this patchset is to demonstrates that it is basically possible to have higher order support with straightforward changes to the VM.

The ramfs driver can be used to test higher order page cache functionality (and may help troubleshoot the VM support until we get some real filesystem and real devices supporting higher order pages).

If you apply this patch and then you can f.e. try this:

mount -tramfs -o10 none /media

Mounts a ramfs filesystem with order 10 pages (4 MB)

cp linux-2.6.21-rc7.tar.gz /media

	Populate the ramfs. Note that we allocate 14 pages of 4M each
	instead of 13508..

umount /media

Gets rid of the large pages again

Comments appreciated.