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.3 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 BE744C47247 for ; Tue, 5 May 2020 02:52:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3055206D7 for ; Tue, 5 May 2020 02:52:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728006AbgEECwU (ORCPT ); Mon, 4 May 2020 22:52:20 -0400 Received: from foss.arm.com ([217.140.110.172]:57846 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726516AbgEECwS (ORCPT ); Mon, 4 May 2020 22:52:18 -0400 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 3D5C41FB; Mon, 4 May 2020 19:52:17 -0700 (PDT) Received: from [192.168.0.129] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 20A803F71F; Mon, 4 May 2020 19:52:04 -0700 (PDT) From: Anshuman Khandual Subject: Re: [PATCH 3/3] mm/hugetlb: Introduce HAVE_ARCH_CLEAR_HUGEPAGE_FLAGS To: Andrew Morton Cc: linux-mm@kvack.org, Russell King , Catalin Marinas , Will Deacon , Tony Luck , Fenghua Yu , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Paul Walmsley , Palmer Dabbelt , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Yoshinori Sato , Rich Felker , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Mike Kravetz , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org 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> <87d37591-caa2-b82b-392a-3a29b2c7e9a6@arm.com> <20200425200124.20d0c75fcaef05d062d3667c@linux-foundation.org> Message-ID: <21460cbc-8e9a-b956-5797-57b2e1df9fb1@arm.com> Date: Tue, 5 May 2020 08:21:34 +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: <20200425200124.20d0c75fcaef05d062d3667c@linux-foundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/26/2020 08:31 AM, Andrew Morton wrote: > On Sun, 26 Apr 2020 08:13:17 +0530 Anshuman Khandual wrote: > >> >> >> 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. > > It depends if other header files want to test whether > arch_clear_hugepage_flags is already defined. If the header heorarchy > is well-defined and working properly, they shouldn't need to, because > we're reliably indluding the relevant arch header before (or early > within) include/linux/hugetlb.h. > > It would be nice if > > #define arch_clear_hugepage_flags arch_clear_hugepage_flags > #define arch_clear_hugepage_flags arch_clear_hugepage_flags > > were to generate an compiler error but it doesn't. If it did we could > detect these incorrect inclusion orders. > >>> #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. > > That's OK - I've queued up that fix. > Hello Andrew, I might not have searched all the relevant trees or might have just searched earlier than required. But I dont see these patches (or your proposed fixes) either in mmotm (2020-04-29-23-04) or in next-20200504. Wondering if you are waiting on a V2 for this series accommodating the changes you had proposed. - Anshuman