From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f197.google.com (mail-pf0-f197.google.com [209.85.192.197]) by kanga.kvack.org (Postfix) with ESMTP id 16A126B03A8 for ; Wed, 5 Apr 2017 09:38:13 -0400 (EDT) Received: by mail-pf0-f197.google.com with SMTP id s24so6598285pfk.23 for ; Wed, 05 Apr 2017 06:38:13 -0700 (PDT) Received: from foss.arm.com (foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id t62si20684262pfd.320.2017.04.05.06.38.11 for ; Wed, 05 Apr 2017 06:38:12 -0700 (PDT) From: Punit Agrawal Subject: [PATCH v2 4/9] arm64: hugetlb: Override huge_pte_clear() to support contiguous hugepages Date: Wed, 5 Apr 2017 14:37:17 +0100 Message-Id: <20170405133722.6406-5-punit.agrawal@arm.com> In-Reply-To: <20170405133722.6406-1-punit.agrawal@arm.com> References: <20170405133722.6406-1-punit.agrawal@arm.com> Sender: owner-linux-mm@kvack.org List-ID: To: catalin.marinas@arm.com, will.deacon@arm.com, akpm@linux-foundation.org, mark.rutland@arm.com Cc: Punit Agrawal , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, tbaicar@codeaurora.org, kirill.shutemov@linux.intel.com, mike.kravetz@oracle.com, hillf.zj@alibaba-inc.com, steve.capper@arm.com, David Woods The default huge_pte_clear() implementation does not clear contiguous page table entries when it encounters contiguous hugepages that are supported on arm64. Fix this by overriding the default implementation to clear all the entries associated with contiguous hugepages. Signed-off-by: Punit Agrawal Cc: David Woods --- arch/arm64/mm/hugetlbpage.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c index 009648c4500f..53bda26c6e8f 100644 --- a/arch/arm64/mm/hugetlbpage.c +++ b/arch/arm64/mm/hugetlbpage.c @@ -243,6 +243,22 @@ pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma, return entry; } +void huge_pte_clear(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, unsigned long sz) +{ + int ncontig, i; + size_t pgsize; + + if (sz == PUD_SIZE || sz == PMD_SIZE) { + pte_clear(mm, addr, ptep); + return; + } + + ncontig = find_num_contig(mm, addr, ptep, &pgsize); + for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) + pte_clear(mm, addr, ptep); +} + pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { -- 2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org