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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2A48C433EF for ; Mon, 11 Apr 2022 10:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345156AbiDKKOo (ORCPT ); Mon, 11 Apr 2022 06:14:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239505AbiDKKOm (ORCPT ); Mon, 11 Apr 2022 06:14:42 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2311A41FBE for ; Mon, 11 Apr 2022 03:12:29 -0700 (PDT) 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 DAA64169C; Mon, 11 Apr 2022 03:12:28 -0700 (PDT) Received: from [192.168.225.160] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C03F63F5A1; Mon, 11 Apr 2022 03:12:22 -0700 (PDT) Message-ID: <5b27aa62-da2b-e19d-3378-be5102ebebb6@arm.com> Date: Mon, 11 Apr 2022 15:42:52 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v4 2/2] arm64: mm: hugetlb: Enable HUGETLB_PAGE_FREE_VMEMMAP for arm64 Content-Language: en-US To: Muchun Song , will@kernel.org, akpm@linux-foundation.org, david@redhat.com, bodeddub@amazon.com, osalvador@suse.de, mike.kravetz@oracle.com, rientjes@google.com, mark.rutland@arm.com, catalin.marinas@arm.com, james.morse@arm.com, 21cnbao@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, smuchun@gmail.com References: <20220331065640.5777-1-songmuchun@bytedance.com> <20220331065640.5777-2-songmuchun@bytedance.com> From: Anshuman Khandual In-Reply-To: <20220331065640.5777-2-songmuchun@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/31/22 12:26, Muchun Song wrote: > --- a/arch/arm64/mm/flush.c > +++ b/arch/arm64/mm/flush.c > @@ -68,6 +68,19 @@ EXPORT_SYMBOL_GPL(__sync_icache_dcache); > */ > void flush_dcache_page(struct page *page) > { > + /* > + * Only the head page's flags of HugeTLB can be cleared since the tail > + * vmemmap pages associated with each HugeTLB page are mapped with > + * read-only when CONFIG_HUGETLB_PAGE_FREE_VMEMMAP is enabled (more > + * details can refer to vmemmap_remap_pte()). Although Did you see real permission fault when flush_dcache_page() accessed remapped tail pages, with readonly vmemmap ? OR this change is from code inspection ? > + * __sync_icache_dcache() only set PG_dcache_clean flag on the head > + * page struct, some tail page structs still can be seen the flag is Sentence here needs restructuring .... ^^^^^^^^^^^^^^^^^^ > + * set since the head vmemmap page frame is reused (more details can > + * refer to the comments above page_fixed_fake_head()). > + */ > + if (hugetlb_free_vmemmap_enabled() && PageHuge(page)) > + page = compound_head(page); This should also be applicable to any other platform with both configs enabled i.e ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE and ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP ? If yes, then how to ensure that the platforms change flush_dcache_page() before subscribing into ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP ? > + > if (test_bit(PG_dcache_clean, &page->flags)) > clear_bit(PG_dcache_clean, &page->flags); > } 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB069C433EF for ; Mon, 11 Apr 2022 10:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Wasva3Z0w9qnbJsBBFvS4uRFhVJfyXmvLUKmMMuXQsA=; b=VyOj0E5CRMFz35 6pCUJH1DZgIykQ3syPIWbYq7G3JoUrc5REX/V8a2NaUHBlKv7taunfobX1Wqq13SoGDdWp4zpgl7t N6EDw+TsEg4O4oNxii4xTBIhCfe/eUqYElIdMM8j5e39sNnZ39TTN57rneS1s/P8ENwSmvhdGeJ/K VRSPxfFR4G01zQq52WRlwXiVJ2IbHfYPWeimZT4fDnzVr0nd346m9lf/+RQN9UgbbnAWEWMKyvhXt kZVFfMWaLo4SqxR0OtzNPxhpVY7fl/Raxi2lCAx0MAtaLtmDQTJwXR+9IICCrDIvySOdyhev9imfH lQgvLz7VE+vcfOOKi/uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndrKl-008MJy-Da; Mon, 11 Apr 2022 10:31:47 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ndr26-008DFT-Tv for linux-arm-kernel@lists.infradead.org; Mon, 11 Apr 2022 10:12:32 +0000 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 DAA64169C; Mon, 11 Apr 2022 03:12:28 -0700 (PDT) Received: from [192.168.225.160] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C03F63F5A1; Mon, 11 Apr 2022 03:12:22 -0700 (PDT) Message-ID: <5b27aa62-da2b-e19d-3378-be5102ebebb6@arm.com> Date: Mon, 11 Apr 2022 15:42:52 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v4 2/2] arm64: mm: hugetlb: Enable HUGETLB_PAGE_FREE_VMEMMAP for arm64 Content-Language: en-US To: Muchun Song , will@kernel.org, akpm@linux-foundation.org, david@redhat.com, bodeddub@amazon.com, osalvador@suse.de, mike.kravetz@oracle.com, rientjes@google.com, mark.rutland@arm.com, catalin.marinas@arm.com, james.morse@arm.com, 21cnbao@gmail.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, smuchun@gmail.com References: <20220331065640.5777-1-songmuchun@bytedance.com> <20220331065640.5777-2-songmuchun@bytedance.com> From: Anshuman Khandual In-Reply-To: <20220331065640.5777-2-songmuchun@bytedance.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220411_031231_070433_BFF76299 X-CRM114-Status: GOOD ( 13.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 3/31/22 12:26, Muchun Song wrote: > --- a/arch/arm64/mm/flush.c > +++ b/arch/arm64/mm/flush.c > @@ -68,6 +68,19 @@ EXPORT_SYMBOL_GPL(__sync_icache_dcache); > */ > void flush_dcache_page(struct page *page) > { > + /* > + * Only the head page's flags of HugeTLB can be cleared since the tail > + * vmemmap pages associated with each HugeTLB page are mapped with > + * read-only when CONFIG_HUGETLB_PAGE_FREE_VMEMMAP is enabled (more > + * details can refer to vmemmap_remap_pte()). Although Did you see real permission fault when flush_dcache_page() accessed remapped tail pages, with readonly vmemmap ? OR this change is from code inspection ? > + * __sync_icache_dcache() only set PG_dcache_clean flag on the head > + * page struct, some tail page structs still can be seen the flag is Sentence here needs restructuring .... ^^^^^^^^^^^^^^^^^^ > + * set since the head vmemmap page frame is reused (more details can > + * refer to the comments above page_fixed_fake_head()). > + */ > + if (hugetlb_free_vmemmap_enabled() && PageHuge(page)) > + page = compound_head(page); This should also be applicable to any other platform with both configs enabled i.e ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE and ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP ? If yes, then how to ensure that the platforms change flush_dcache_page() before subscribing into ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP ? > + > if (test_bit(PG_dcache_clean, &page->flags)) > clear_bit(PG_dcache_clean, &page->flags); > } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel