mm: hugetlb: kill set_huge_swap_pte_at()
authorQi Zheng <zhengqi.arch@bytedance.com>
Sun, 26 Jun 2022 14:57:17 +0000 (22:57 +0800)
committerakpm <akpm@linux-foundation.org>
Mon, 4 Jul 2022 01:08:50 +0000 (18:08 -0700)
commit18f3962953e40401b7ed98e8524167282c3e626e
tree3188a794c7eb410b550c04531a51ec163911fab1
parentade63b419c4e8d27f0642804b6c8c7a76ffc18ac
mm: hugetlb: kill set_huge_swap_pte_at()

Commit e5251fd43007 ("mm/hugetlb: introduce set_huge_swap_pte_at()
helper") add set_huge_swap_pte_at() to handle swap entries on
architectures that support hugepages consisting of contiguous ptes.  And
currently the set_huge_swap_pte_at() is only overridden by arm64.

set_huge_swap_pte_at() provide a sz parameter to help determine the number
of entries to be updated.  But in fact, all hugetlb swap entries contain
pfn information, so we can find the corresponding folio through the pfn
recorded in the swap entry, then the folio_size() is the number of entries
that need to be updated.

And considering that users will easily cause bugs by ignoring the
difference between set_huge_swap_pte_at() and set_huge_pte_at().  Let's
handle swap entries in set_huge_pte_at() and remove the
set_huge_swap_pte_at(), then we can call set_huge_pte_at() anywhere, which
simplifies our coding.

Link: https://lkml.kernel.org/r/20220626145717.53572-1-zhengqi.arch@bytedance.com
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Acked-by: Muchun Song <songmuchun@bytedance.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/arm64/include/asm/hugetlb.h
arch/arm64/mm/hugetlbpage.c
include/linux/hugetlb.h
mm/hugetlb.c
mm/rmap.c