* + hugetlb-only-set-hpagemigratable-for-migratable-hstates.patch added to -mm tree
@ 2021-01-24 1:32 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2021-01-24 1:32 UTC (permalink / raw)
To: david, linmiaohe, mhocko, mike.kravetz, mm-commits, n-horiguchi,
osalvador, songmuchun, willy
The patch titled
Subject: hugetlb: only set HPageMigratable for migratable hstates
has been added to the -mm tree. Its filename is
hugetlb-only-set-hpagemigratable-for-migratable-hstates.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/hugetlb-only-set-hpagemigratable-for-migratable-hstates.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/hugetlb-only-set-hpagemigratable-for-migratable-hstates.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Mike Kravetz <mike.kravetz@oracle.com>
Subject: hugetlb: only set HPageMigratable for migratable hstates
The HP_Migratable flag indicates a page is a candidate for migration.
Only set the flag if the page's hstate supports migration. This allows
the migration paths to detect non-migratable pages earlier. If migration
is not supported for the hstate, HP_Migratable will not be set, the page
will not be isolated and no attempt will be made to migrate. We should
never get to unmap_and_move_huge_page for a page where migration is not
supported, so throw a warning if we do.
Link: https://lkml.kernel.org/r/20210122195231.324857-4-mike.kravetz@oracle.com
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/hugetlbfs/inode.c | 2 +-
include/linux/hugetlb.h | 9 +++++++++
mm/hugetlb.c | 8 ++++----
mm/migrate.c | 9 ++++-----
4 files changed, 18 insertions(+), 10 deletions(-)
--- a/fs/hugetlbfs/inode.c~hugetlb-only-set-hpagemigratable-for-migratable-hstates
+++ a/fs/hugetlbfs/inode.c
@@ -735,7 +735,7 @@ static long hugetlbfs_fallocate(struct f
mutex_unlock(&hugetlb_fault_mutex_table[hash]);
- SetHPageMigratable(page);
+ SetHPageMigratableIfSupported(page);
/*
* unlock_page because locked by add_to_page_cache()
* put_page() due to reference from alloc_huge_page()
--- a/include/linux/hugetlb.h~hugetlb-only-set-hpagemigratable-for-migratable-hstates
+++ a/include/linux/hugetlb.h
@@ -741,6 +741,15 @@ static inline bool hugepage_migration_su
}
/*
+ * Only set HPageMigratable if migration supported for page
+ */
+static inline void SetHPageMigratableIfSupported(struct page *page)
+{
+ if (hugepage_migration_supported(page_hstate(page)))
+ SetHPageMigratable(page);
+}
+
+/*
* Movability check is different as compared to migration check.
* It determines whether or not a huge page should be placed on
* movable zone or not. Movability of any huge page should be
--- a/mm/hugetlb.c~hugetlb-only-set-hpagemigratable-for-migratable-hstates
+++ a/mm/hugetlb.c
@@ -4199,7 +4199,7 @@ retry_avoidcopy:
make_huge_pte(vma, new_page, 1));
page_remove_rmap(old_page, true);
hugepage_add_new_anon_rmap(new_page, vma, haddr);
- SetHPageMigratable(new_page);
+ SetHPageMigratableIfSupported(new_page);
/* Make the old page be freed below */
new_page = old_page;
}
@@ -4441,7 +4441,7 @@ retry:
* been isolated for migration.
*/
if (new_page)
- SetHPageMigratable(page);
+ SetHPageMigratableIfSupported(page);
unlock_page(page);
out:
@@ -4752,7 +4752,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_s
update_mmu_cache(dst_vma, dst_addr, dst_pte);
spin_unlock(ptl);
- SetHPageMigratable(page);
+ SetHPageMigratableIfSupported(page);
if (vm_shared)
unlock_page(page);
ret = 0;
@@ -5596,7 +5596,7 @@ void putback_active_hugepage(struct page
{
VM_BUG_ON_PAGE(!PageHead(page), page);
spin_lock(&hugetlb_lock);
- SetHPageMigratable(page);
+ SetHPageMigratableIfSupported(page);
list_move_tail(&page->lru, &(page_hstate(page))->hugepage_activelist);
spin_unlock(&hugetlb_lock);
put_page(page);
--- a/mm/migrate.c~hugetlb-only-set-hpagemigratable-for-migratable-hstates
+++ a/mm/migrate.c
@@ -1275,13 +1275,12 @@ static int unmap_and_move_huge_page(new_
struct address_space *mapping = NULL;
/*
- * Migratability of hugepages depends on architectures and their size.
- * This check is necessary because some callers of hugepage migration
- * like soft offline and memory hotremove don't walk through page
- * tables or check whether the hugepage is pmd-based or not before
- * kicking migration.
+ * Support for migration should be checked at isolation time.
+ * Therefore, we should never get here if migration is not supported
+ * for the page.
*/
if (!hugepage_migration_supported(page_hstate(hpage))) {
+ VM_WARN_ON(1);
list_move_tail(&hpage->lru, ret);
return -ENOSYS;
}
_
Patches currently in -mm which might be from mike.kravetz@oracle.com are
hugetlb-use-pageprivate-for-hugetlb-specific-page-flags.patch
hugetlb-convert-page_huge_active-hpagemigratable-flag.patch
hugetlb-only-set-hpagemigratable-for-migratable-hstates.patch
hugetlb-convert-pagehugetemporary-to-hpagetemporary-flag.patch
hugetlb-convert-pagehugefreed-to-hpagefreed-flag.patch
mm-hugetlb-change-hugetlb_reserve_pages-to-type-bool.patch
hugetlbfs-remove-special-hugetlbfs_set_page_dirty.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-24 1:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-24 1:32 + hugetlb-only-set-hpagemigratable-for-migratable-hstates.patch added to -mm tree akpm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).