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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 C5AA7C5517A for ; Tue, 10 Nov 2020 15:41:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 4691A20797 for ; Tue, 10 Nov 2020 15:41:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DwOsCXRT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4691A20797 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7yHkfOtXWscCC7uyk2OWrGpYvCrUekxRcxp9unycZTA=; b=DwOsCXRTqf1TZLvS6RSLPz/nX vesgBwGu6uG0NP3URLA/QBb/p4dfD9/TGaDMnR+IoZ+X2y1PHOlk7y7KS3blfYrmRaUMGBDX7+dFI Ndl+/AoqQG5ifvGsYoe6cANllXw3KC199bQXrCSP9Aim/COOXBz0trmBmvcrNIsWNAM1XsLbNCBOl mWMM6AVGXVm6KcU6goHF//hpNt0kksFYdY7KTPckCvibUZZrq9F6gRfDc3BMWr3kZI8MLVBWlLzpA SYX8sl1cNFVmEsJyNa0IifPdr9Ufm0UQ5VF+e8g/pGQtevQKPWEe38R6CXafdkdLGD7fQ51bkz2Bk ez+/DLoxQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcVkT-0005yu-7u; Tue, 10 Nov 2020 15:39:57 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcVkQ-0005y2-5w for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 15:39:55 +0000 Received: from trantor (unknown [2.26.170.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9E1E42068D; Tue, 10 Nov 2020 15:39:51 +0000 (UTC) Date: Tue, 10 Nov 2020 15:39:49 +0000 From: Catalin Marinas To: Ard Biesheuvel Subject: Re: [PATCH v2 3/4] arm64: mm: make vmemmap region a projection of the linear region Message-ID: References: <20201008153602.9467-1-ardb@kernel.org> <20201008153602.9467-4-ardb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_103954_311848_82043CC3 X-CRM114-Status: GOOD ( 27.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Deacon , Steve Capper , Geert Uytterhoeven , Linux ARM , Anshuman Khandual 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 Tue, Nov 10, 2020 at 03:08:45PM +0100, Ard Biesheuvel wrote: > On Tue, 10 Nov 2020 at 14:10, Ard Biesheuvel wrote: > > On Tue, 10 Nov 2020 at 13:55, Geert Uytterhoeven wrote: > > > On Thu, Oct 8, 2020 at 5:43 PM Ard Biesheuvel wrote: > > > > Now that we have reverted the introduction of the vmemmap struct page > > > > pointer and the separate physvirt_offset, we can simplify things further, > > > > and place the vmemmap region in the VA space in such a way that virtual > > > > to page translations and vice versa can be implemented using a single > > > > arithmetic shift. > > > > > > > > One happy coincidence resulting from this is that the 48-bit/4k and > > > > 52-bit/64k configurations (which are assumed to be the two most > > > > prevalent) end up with the same placement of the vmemmap region. In > > > > a subsequent patch, we will take advantage of this, and unify the > > > > memory maps even more. > > > > > > > > Signed-off-by: Ard Biesheuvel > > > > > > This is now commit 8c96400d6a39be76 ("arm64: mm: make vmemmap region a > > > projection of the linear region") in arm64/for-next/core. > > > > > > > --- a/arch/arm64/mm/init.c > > > > +++ b/arch/arm64/mm/init.c > > > > @@ -504,6 +504,8 @@ static void __init free_unused_memmap(void) > > > > */ > > > > void __init mem_init(void) > > > > { > > > > + BUILD_BUG_ON(!is_power_of_2(sizeof(struct page))); > > > > > > This check is triggering for me. > > > > > > If CONFIG_MEMCG=n, sizeof(struct page) = 56. > > > > > > If CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y, this is mitigated by > > > the explicit alignment: > > > > > > #ifdef CONFIG_HAVE_ALIGNED_STRUCT_PAGE > > > #define _struct_page_alignment __aligned(2 * sizeof(unsigned long)) > > > #else > > > #define _struct_page_alignment > > > #endif > > > > > > struct page { ... } _struct_page_alignment; > > > > > > However, HAVE_ALIGNED_STRUCT_PAGE is selected only if SLUB, > > > while my .config is using SLAB. > > > > > > > Thanks for the report. I will look into this. > > OK, so we can obviously fix this easily by setting > CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y unconditionally instead of only 'if > SLUB'. The question is whether that is likely to lead to any > performance regressions. I'm not sure I understand. The mem_init() bug triggers if sizeof(struct page) is not a power of 2. HAVE_ALIGNED_STRUCT_PAGE forces the page alignment to 16 bytes but, for example, a 48-byte structure is not a power of 2. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel