From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761381AbdEWF0q (ORCPT ); Tue, 23 May 2017 01:26:46 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58711 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751824AbdEWF0n (ORCPT ); Tue, 23 May 2017 01:26:43 -0400 Date: Tue, 23 May 2017 07:26:29 +0200 From: Martin Schwidefsky To: Punit Agrawal Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, n-horiguchi@ah.jp.nec.com, kirill.shutemov@linux.intel.com, mike.kravetz@oracle.com, steve.capper@arm.com, mark.rutland@arm.com, linux-arch@vger.kernel.org, aneesh.kumar@linux.vnet.ibm.com, Heiko Carstens , Arnd Bergmann Subject: Re: [PATCH v3.1 4/6] mm/hugetlb: Allow architectures to override huge_pte_clear() In-Reply-To: <20170522162555.4313-1-punit.agrawal@arm.com> References: <20170522133604.11392-5-punit.agrawal@arm.com> <20170522162555.4313-1-punit.agrawal@arm.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17052305-0016-0000-0000-000004A6F93B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052305-0017-0000-0000-000027C616A9 Message-Id: <20170523072629.06163fa6@mschwideX1> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-23_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705230027 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 22 May 2017 17:25:55 +0100 Punit Agrawal wrote: > When unmapping a hugepage range, huge_pte_clear() is used to clear the > page table entries that are marked as not present. huge_pte_clear() > internally just ends up calling pte_clear() which does not correctly > deal with hugepages consisting of contiguous page table entries. > > Add a size argument to address this issue and allow architectures to > override huge_pte_clear() by wrapping it in a #ifndef block. > > Update s390 implementation with the size parameter as well. > > Note that the change only affects huge_pte_clear() - the other generic > hugetlb functions don't need any change. > > Signed-off-by: Punit Agrawal > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: Arnd Bergmann > Cc: "Aneesh Kumar K.V" > Cc: Mike Kravetz > --- > > Changes since v3 > > * Drop weak function and use #ifndef block to allow architecture override > * Drop unnecessary move of s390 function definition > > arch/s390/include/asm/hugetlb.h | 2 +- > include/asm-generic/hugetlb.h | 4 +++- > mm/hugetlb.c | 2 +- > 3 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h > index cd546a245c68..c0443500baec 100644 > --- a/arch/s390/include/asm/hugetlb.h > +++ b/arch/s390/include/asm/hugetlb.h > @@ -39,7 +39,7 @@ static inline int prepare_hugepage_range(struct file *file, > #define arch_clear_hugepage_flags(page) do { } while (0) > > static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, > - pte_t *ptep) > + pte_t *ptep, unsigned long sz) > { > if ((pte_val(*ptep) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3) > pte_val(*ptep) = _REGION3_ENTRY_EMPTY; For the nop-change for s390: Acked-by: Martin Schwidefsky -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Schwidefsky Subject: Re: [PATCH v3.1 4/6] mm/hugetlb: Allow architectures to override huge_pte_clear() Date: Tue, 23 May 2017 07:26:29 +0200 Message-ID: <20170523072629.06163fa6@mschwideX1> References: <20170522133604.11392-5-punit.agrawal@arm.com> <20170522162555.4313-1-punit.agrawal@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170522162555.4313-1-punit.agrawal@arm.com> Sender: owner-linux-mm@kvack.org To: Punit Agrawal Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, n-horiguchi@ah.jp.nec.com, kirill.shutemov@linux.intel.com, mike.kravetz@oracle.com, steve.capper@arm.com, mark.rutland@arm.com, linux-arch@vger.kernel.org, aneesh.kumar@linux.vnet.ibm.com, Heiko Carstens , Arnd Bergmann List-Id: linux-arch.vger.kernel.org On Mon, 22 May 2017 17:25:55 +0100 Punit Agrawal wrote: > When unmapping a hugepage range, huge_pte_clear() is used to clear the > page table entries that are marked as not present. huge_pte_clear() > internally just ends up calling pte_clear() which does not correctly > deal with hugepages consisting of contiguous page table entries. > > Add a size argument to address this issue and allow architectures to > override huge_pte_clear() by wrapping it in a #ifndef block. > > Update s390 implementation with the size parameter as well. > > Note that the change only affects huge_pte_clear() - the other generic > hugetlb functions don't need any change. > > Signed-off-by: Punit Agrawal > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: Arnd Bergmann > Cc: "Aneesh Kumar K.V" > Cc: Mike Kravetz > --- > > Changes since v3 > > * Drop weak function and use #ifndef block to allow architecture override > * Drop unnecessary move of s390 function definition > > arch/s390/include/asm/hugetlb.h | 2 +- > include/asm-generic/hugetlb.h | 4 +++- > mm/hugetlb.c | 2 +- > 3 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h > index cd546a245c68..c0443500baec 100644 > --- a/arch/s390/include/asm/hugetlb.h > +++ b/arch/s390/include/asm/hugetlb.h > @@ -39,7 +39,7 @@ static inline int prepare_hugepage_range(struct file *file, > #define arch_clear_hugepage_flags(page) do { } while (0) > > static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, > - pte_t *ptep) > + pte_t *ptep, unsigned long sz) > { > if ((pte_val(*ptep) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3) > pte_val(*ptep) = _REGION3_ENTRY_EMPTY; For the nop-change for s390: Acked-by: Martin Schwidefsky -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- 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: schwidefsky@de.ibm.com (Martin Schwidefsky) Date: Tue, 23 May 2017 07:26:29 +0200 Subject: [PATCH v3.1 4/6] mm/hugetlb: Allow architectures to override huge_pte_clear() In-Reply-To: <20170522162555.4313-1-punit.agrawal@arm.com> References: <20170522133604.11392-5-punit.agrawal@arm.com> <20170522162555.4313-1-punit.agrawal@arm.com> Message-ID: <20170523072629.06163fa6@mschwideX1> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, 22 May 2017 17:25:55 +0100 Punit Agrawal wrote: > When unmapping a hugepage range, huge_pte_clear() is used to clear the > page table entries that are marked as not present. huge_pte_clear() > internally just ends up calling pte_clear() which does not correctly > deal with hugepages consisting of contiguous page table entries. > > Add a size argument to address this issue and allow architectures to > override huge_pte_clear() by wrapping it in a #ifndef block. > > Update s390 implementation with the size parameter as well. > > Note that the change only affects huge_pte_clear() - the other generic > hugetlb functions don't need any change. > > Signed-off-by: Punit Agrawal > Cc: Martin Schwidefsky > Cc: Heiko Carstens > Cc: Arnd Bergmann > Cc: "Aneesh Kumar K.V" > Cc: Mike Kravetz > --- > > Changes since v3 > > * Drop weak function and use #ifndef block to allow architecture override > * Drop unnecessary move of s390 function definition > > arch/s390/include/asm/hugetlb.h | 2 +- > include/asm-generic/hugetlb.h | 4 +++- > mm/hugetlb.c | 2 +- > 3 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h > index cd546a245c68..c0443500baec 100644 > --- a/arch/s390/include/asm/hugetlb.h > +++ b/arch/s390/include/asm/hugetlb.h > @@ -39,7 +39,7 @@ static inline int prepare_hugepage_range(struct file *file, > #define arch_clear_hugepage_flags(page) do { } while (0) > > static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, > - pte_t *ptep) > + pte_t *ptep, unsigned long sz) > { > if ((pte_val(*ptep) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3) > pte_val(*ptep) = _REGION3_ENTRY_EMPTY; For the nop-change for s390: Acked-by: Martin Schwidefsky -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.