• Hugh Dickins's avatar
    [PATCH] compound page: use page[1].lru · 41d78ba5
    Hugh Dickins authored
    If a compound page has its own put_page_testzero destructor (the only current
    example is free_huge_page), that is noted in page[1].mapping of the compound
    page.  But that's rather a poor place to keep it: functions which call
    set_page_dirty_lock after get_user_pages (e.g.  Infiniband's
    __ib_umem_release) ought to be checking first, otherwise set_page_dirty is
    liable to crash on what's not the address of a struct address_space.
    
    And now I'm about to make that worse: it turns out that every compound page
    needs a destructor, so we can no longer rely on hugetlb pages going their own
    special way, to avoid further problems of page->mapping reuse.  For example,
    not many people know that: on 50% of i386 -Os builds, the first tail page of a
    compound page purports to be PageAnon (when its destructor has an odd
    address), which surprises page_add_file_rmap.
    
    Keep the compound page destructor in page[1].lru.next instead.  And to free up
    the common pairing of mapping and index, also move compound page order from
    index to lru.prev.  Slab reuses page->lru too: but if we ever need slab to use
    compound pages, it can easily stack its use above this.
    
    (akpm: decoded version of the above: the tail pages of a compound page now
    have ->mapping==NULL, so there's no need for the set_page_dirty[_lock]()
    caller to check that they're not compund pages before doing the dirty).
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    41d78ba5
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
bootmem.c Loading commit data...
fadvise.c Loading commit data...
filemap.c Loading commit data...
filemap.h Loading commit data...
filemap_xip.c Loading commit data...
fremap.c Loading commit data...
highmem.c Loading commit data...
hugetlb.c Loading commit data...
internal.h Loading commit data...
madvise.c Loading commit data...
memory.c Loading commit data...
memory_hotplug.c Loading commit data...
mempolicy.c Loading commit data...
mempool.c Loading commit data...
mincore.c Loading commit data...
mlock.c Loading commit data...
mmap.c Loading commit data...
mprotect.c Loading commit data...
mremap.c Loading commit data...
msync.c Loading commit data...
nommu.c Loading commit data...
oom_kill.c Loading commit data...
page-writeback.c Loading commit data...
page_alloc.c Loading commit data...
page_io.c Loading commit data...
pdflush.c Loading commit data...
prio_tree.c Loading commit data...
readahead.c Loading commit data...
rmap.c Loading commit data...
shmem.c Loading commit data...
slab.c Loading commit data...
slob.c Loading commit data...
sparse.c Loading commit data...
swap.c Loading commit data...
swap_state.c Loading commit data...
swapfile.c Loading commit data...
thrash.c Loading commit data...
tiny-shmem.c Loading commit data...
truncate.c Loading commit data...
util.c Loading commit data...
vmalloc.c Loading commit data...
vmscan.c Loading commit data...