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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B283C7EE23 for ; Thu, 8 Jun 2023 08:14:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 040068E0002; Thu, 8 Jun 2023 04:14:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F32916B0075; Thu, 8 Jun 2023 04:14:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFAB28E0002; Thu, 8 Jun 2023 04:14:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CD2806B0074 for ; Thu, 8 Jun 2023 04:14:03 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9CFC11A0164 for ; Thu, 8 Jun 2023 08:14:03 +0000 (UTC) X-FDA: 80878867566.22.34FF101 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by imf10.hostedemail.com (Postfix) with ESMTP id BE059C0023 for ; Thu, 8 Jun 2023 08:14:01 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=cczgcKQX; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf10.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.128.169 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686212041; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SozPjokJrntF/Oo8htMG+TXiphVXSJ/WTfbCCYukN6c=; b=Fy5tYzEgw4wAo3N2dRFcz2zGwdxTZrceYNQHgRRXu0iRUqHXpaBI2xrL/3T3bfBYFOGZrw 00KfJb5ZMDrcs+r1BlAfgs/7clSsZMQH5QchYDYRRqfkrZ+FPPgDMnP+Y5zKecvDUrXylG FczrODYunkOfjwK51nxnwhNFEchAc9U= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=cczgcKQX; dmarc=pass (policy=none) header.from=linaro.org; spf=pass (imf10.hostedemail.com: domain of linus.walleij@linaro.org designates 209.85.128.169 as permitted sender) smtp.mailfrom=linus.walleij@linaro.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686212041; a=rsa-sha256; cv=none; b=h9xefdb9fIVX93y2DUOfP0XpLD4pzngXfAeo/ZD4uEs07ojirGI9c8J7V7IApmx9T3MkHg ar3wBaqwZmepyZvNw8R5QW7L4X9/yWdCYw5XTFeQ47L5FccmASiZ1hw2R+0d7tDFJuCwZG WgoY7mCCETxL8cU9rKgJVg44ZOdKbWA= Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-565e8d575cbso2799667b3.3 for ; Thu, 08 Jun 2023 01:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686212041; x=1688804041; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SozPjokJrntF/Oo8htMG+TXiphVXSJ/WTfbCCYukN6c=; b=cczgcKQXzuA+Fvo6OnlqL2crMtCvHHH2m4epR4C/qmv/FJnEnQgZ9c7M0fr/SJ2Mcb pgrz8YetWVEKEIpv16KT8QiVoAWjvKwObhX9M7BrOmJSC8moQlzQgGBZNEvIjZGw032K X36ylsSl+ZtzDyHf21dANfTvU1NOQuKVE5Q8HX6sAZ7ktF/yjuEy31sZY6Xx5RgCIakG RsLuOw8NpA2iTwczy1HJXcWFAmkN6FopOUUn9WI2c7UWvqZK/ngCc7m+KxTVTJbumaIS hdEw+oXYE1xY/UpIdbxS7ZnAw3NFQgAqG+Z3i+YEJSH2I0GRs+MKEhOYtSXZYx8e0Ch8 9/lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686212041; x=1688804041; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SozPjokJrntF/Oo8htMG+TXiphVXSJ/WTfbCCYukN6c=; b=ABEX6fPtHrI6zf07PiYMr1lgHo1Sm5/AX0LJmzMY0ZRAeHSav8vhIOAROdANSjnQmp pA6XjeGK/jgODp4fSgBZZTVt2jKECSacq2lLGgz8uqINUzyQFh1Al0Mk5cK+3CqK3b5c qoo9d+X62CKDVC5NCLCbl/TjLhTjDvVKdMdNadvXyBsRnrVfasAPsWNo3Fd6njthkSft DIeGrEVXzdgEUv7s5sN/UzLpMCo0kh0C0QIL7g/0ywQRcu6fi0b4o5IuX9erK/wWlP2X frvnKuOXwSHxpG65Fsk8zcwRjqN5z1yn+mk+FPOfea147QxV8QJ0OmHYiZ6es1gUwhAZ YwEg== X-Gm-Message-State: AC+VfDyqzJkkvDFL/tQ79WkuhEOPRhEUqunnij7YufC9EyM0okmrl4eH fiCNKTySCYQnOu4foWV737q69muE+JYgCKkhxg0K+A== X-Google-Smtp-Source: ACHHUZ4lKcngg3cUQXYN/Nr+g2EBp9Mt4Nh/jGLDWz1HIvDz3G1mNWdigm3jaN8J2YmlfdP3a/WD3P4bbz0MXDF6EXQ= X-Received: by 2002:a0d:c7c3:0:b0:54f:9cd0:990 with SMTP id j186-20020a0dc7c3000000b0054f9cd00990mr8755401ywd.18.1686212040844; Thu, 08 Jun 2023 01:14:00 -0700 (PDT) MIME-Version: 1.0 References: <20230605221035.3681812-1-linus.walleij@linaro.org> In-Reply-To: From: Linus Walleij Date: Thu, 8 Jun 2023 10:13:49 +0200 Message-ID: Subject: Re: [PATCH] Documentation/mm: Initial page table documentation To: Matthew Wilcox Cc: Andrew Morton , Jonathan Corbet , linux-mm@kvack.org, linux-doc@vger.kernel.org, Mike Rapoport Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Stat-Signature: cu5h69xnnqebrdpatnog5xgnaojnnmem X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: BE059C0023 X-HE-Tag: 1686212041-863092 X-HE-Meta: U2FsdGVkX1/MfCcDYDH7JcidX+DFi8uZ7OoLT0dy/kt9v8L2xOO9o8zQkoqaRBKFmmxmwgXbWQ19nSocVVDsNDuA16Z6+5/WlsdQZxdeg7WUS7GH+iJTcvblvtGrGDnPoXbBJdXnSfG5vA5HFWLGpH1fTG2Uc7R1sAG183l5Q5Wkdd55Y86M65kUXk3On3XB5QW7Go9xh/XA+lIrfut53gc8sbs41VcEL3FLQo40VNL80QJCjDRdlpUR6CTnYlRmFwFAcN0prMeQSO55CwM7zDD+3C6yPLH55DGuXBCLjkMmYdYMOoAGoAZGFn5KzKE/pvLuUbjfLQkmrV//4PHZ+uWKcp/8mm1GsueCz7BJGLrpu6KfoEeZaMp3KL2BmZvss7VVZWiDHAWff/9jZl75dQJeY0OA8hhMYoEpja5RWT4SM5f0dJkisaucb4yRIxIsNA8VwCP4oAL/v2xDGhz/x++TfP8cP4x3C0I7Ny0sK1M4GE/xSaUxETPfW3n7ugJp5pkwkNNKgAR5m83ZdC/UqZN5mzQwTNEC3saTQvKRk4YocshEEqD7290eDJKR0aKnooNUfzE3+fE1sVhD1F3MrPZvPUMQc1YOPIhmKRgfeKhpmDvEZKYMnfM9j61nZXgqnAsL+Oj91SinxsohQ00T/NqSucZit6rEaiN2ib2ldVyNrwCPl4emNALOoLTf3wM+3LUt5vllXdOmFg+TXNxsRzNEvYTqmALh2MF+QtNLnd6c7HWcv+O9Jf9Veb+76QKNr0vBJ6ysyvJlj85AOZ9kA/BFrsMytEbqJgc6ziE3TGW6yAk7+p2rqoFmgA8ZPx+96jWbPx7bYAhyISoRS98lFatL7a6Nz9ZXXGoRILzIJY3081SJfnHy1zr5ORrHSLNzq0EGAHgz/9rJ/nJbVJfXozCmJVIpXBWIpwVYODjySHS4uaL+pfi1V08tc+s2rngtdi7ftGUeg+nrd6xxEOu cR5WCZme zSL8Lm+WX8pPvwAZEoywO7eb8qFwLUqGo8Bi6MK65Hb9son63ig+KyF3PxrsA47H5sgJSvdmq16NDTD0h3Npab8j6kSkXiYp8UC3U4g5aHa5LZ6NUTZYctlYwwZzoVLNTveej2CcRtCBGci2OklYISzTq/qGmwIGSvIH/Wa8K/EULD5EdkUbXh7EprIIWf9++qs5RVRtvSqbwO8pNytWVrpw0o0aE2zUcHLdJ6GRZTYNyEX8e5f05s18s0vF5Ihy2lF/Fi3rWIdjxFdYvk4XSLfmPzw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Matthew, I fixes up most of the comments. On Tue, Jun 6, 2023 at 5:57=E2=80=AFAM Matthew Wilcox = wrote: > On Tue, Jun 06, 2023 at 12:10:35AM +0200, Linus Walleij wrote: > > +- **pte**, `pte_t`, `pteval_t` =3D **Page Table Entry** - mentioned ea= rlier. > > + The name is a bit confusing because while in Linux 1.0 this did refe= r to a > > + single page table entry in the top level page table, it was retrofit= ted > > + to be "what the level above points to". So when two-level page table= s were > > + introduced, the *pte* became a list of pointers, which is why > > + `PTRS_PER_PTE` exists. This oxymoronic term can be mildly confusing. > > I don't think this is right. PTRS_PER_PTE is how many pointers are in > the PMD page table, I don't get this. What does PTRS_PER_PMD mean then (and then all the way up to PTRS_PER_PGD...) > so it's how many pointers you can walk if you have a > pte *. Yes, it's complicated and confusing, but I don't think this > explanation clears up any of that confusion. I will try to reword it so this gets through. > > +pointers*, so the **pgd** contains `PTRS_PER_PGD` pointers to the next= level > > +below, **p4d** contains `PTRS_PER_P4D` pointers to **pud** items and s= o on. The > > +number of pointers on each level is architecture-defined. The most usu= al layout > > I don't think it's helpful to say this. It's really not that usual > (maybe half of our architectures behave that way?) > > I think a document like this that talks about page tables really needs to > include a description of how some PMDs / PUDs / ... may not be pointers > to lower levels, but direct pointers to the actual memory (ie THPs / > hugetlb pages). I don't understand that stuff. I suggest you patch this into the document when the basics are in place. > Sorry to take a wrecking ball to this, I'm sure you worked hard on it. Don't worry about that, I'm an academic, I just rewrite. Yours, Linus Walleij