From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933906AbdEVN7s (ORCPT ); Mon, 22 May 2017 09:59:48 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:36645 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933885AbdEVN7o (ORCPT ); Mon, 22 May 2017 09:59:44 -0400 MIME-Version: 1.0 In-Reply-To: <20170522133604.11392-5-punit.agrawal@arm.com> References: <20170522133604.11392-1-punit.agrawal@arm.com> <20170522133604.11392-5-punit.agrawal@arm.com> From: Arnd Bergmann Date: Mon, 22 May 2017 15:59:43 +0200 X-Google-Sender-Auth: tF27Pwvc8o2Dj5ZQ6JtpjIc8lFc Message-ID: Subject: Re: [PATCH v3 4/6] mm/hugetlb: Allow architectures to override huge_pte_clear() To: Punit Agrawal Cc: Andrew Morton , Linux-MM , Linux Kernel Mailing List , Linux ARM , Catalin Marinas , Will Deacon , n-horiguchi@ah.jp.nec.com, "Kirill A . Shutemov" , mike.kravetz@oracle.com, steve.capper@arm.com, Mark Rutland , Hillf Danton , linux-arch , "Aneesh Kumar K.V" , Martin Schwidefsky , Heiko Carstens Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 22, 2017 at 3:36 PM, Punit Agrawal wrote: > diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h > index 99b490b4d05a..3138e126f43b 100644 > --- a/include/asm-generic/hugetlb.h > +++ b/include/asm-generic/hugetlb.h > @@ -31,10 +31,7 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) > return pte_modify(pte, newprot); > } > > -static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, > - pte_t *ptep) > -{ > - pte_clear(mm, addr, ptep); > -} > +void huge_pte_clear(struct mm_struct *mm, unsigned long addr, > + pte_t *ptep, unsigned long sz); > > #endif /* _ASM_GENERIC_HUGETLB_H */ > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 0e4d1fb3122f..2b0f6f96f2c1 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -3289,6 +3289,12 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, > return ret; > } > > +void __weak huge_pte_clear(struct mm_struct *mm, unsigned long addr, > + pte_t *ptep, unsigned long sz) > +{ > + pte_clear(mm, addr, ptep); > +} > + > void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, > unsigned long start, unsigned long end, > struct page *ref_page) I don't really like how this moves the inline version from asm-generic into a __weak function here. I think it would be better to either stop using asm-generic/hugetlb.h on s390, or enclose the generic definition in #ifndef huge_pte_clear and then override by defining a macro in s390 as we do in other files in asm-generic. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH v3 4/6] mm/hugetlb: Allow architectures to override huge_pte_clear() Date: Mon, 22 May 2017 15:59:43 +0200 Message-ID: References: <20170522133604.11392-1-punit.agrawal@arm.com> <20170522133604.11392-5-punit.agrawal@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: <20170522133604.11392-5-punit.agrawal@arm.com> Sender: owner-linux-mm@kvack.org To: Punit Agrawal Cc: Andrew Morton , Linux-MM , Linux Kernel Mailing List , Linux ARM , Catalin Marinas , Will Deacon , n-horiguchi@ah.jp.nec.com, "Kirill A . Shutemov" , mike.kravetz@oracle.com, steve.capper@arm.com, Mark Rutland , Hillf Danton , linux-arch , "Aneesh Kumar K.V" , Martin Schwidefsky , Heiko Carstens List-Id: linux-arch.vger.kernel.org On Mon, May 22, 2017 at 3:36 PM, Punit Agrawal wrote: > diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h > index 99b490b4d05a..3138e126f43b 100644 > --- a/include/asm-generic/hugetlb.h > +++ b/include/asm-generic/hugetlb.h > @@ -31,10 +31,7 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) > return pte_modify(pte, newprot); > } > > -static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, > - pte_t *ptep) > -{ > - pte_clear(mm, addr, ptep); > -} > +void huge_pte_clear(struct mm_struct *mm, unsigned long addr, > + pte_t *ptep, unsigned long sz); > > #endif /* _ASM_GENERIC_HUGETLB_H */ > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 0e4d1fb3122f..2b0f6f96f2c1 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -3289,6 +3289,12 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, > return ret; > } > > +void __weak huge_pte_clear(struct mm_struct *mm, unsigned long addr, > + pte_t *ptep, unsigned long sz) > +{ > + pte_clear(mm, addr, ptep); > +} > + > void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, > unsigned long start, unsigned long end, > struct page *ref_page) I don't really like how this moves the inline version from asm-generic into a __weak function here. I think it would be better to either stop using asm-generic/hugetlb.h on s390, or enclose the generic definition in #ifndef huge_pte_clear and then override by defining a macro in s390 as we do in other files in asm-generic. Arnd -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Mon, 22 May 2017 15:59:43 +0200 Subject: [PATCH v3 4/6] mm/hugetlb: Allow architectures to override huge_pte_clear() In-Reply-To: <20170522133604.11392-5-punit.agrawal@arm.com> References: <20170522133604.11392-1-punit.agrawal@arm.com> <20170522133604.11392-5-punit.agrawal@arm.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, May 22, 2017 at 3:36 PM, Punit Agrawal wrote: > diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h > index 99b490b4d05a..3138e126f43b 100644 > --- a/include/asm-generic/hugetlb.h > +++ b/include/asm-generic/hugetlb.h > @@ -31,10 +31,7 @@ static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) > return pte_modify(pte, newprot); > } > > -static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, > - pte_t *ptep) > -{ > - pte_clear(mm, addr, ptep); > -} > +void huge_pte_clear(struct mm_struct *mm, unsigned long addr, > + pte_t *ptep, unsigned long sz); > > #endif /* _ASM_GENERIC_HUGETLB_H */ > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 0e4d1fb3122f..2b0f6f96f2c1 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -3289,6 +3289,12 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, > return ret; > } > > +void __weak huge_pte_clear(struct mm_struct *mm, unsigned long addr, > + pte_t *ptep, unsigned long sz) > +{ > + pte_clear(mm, addr, ptep); > +} > + > void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma, > unsigned long start, unsigned long end, > struct page *ref_page) I don't really like how this moves the inline version from asm-generic into a __weak function here. I think it would be better to either stop using asm-generic/hugetlb.h on s390, or enclose the generic definition in #ifndef huge_pte_clear and then override by defining a macro in s390 as we do in other files in asm-generic. Arnd