From: Steve Capper Date: Tue, 22 Aug 2017 10:42:41 +0000 (+0100) Subject: arm64: hugetlb: set_huge_pte_at Add WARN_ON on !pte_present X-Git-Tag: v4.14-rc1~151^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d3ea79527757ba65b3ee08e10c59a3c84f34e4bf;p=thirdparty%2Flinux.git arm64: hugetlb: set_huge_pte_at Add WARN_ON on !pte_present This patch adds a WARN_ON to set_huge_pte_at as the accessor assumes that entries to be written down are all present. (There are separate accessors to clear huge ptes). We will need to handle the !pte_present case where memory offlining is used on hugetlb pages. swap and migration entries will be supplied to set_huge_pte_at in this case. Cc: David Woods Signed-off-by: Steve Capper Signed-off-by: Punit Agrawal Signed-off-by: Catalin Marinas --- diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c index 656e0ece22894..7b61e48334323 100644 --- a/arch/arm64/mm/hugetlbpage.c +++ b/arch/arm64/mm/hugetlbpage.c @@ -67,6 +67,12 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, unsigned long pfn; pgprot_t hugeprot; + /* + * Code needs to be expanded to handle huge swap and migration + * entries. Needed for HUGETLB and MEMORY_FAILURE. + */ + WARN_ON(!pte_present(pte)); + if (!pte_cont(pte)) { set_pte_at(mm, addr, ptep, pte); return;