summaryrefslogtreecommitdiffstats
path: root/mm/huge_memory.c
diff options
context:
space:
mode:
authorZi Yan <ziy@nvidia.com>2024-07-24 15:01:14 +0200
committerAndrew Morton <akpm@linux-foundation.org>2024-09-02 05:25:47 +0200
commit2a28713a67fd28eedc13b32300df6b9c5a2381f5 (patch)
treeb99b41c1317c28193490fe09ecbb5863edd34140 /mm/huge_memory.c
parentmemory tiering: read last_cpupid correctly in do_huge_pmd_numa_page() (diff)
downloadlinux-2a28713a67fd28eedc13b32300df6b9c5a2381f5.tar.xz
linux-2a28713a67fd28eedc13b32300df6b9c5a2381f5.zip
memory tiering: introduce folio_use_access_time() check
If memory tiering mode is on and a folio is not in the top tier memory, folio's cpupid field is repurposed to store page access time. Instead of an open coded check, use a function to encapsulate the check. Link: https://lkml.kernel.org/r/20240724130115.793641-3-ziy@nvidia.com Signed-off-by: Zi Yan <ziy@nvidia.com> Reviewed-by: "Huang, Ying" <ying.huang@intel.com> Acked-by: David Hildenbrand <david@redhat.com> Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/huge_memory.c')
-rw-r--r--mm/huge_memory.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 632a92edec4e..29e76d285e4b 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1707,8 +1707,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf)
* For memory tiering mode, cpupid of slow memory page is used
* to record page access time. So use default value.
*/
- if (!(sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) ||
- node_is_toptier(nid))
+ if (!folio_use_access_time(folio))
last_cpupid = folio_last_cpupid(folio);
target_nid = numa_migrate_prep(folio, vmf, haddr, nid, &flags);
if (target_nid == NUMA_NO_NODE)
@@ -2058,8 +2057,7 @@ int change_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
toptier)
goto unlock;
- if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING &&
- !toptier)
+ if (folio_use_access_time(folio))
folio_xchg_access_time(folio,
jiffies_to_msecs(jiffies));
}