Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10833344ybi; Thu, 25 Jul 2019 05:55:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqz64ApNW7Z4eejKYv/YYw7oov6GPb1aoGVO+LUb7wWkjamX2qxXx91F1rqRwMK5TNrJSlv4 X-Received: by 2002:a62:4d85:: with SMTP id a127mr16579711pfb.148.1564059355855; Thu, 25 Jul 2019 05:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564059355; cv=none; d=google.com; s=arc-20160816; b=CVPc7ZGo705y9qspnN/xA03+c5j00pEm2lMNqJ82XjCCepplpPUyNCXu+StRKZbnNL xQWefevSq84LsOBxNjurkU1kc74ryn4i7Y4xWXWYBZRqGQ0atILoFaWYoYgXifCBuqgU a6Bm+uR/n++Zxe+mnL7rS03q/NfaXk5Cp4b4l+J9Ubxl7KjU4fUgjF/yxq7cEyNLOGAv IwtNdhE2e4A0l6Fu/Mv2WPr9dd469uBh130VkmU1U6Q+eWPrqhd423ZMHaczRvaj1j+p 7j1Oij1TEFbi6ofIk75PUPB4SIbMloJofjVyNrULCMTzUJppNwg/CJnpQmwJn10/Y5cu 31Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ld8+YgZexEJtq8qLQ0i1oFk2+2Kl/bXdl+p73DYv/hE=; b=Hq1JfEMe+IeiaMumylH26oaMzGaoanDmJXtdo4bU5MwzaEzNELiXHa+6OW12iVeCw8 QPxghkjI1Bjp/1J9BSXgj2U+jkYRgyq8PQr7HGvsiJudTlBFn2ZCHafBOYumf+6inLan BoTwRyAc/M3uDJdtlSqk3zeH3X51/GagjO1ALHOppE3zzK8Us7wMktigI9sjpu7laI6Z Xtn+yfYOYdXqcOh7W1dLTOBlDCYVNdFhqQIhZvVix1kUGeVN9/KyyipKoKeJe8nJjlhc ni/qYF9P3GtxKDJa4ax2HsUQ77Xk4U6ob51YJgvr1RXOTGYK3esNXr9hG4eymAGAh4nd tB9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rypn7it8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y15si16875806pjp.90.2019.07.25.05.55.41; Thu, 25 Jul 2019 05:55:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rypn7it8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390520AbfGYJaq (ORCPT + 99 others); Thu, 25 Jul 2019 05:30:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:52250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387515AbfGYJap (ORCPT ); Thu, 25 Jul 2019 05:30:45 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (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 925062238C; Thu, 25 Jul 2019 09:30:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564047044; bh=YLT7mc7uWZHnVWRAOXEA35kXHXVmPx8BUd1T5sThOCg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Rypn7it8Rf260lh0cGgrtQiQ283OFmqpG1lxyuto4Y7QYQbzn6ruYk8uV6NiK7D/f hnNYlr/9QmLq6CPAhKWzSsjmkJC+PNqJTbRH4mEjG8OcRYMPfYeyOTSoxzgJPBd94M 9AMwOACsNIfinxPFc3YYJSq3Hk2TY45ShQWw/bTk= Date: Thu, 25 Jul 2019 10:30:37 +0100 From: Will Deacon To: Anshuman Khandual Cc: Steven Price , linux-mm@kvack.org, Mark Rutland , x86@kernel.org, Arnd Bergmann , Ard Biesheuvel , Peter Zijlstra , Catalin Marinas , Dave Hansen , linux-kernel@vger.kernel.org, =?iso-8859-1?B?Suly9G1l?= Glisse , Ingo Molnar , Borislav Petkov , Andy Lutomirski , "H. Peter Anvin" , James Morse , Thomas Gleixner , Andrew Morton , linux-arm-kernel@lists.infradead.org, "Liang, Kan" Subject: Re: [PATCH v9 00/21] Generic page walk and ptdump Message-ID: <20190725093036.dzn6uulcihhkohm2@willie-the-truck> References: <20190722154210.42799-1-steven.price@arm.com> <835a0f2e-328d-7f7f-e52a-b754137789f9@arm.com> <6f59521e-1f3e-6765-9a6f-c8eca4c0c154@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6f59521e-1f3e-6765-9a6f-c8eca4c0c154@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 25, 2019 at 02:39:22PM +0530, Anshuman Khandual wrote: > On 07/24/2019 07:05 PM, Steven Price wrote: > > There isn't any problem as such with using p?d_large macros. However the > > name "large" has caused confusion in the past. In particular there are > > two types of "large" page: > > > > 1. leaf entries at high levels than normal ('sections' on Arm, for 4K > > pages this gives you 2MB and 1GB pages). > > > > 2. sets of contiguous entries that can share a TLB entry (the > > 'Contiguous bit' on Arm - which for 4K pages gives you 16 entries = 64 > > KB 'pages'). > > This is arm64 specific and AFAIK there are no other architectures where there > will be any confusion wrt p?d_large() not meaning a single entry. > > As you have noted before if we are printing individual entries with PTE_CONT > then they need not be identified as p??d_large(). In which case p?d_large() > can just safely point to p?d_sect() identifying regular huge leaf entries. Steven's stuck in the middle of things here, but I do object to p?d_large() because I find it bonkers to have p?d_large() and p?d_huge() mean completely different things when they are synonyms in the English language. Yes, p?d_leaf() matches the terminology used by the Arm architecture, but given that most page table structures are arranged as a 'tree', then it's not completely unreasonable, in my opinion. If you have a more descriptive name, we could use that instead. We could also paint it blue. > > In many cases both give the same effect (reduce pressure on TLBs and > > requires contiguous and aligned physical addresses). But for this case > > we only care about the 'leaf' case (because the contiguous bit makes no > > difference to walking the page tables). > > Right and we can just safely identify section entries with it. What will be > the problem with that ? Again this is only arm64 specific. > > > > > As far as I'm aware p?d_large() currently implements the first and > > p?d_(trans_)huge() implements either 1 or 2 depending on the architecture. > > AFAIK option 2 exists only on arm6 platform. IIUC generic MM requires two > different huge page dentition from platform. HugeTLB identifies large entries > at PGD|PUD|PMD after converting it's content into PTE first. So there is no > need for direct large page definitions for other levels. > > 1. THP - pmd_trans_huge() > 2. HugeTLB - pte_huge() CONFIG_ARCH_WANT_GENERAL_HUGETLB is set > > A simple check for p?d_large() on mm/ and include/linux shows that there are > no existing usage for these in generic MM. Hence it is available. Alternatively, it means we have a good opportunity to give it a better name before it spreads into the core code. > IMHO the new addition of p?d_leaf() can be avoided and p?d_large() should be > cleaned up (if required) in platforms and used in generic functions. Again, I disagree and think p?d_large() should be confined to arch code if it sticks around at all. I don't usually care much about naming, but in this case I really find the status quo needlessly confusing. Will