• Matthew Wilcox's avatar
    s390: use _refcount for pgtables · 620b4e90
    Matthew Wilcox authored
    Patch series "Rearrange struct page", v6.
    
    As presented at LSFMM, this patch-set rearranges struct page to give
    more contiguous usable space to users who have allocated a struct page
    for their own purposes.  For a graphical view of before-and-after, see
    the first two tabs of
    
      https://docs.google.com/spreadsheets/d/1tvCszs_7FXrjei9_mtFiKV6nW1FLnYyvPvW-qNZhdog/edit?usp=sharing
    
    Highlights:
     - deferred_list now really exists in struct page instead of just a comment.
     - hmm_data also exists in struct page instead of being a nasty hack.
     - x86's PGD pages have a real pointer to the mm_struct.
     - VMalloc pages now have all sorts of extra information stored in them
       to help with debugging and tuning.
     - rcu_head is no longer tied to slab in case anyone else wants to
       free pages by RCU.
     - slub's counters no longer share space with _refcount.
     - slub's freelist+counters are now naturally dword aligned.
     - slub loses a parameter to a lot of functions and a sysfs file.
    
    This patch (of 17):
    
    s390 borrows the storage used for _mapcount in struct page in order to
    account whether the bottom or top half is being used for 2kB page tables.
    I want to use that for something else, so use the top byte of _refcount
    instead of the bottom byte of _mapcount.  _refcount may temporarily be
    incremented by other CPUs that see a stale pointer to this page in the
    page cache, but each CPU can only increment it by one, and there are no
    systems with 2^24 CPUs today, so they will not change the upper byte of
    _refcount.  We do have to be a little careful not to lose any of their
    writes (as they will subsequently decrement the counter).
    
    Link: http://lkml.kernel.org/r/20180518194519.3820-2-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
    Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Lai Jiangshan <jiangshanlai@gmail.com>
    Cc: Pekka Enberg <penberg@kernel.org>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Jérôme Glisse <jglisse@redhat.com>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    620b4e90
pgalloc.c 16.4 KB