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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 5BCF7C4167B for ; Fri, 4 Dec 2020 12:45:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3151422AED for ; Fri, 4 Dec 2020 12:45:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388176AbgLDMor (ORCPT ); Fri, 4 Dec 2020 07:44:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388146AbgLDMor (ORCPT ); Fri, 4 Dec 2020 07:44:47 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0536CC0613D1; Fri, 4 Dec 2020 04:44:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AjuAPGM7G2kMm64bUja2RitkEu1uv3g7PuJ6UiGCjec=; b=OS2MyK0IhBUnWYTsQkbN6XDe+a 0RzYNlc12iI9h+rXilNNpWO0YuA0DMEXsNw5zXxeuMb5hODEavmO3BLe/dC0zNpt9L7IMIfHz0Tyl rWmUHxvmiShEPwvMnxZ3XMKlNBSJ+kCEQsmkPNb7+lisRzXeBaOR2fHJXykN5paMkmKKc9AxMSC6W /9lZVSSqDxcq6ArODbGnmHKB7KdbJmX7KDQjdxig0V4JuXy4U1z7RuD24XhjgVGFfi/7IY4W1CwXy HGdY8vXvgnKkeI4XlZ+DMGG9+Vv71fRwMJJFuQs3IOSQI33bDaMpChMBRl3RPRkDXoKE3ROVoi7pg uYuZGdIA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1klARO-000262-Tg; Fri, 04 Dec 2020 12:44:02 +0000 Date: Fri, 4 Dec 2020 12:44:02 +0000 From: Matthew Wilcox To: Helge Deller Cc: James Bottomley , Linux FS-devel Mailing List , Parisc List , "Aneesh Kumar K.V" , linux-nvdimm@lists.01.org Subject: Re: PATCH] fs/dax: fix compile problem on parisc and mips Message-ID: <20201204124402.GN11935@casper.infradead.org> References: <20201204034843.GM11935@casper.infradead.org> <0f0ac7be-0108-0648-a4db-2f37db1c8114@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0f0ac7be-0108-0648-a4db-2f37db1c8114@gmx.de> Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On Fri, Dec 04, 2020 at 08:57:37AM +0100, Helge Deller wrote: > On 12/4/20 4:48 AM, Matthew Wilcox wrote: > > On Thu, Dec 03, 2020 at 04:33:10PM -0800, James Bottomley wrote: > >> These platforms define PMD_ORDER in asm/pgtable.h > > > > I think that's the real problem, though. > > > > #define PGD_ORDER 1 /* Number of pages per pgd */ > > #define PMD_ORDER 1 /* Number of pages per pmd */ > > #define PGD_ALLOC_ORDER (2 + 1) /* first pgd contains pmd */ > > #else > > #define PGD_ORDER 1 /* Number of pages per pgd */ > > #define PGD_ALLOC_ORDER (PGD_ORDER + 1) > > > > That should clearly be PMD_ALLOC_ORDER, not PMD_ORDER. Or even > > PAGES_PER_PMD like the comment calls it, because I really think > > that doing an order-3 (8 pages) allocation for the PGD is wrong. > > We need a spinlock to protect parallel accesses to the PGD, > search for pgd_spinlock(). > This spinlock is stored behind the memory used for the PGD, which > is why we allocate more memory (and waste 3 pages). There are better places to store it than that! For example, storing it in the struct page, like many architectures do for split ptlocks. You'll have to skip the _pt_pad_1 so it doesn't get confused with being a compound_head, but soemthing like this: struct { /* PA-RISC PGD */ unsigned long _pa_pad_1; /* compound_head */ #if ALLOC_SPLIT_PA_PTLOCKS spinlock_t *pa_ptl; #else spinlock_t pa_ptl; #endif }; inside struct page (linux/mm_types.h) should do the trick. You'll still need to allocate them separately if various debugging options are enabled (see the ALLOC_SPLIT_PTLOCKS for details), but usually this will save you a lot of memory. You could also fill in pt_mm like x86 does for its pgds, and then use mm->page_table_lock to protect whatever the PGD lock currently protects. Maybe page_table_lock is sometimes held when calling ptep_set_wrprotect() and sometimes isn't; then this wouldn't work. Also, could you fix the comments? They don't match the code: #define PGD_ORDER 1 /* Number of pages per pgd */ should be #define PGD_ALLOC_ORDER 1 /* 2 pages (8KiB) per pgd */