• Zach O'Keefe's avatar
    mm/khugepaged: add flag to predicate khugepaged-only behavior · d8ea7cc8
    Zach O'Keefe authored
    Add .is_khugepaged flag to struct collapse_control so khugepaged-specific
    behavior can be elided by MADV_COLLAPSE context.
    
    Start by protecting khugepaged-specific heuristics by this flag.  In
    MADV_COLLAPSE, the user presumably has reason to believe the collapse will
    be beneficial and khugepaged heuristics shouldn't prevent the user from
    doing so:
    
    1) sysfs-controlled knobs khugepaged_max_ptes_[none|swap|shared]
    
    2) requirement that some pages in region being collapsed be young or
       referenced
    
    [zokeefe@google.com: consistently order cc->is_khugepaged and pte_* checks]
      Link: https://lkml.kernel.org/r/20220720140603.1958773-3-zokeefe@google.com
      Link: https://lore.kernel.org/linux-mm/Ys2qJm6FaOQcxkha@google.com/
    Link: https://lkml.kernel.org/r/20220706235936.2197195-7-zokeefe@google.comSigned-off-by: default avatarZach O'Keefe <zokeefe@google.com>
    Reviewed-by: default avatarYang Shi <shy828301@gmail.com>
    Cc: Alex Shi <alex.shi@linux.alibaba.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Axel Rasmussen <axelrasmussen@google.com>
    Cc: Chris Kennelly <ckennelly@google.com>
    Cc: Chris Zankel <chris@zankel.net>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Helge Deller <deller@gmx.de>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
    Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Matt Turner <mattst88@gmail.com>
    Cc: Max Filippov <jcmvbkbc@gmail.com>
    Cc: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
    Cc: Pavel Begunkov <asml.silence@gmail.com>
    Cc: Peter Xu <peterx@redhat.com>
    Cc: Rongwei Wang <rongwei.wang@linux.alibaba.com>
    Cc: SeongJae Park <sj@kernel.org>
    Cc: Song Liu <songliubraving@fb.com>
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Zi Yan <ziy@nvidia.com>
    Cc: Dan Carpenter <dan.carpenter@oracle.com>
    Cc: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    d8ea7cc8
khugepaged.c 58.8 KB