From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 719C3C433F5 for ; Wed, 2 Feb 2022 09:38:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D985D6B0205; Wed, 2 Feb 2022 04:38:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D47146B0206; Wed, 2 Feb 2022 04:38:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C36678D00DD; Wed, 2 Feb 2022 04:38:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id B38626B0205 for ; Wed, 2 Feb 2022 04:38:58 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 71360181B048C for ; Wed, 2 Feb 2022 09:38:58 +0000 (UTC) X-FDA: 79097340756.04.FB8F09A Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf25.hostedemail.com (Postfix) with ESMTP id AA1A0A0004 for ; Wed, 2 Feb 2022 09:38:57 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E7BA61FB; Wed, 2 Feb 2022 01:38:56 -0800 (PST) Received: from [10.163.43.221] (unknown [10.163.43.221]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 202483F40C; Wed, 2 Feb 2022 01:38:52 -0800 (PST) Subject: Re: [PATCH] mm: Merge pte_mkhuge() call into arch_make_huge_pte() To: Christophe Leroy , "linux-mm@kvack.org" Cc: Catalin Marinas , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" , Paul Mackerras , "sparclinux@vger.kernel.org" , Andrew Morton , Will Deacon , "David S. Miller" , "linux-arm-kernel@lists.infradead.org" , Mike Kravetz References: <1643780286-18798-1-git-send-email-anshuman.khandual@arm.com> From: Anshuman Khandual Message-ID: <59ec5352-77eb-4c95-731e-100bcfa7003a@arm.com> Date: Wed, 2 Feb 2022 15:08:47 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Stat-Signature: hg9eipdethsz5nmninnd56sfccxwarnh X-Rspam-User: nil Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf25.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: AA1A0A0004 X-HE-Tag: 1643794737-609730 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2/2/22 11:50 AM, Christophe Leroy wrote: >=20 > Le 02/02/2022 =C3=A0 06:38, Anshuman Khandual a =C3=A9crit=C2=A0: >> Each call into pte_mkhuge() is invariably followed by arch_make_huge_p= te(). >> Instead arch_make_huge_pte() can accommodate pte_mkhuge() at the begin= ning. >> This updates generic fallback stub for arch_make_huge_pte() and availa= ble >> platforms definitions. This makes huge pte creation much cleaner and e= asier >> to follow. > I think it is a good cleanup. I always wonder why commit d9ed9faac283=20 > ("mm: add new arch_make_huge_pte() method for tile support") didn't mov= e=20 > the pte_mkhuge() into arch_make_huge_pte(). +1 >=20 > When I implemented arch_make_huge_pte() for powerpc 8xx, in one case=20 > arch_make_huge_pte() have to undo the things done by pte_mkhuge(), see = below >=20 > As a second step we could probably try to get rid of pte_mkhuge()=20 > completely, at least in the core. Sure. >=20 >> Cc: Catalin Marinas >> Cc: Will Deacon >> Cc: Michael Ellerman >> Cc: Paul Mackerras >> Cc: "David S. Miller" >> Cc: Mike Kravetz >> Cc: Andrew Morton >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: linuxppc-dev@lists.ozlabs.org >> Cc: sparclinux@vger.kernel.org >> Cc: linux-mm@kvack.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual > Reviewed-by: Christophe Leroy >=20 >> --- >> arch/arm64/mm/hugetlbpage.c | 1 + >> arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 1 + >> arch/sparc/mm/hugetlbpage.c | 1 + >> include/linux/hugetlb.h | 2 +- >> mm/hugetlb.c | 3 +-- >> mm/vmalloc.c | 1 - >> 6 files changed, 5 insertions(+), 4 deletions(-) >> >> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c >> index ffb9c229610a..228226c5fa80 100644 >> --- a/arch/arm64/mm/hugetlbpage.c >> +++ b/arch/arm64/mm/hugetlbpage.c >> @@ -347,6 +347,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int= shift, vm_flags_t flags) >> { >> size_t pagesize =3D 1UL << shift; >> =20 >> + entry =3D pte_mkhuge(entry); >> if (pagesize =3D=3D CONT_PTE_SIZE) { >> entry =3D pte_mkcont(entry); >> } else if (pagesize =3D=3D CONT_PMD_SIZE) { >> diff --git a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h b/arch/p= owerpc/include/asm/nohash/32/hugetlb-8xx.h >> index 64b6c608eca4..e41e095158c7 100644 >> --- a/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h >> +++ b/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h >> @@ -70,6 +70,7 @@ static inline pte_t arch_make_huge_pte(pte_t entry, = unsigned int shift, vm_flags >> { >> size_t size =3D 1UL << shift; >> =20 >> + entry =3D pte_mkhuge(entry); > Could drop that and replace the below by: >=20 > if (size =3D=3D SZ_16K) > return __pte(pte_val(entry) | _PAGE_SPS); > else > return __pte(pte_val(entry) | _PAGE_SPS | _PAGE_HUGE); > =09 >=20 Sure, will change as stated above.