rmap: extend try_to_unmap() to be usable by split_huge_page()
Add support for two ttu_flags:
- TTU_SPLIT_HUGE_PMD would split PMD if it's there, before trying to
unmap page;
- TTU_RMAP_LOCKED indicates that caller holds relevant rmap lock;
Also, change rwc->done to !page_mapcount() instead of !page_mapped().
try_to_unmap() works on pte level, so we are really interested in the
mappedness of this small page rather than of the compound page it's a
part of.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b97731992d
commit
2a52bcbcc6
4 changed files with 27 additions and 12 deletions
|
|
@ -106,6 +106,9 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
|
|||
__split_huge_pmd(__vma, __pmd, __address); \
|
||||
} while (0)
|
||||
|
||||
|
||||
void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address);
|
||||
|
||||
#if HPAGE_PMD_ORDER >= MAX_ORDER
|
||||
#error "hugepages can't be allocated by the buddy allocator"
|
||||
#endif
|
||||
|
|
@ -173,6 +176,10 @@ static inline int split_huge_page(struct page *page)
|
|||
static inline void deferred_split_huge_page(struct page *page) {}
|
||||
#define split_huge_pmd(__vma, __pmd, __address) \
|
||||
do { } while (0)
|
||||
|
||||
static inline void split_huge_pmd_address(struct vm_area_struct *vma,
|
||||
unsigned long address) {}
|
||||
|
||||
static inline int hugepage_madvise(struct vm_area_struct *vma,
|
||||
unsigned long *vm_flags, int advice)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ enum ttu_flags {
|
|||
TTU_MIGRATION = 2, /* migration mode */
|
||||
TTU_MUNLOCK = 4, /* munlock mode */
|
||||
TTU_LZFREE = 8, /* lazy free mode */
|
||||
TTU_SPLIT_HUGE_PMD = 16, /* split huge PMD if any */
|
||||
|
||||
TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
|
||||
TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
|
||||
|
|
@ -93,6 +94,8 @@ enum ttu_flags {
|
|||
TTU_BATCH_FLUSH = (1 << 11), /* Batch TLB flushes where possible
|
||||
* and caller guarantees they will
|
||||
* do a final flush if necessary */
|
||||
TTU_RMAP_LOCKED = (1 << 12) /* do not grab rmap lock:
|
||||
* caller holds it */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue