mm-migrate-move-common-code-to-numa_migrate_check-was-numa_migrate_prep.patch removed from -mm tree
The quilt patch titled
Subject: mm/migrate: move common code to numa_migrate_check (was numa_migrate_prep)
has been removed from the -mm tree. Its filename was
mm-migrate-move-common-code-to-numa_migrate_check-was-numa_migrate_prep.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Zi Yan <[email protected]>
Subject: mm/migrate: move common code to numa_migrate_check (was numa_migrate_prep)
Date: Fri, 9 Aug 2024 10:59:06 -0400
do_numa_page() and do_huge_pmd_numa_page() share a lot of common code. To reduce redundancy, move common code to numa_migrate_prep() and rename the function to numa_migrate_check() to reflect its functionality.
Now do_huge_pmd_numa_page() also checks shared folios to set TNF_SHARED flag.
---
mm/huge_memory.c | 29 +++++++------------- mm/internal.h | 5 ++- mm/memory.c | 63 +++++++++++++++++++++++---------------------- 3 files changed, 47 insertions(+), 50 deletions(-)
mm/huge_memory.c renamed from mm/huge_memory.c~mm-migrate-move-common-code-to-numa_migrate_check-was-numa_migrate_prep +11 -18
@@ -1669,22 +1669,23 @@ static inline bool can_change_pmd_writabvm_fault_t do_huge_pmd_numa_page (struct vm_fault *vmf) {struct vm_area_struct *vma = vmf->vma; -pmd_t oldpmd = vmf->orig_pmd; -pmd_t pmd;struct folio *folio;unsigned long haddr = vmf->address &HPAGE_PMD_MASK ;int nid =NUMA_NO_NODE ; -int target_nid, last_cpupid = (-1 &LAST_CPUPID_MASK ); +int target_nid, last_cpupid; +pmd_t pmd, old_pmd;bool writable = false;int flags =0 ; vmf->ptl =pmd_lock (vma->vm_mm, vmf->pmd); -if (unlikely (!pmd_same (oldpmd, *vmf->pmd))) { + old_pmd =pmdp_get (vmf->pmd); + +if (unlikely (!pmd_same (old_pmd, vmf->orig_pmd))) {spin_unlock (vmf->ptl);return 0 ; } - pmd =pmd_modify (oldpmd, vma->vm_page_prot); + pmd =pmd_modify (old_pmd, vma->vm_page_prot);/* * Detect now whether the PMD could be writable; this information
@@ -1699,18 +1700,10 @@ vm_fault_t do_huge_pmd_numa_page(structif (!folio) goto out_map; -/* See similar comment in do_numa_page for explanation */ -if (!writable) - flags |=TNF_NO_GROUP ; - nid =folio_nid (folio); -/* -* For memory tiering mode, cpupid of slow memory page is used -* to record page access time. So use default value. -*/ -if (!folio_use_access_time (folio)) - last_cpupid =folio_last_cpupid (folio); - target_nid =numa_migrate_prep (folio, vmf, haddr, nid, &flags); + + target_nid =numa_migrate_check (folio, vmf, haddr, &flags, writable, + &last_cpupid);if (target_nid ==NUMA_NO_NODE ) goto out_map;if (migrate_misplaced_folio_prepare (folio, vma, target_nid)) {
@@ -1730,13 +1723,13 @@ vm_fault_t do_huge_pmd_numa_page(struct flags |=TNF_MIGRATE_FAIL ; vmf->ptl =pmd_lock (vma->vm_mm, vmf->pmd); -if (unlikely (!pmd_same (oldpmd, *vmf->pmd))) { +if (unlikely (!pmd_same (pmdp_get (vmf->pmd), vmf->orig_pmd))) {spin_unlock (vmf->ptl);return 0 ; } out_map:/* Restore the PMD */ - pmd =pmd_modify (oldpmd, vma->vm_page_prot); + pmd =pmd_modify (pmdp_get (vmf->pmd), vma->vm_page_prot); pmd =pmd_mkyoung (pmd);if (writable) pmd =pmd_mkwrite (pmd, vma);
mm/internal.h renamed from mm/internal.h~mm-migrate-move-common-code-to-numa_migrate_check-was-numa_migrate_prep +3 -2
@@ -1191,8 +1191,9 @@ void vunmap_range_noflush(unsigned longvoid __vunmap_range_noflush (unsigned long start,unsigned long end); -int numa_migrate_prep (struct folio *folio,struct vm_fault *vmf, -unsigned long addr,int page_nid,int *flags); +int numa_migrate_check (struct folio *folio,struct vm_fault *vmf, +unsigned long addr,int *flags,bool writable, +int *last_cpupid);void free_zone_device_folio (struct folio *folio);int migrate_device_coherent_page (struct page *page);
mm/memory.c renamed from mm/memory.c~mm-migrate-move-common-code-to-numa_migrate_check-was-numa_migrate_prep +33 -30
84 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are