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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 728CCC55185 for ; Sun, 26 Apr 2020 02:45:33 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E18B42071E for ; Sun, 26 Apr 2020 02:45:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E18B42071E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 498shn2w3YzDqgD for ; Sun, 26 Apr 2020 12:45:29 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=arm.com (client-ip=217.140.110.172; helo=foss.arm.com; envelope-from=anshuman.khandual@arm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lists.ozlabs.org (Postfix) with ESMTP id 498sfn2f48zDqDM for ; Sun, 26 Apr 2020 12:43:42 +1000 (AEST) 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 88A7A31B; Sat, 25 Apr 2020 19:43:39 -0700 (PDT) Received: from [10.163.1.45] (unknown [10.163.1.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 61C1D3F73D; Sat, 25 Apr 2020 19:43:29 -0700 (PDT) Subject: Re: [PATCH 3/3] mm/hugetlb: Introduce HAVE_ARCH_CLEAR_HUGEPAGE_FLAGS To: Andrew Morton References: <1586864670-21799-1-git-send-email-anshuman.khandual@arm.com> <1586864670-21799-4-git-send-email-anshuman.khandual@arm.com> <20200425175511.7a68efb5e2f4436fe0328c1d@linux-foundation.org> From: Anshuman Khandual Message-ID: <87d37591-caa2-b82b-392a-3a29b2c7e9a6@arm.com> Date: Sun, 26 Apr 2020 08:13:17 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200425175511.7a68efb5e2f4436fe0328c1d@linux-foundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Catalin Marinas , Heiko Carstens , linux-kernel@vger.kernel.org, "James E.J. Bottomley" , linux-mm@kvack.org, Paul Mackerras , "H. Peter Anvin" , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Yoshinori Sato , Helge Deller , x86@kernel.org, Russell King , Christian Borntraeger , Ingo Molnar , Fenghua Yu , Vasily Gorbik , Thomas Bogendoerfer , Borislav Petkov , Paul Walmsley , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Tony Luck , linux-parisc@vger.kernel.org, linux-mips@vger.kernel.org, Palmer Dabbelt , linuxppc-dev@lists.ozlabs.org, "David S. Miller" , Mike Kravetz Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 04/26/2020 06:25 AM, Andrew Morton wrote: > On Tue, 14 Apr 2020 17:14:30 +0530 Anshuman Khandual wrote: > >> There are multiple similar definitions for arch_clear_hugepage_flags() on >> various platforms. This introduces HAVE_ARCH_CLEAR_HUGEPAGE_FLAGS for those >> platforms that need to define their own arch_clear_hugepage_flags() while >> also providing a generic fallback definition for others to use. This help >> reduce code duplication. >> >> ... >> >> --- a/include/linux/hugetlb.h >> +++ b/include/linux/hugetlb.h >> @@ -544,6 +544,10 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, >> } >> #endif >> >> +#ifndef HAVE_ARCH_CLEAR_HUGEPAGE_FLAGS >> +static inline void arch_clear_hugepage_flags(struct page *page) { } >> +#endif >> + >> #ifndef arch_make_huge_pte >> static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma, >> struct page *page, int writable) > > This is the rather old-school way of doing it. The Linus-suggested way is > > #ifndef arch_clear_hugepage_flags > static inline void arch_clear_hugepage_flags(struct page *page) > { > } > #define arch_clear_hugepage_flags arch_clear_hugepage_flags Do we need that above line here ? Is not that implicit. > #endif > > And the various arch headers do > > static inline void arch_clear_hugepage_flags(struct page *page) > { > > } > #define arch_clear_hugepage_flags arch_clear_hugepage_flags > > It's a small difference - mainly to avoid adding two variables to the > overall namespace where one would do. Understood, will change and resend. > >