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=-4.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 7AF46C4727F for ; Mon, 28 Sep 2020 20:35:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 035E1208FE for ; Mon, 28 Sep 2020 20:35:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="gYV3+K0u" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 035E1208FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 538B16B006E; Mon, 28 Sep 2020 16:35:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E9D96B0070; Mon, 28 Sep 2020 16:35:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FF8B6B0071; Mon, 28 Sep 2020 16:35:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id 2AF506B006E for ; Mon, 28 Sep 2020 16:35:03 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E4177181AE86A for ; Mon, 28 Sep 2020 20:35:02 +0000 (UTC) X-FDA: 77313624444.01.eye77_33118f327184 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id C1EBC100473B8 for ; Mon, 28 Sep 2020 20:35:02 +0000 (UTC) X-HE-Tag: eye77_33118f327184 X-Filterd-Recvd-Size: 6065 Received: from hqnvemgate24.nvidia.com (hqnvemgate24.nvidia.com [216.228.121.143]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Mon, 28 Sep 2020 20:35:01 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Mon, 28 Sep 2020 13:33:20 -0700 Received: from [10.2.161.19] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 28 Sep 2020 20:34:57 +0000 From: Zi Yan To: Matthew Wilcox CC: , "Kirill A . Shutemov" , Roman Gushchin , Rik van Riel , Shakeel Butt , Yang Shi , Jason Gunthorpe , Mike Kravetz , Michal Hocko , David Hildenbrand , William Kucharski , "Andrea Arcangeli" , John Hubbard , "David Nellans" , Subject: Re: [RFC PATCH v2 03/30] mm: thp: use single linked list for THP page table page deposit. Date: Mon, 28 Sep 2020 16:34:55 -0400 X-Mailer: MailMate (1.13.2r5673) Message-ID: <13ABC58F-F1FD-45CF-A1D4-132BEE120CED@nvidia.com> In-Reply-To: <20200928193428.GB30994@casper.infradead.org> References: <20200928175428.4110504-1-zi.yan@sent.com> <20200928175428.4110504-4-zi.yan@sent.com> <20200928193428.GB30994@casper.infradead.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=_MailMate_83ECF82A-1505-4C55-ABCA-DBCDD06046C5_="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1601325200; bh=D2V6H3YxgUz1ManjZAWAmwkYbEARtMvgkOEk16ytmJg=; h=From:To:CC:Subject:Date:X-Mailer:Message-ID:In-Reply-To: References:MIME-Version:Content-Type:X-Originating-IP: X-ClientProxiedBy; b=gYV3+K0uvAs5wgpZFmhWIDm1LAkrsgg6oLLJJ6wnnKn7a4Szpdv1FJk29mid7/DDk TOGA5L5xGWQbHqNGT6uY4NOy/Xe0IScYNK1G6NqRPvWsD6NMtzXPQ4s3DyRNJ+xxxp 3ynVfeH/gTtDRM9rsaLxmtCg+wbb98EV7Y6EE8BtdZ8vAaGxkE97w+R63JPXKD4Q8n 2+sDYpGbJBAOtIADp3D+INJUuylF4XnMLMJa2qONkHBiEb3PkxH0LF8sIG1IrZlrZI hqpp1mZb+igcjqQ2Qy6PWfgvtkzgTUc7iOgalkPX17o5/KtqWrDf/HcrgfKzSkna/U K7wIB7BVgyrtA== 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: --=_MailMate_83ECF82A-1505-4C55-ABCA-DBCDD06046C5_= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On 28 Sep 2020, at 15:34, Matthew Wilcox wrote: > On Mon, Sep 28, 2020 at 01:54:01PM -0400, Zi Yan wrote: >> struct { /* Page table pages */ >> - unsigned long _pt_pad_1; /* compound_head */ >> - pgtable_t pmd_huge_pte; /* protected by page->ptl */ >> + struct llist_head deposit_head; /* pgtable deposit list head */ >> + struct llist_node deposit_node; /* pgtable deposit list node */ > > If you're going to use two pointers anyway, you might as well use a > list_head. But I don't think you need to; you could either use a union= > of these or you could use the page_address() of the page to store as > much information as you like! This is intended for depositing pgtable pages hierarchically. PUD THP pgtable page deposit uses it. For a PUD THP, we need to deposit 1 PMD pgtable page and 512 PTE pgtable pages, totally 513 pages. One way is to deposit all of them on a list, but when we split the PUD THP, we need to pull them all out and use one for PMD pgtable page and deposit the rest 512 PTE pgtable pages to PMD page=E2=80=99s pmd_huge= _pte. But this mixes PMD pgtable pages and PTE pgtable pages in one list, which can be error prone and also requires extra pgtable page deposit operations during page split. This approach, at the high level, makes a pgtable page=E2=80=99s deposit_= head point to a list of lower level pgtable pages, which are linked using deposit_node. For example, we link all 512 PTE pgtable pages using deposit_node and use PMD pgtable page=E2=80=99s deposit_head to point to = the PTE page list. In addition, when we deposit the PMD pgtable page, we just point a struct_llist_head to the PMD pgtable page=E2=80=99s depos= it_node. When it comes to PUD THP split, we can simply withdraw and use the PMD pgtable page without additional operations, since PTE pgtable pages have already been deposited at the beginning. Let me know if it makes sense to you. I will add the paragraphs above to the commit message. Swapping patch 4 and 5 might also make the change easier to understand since patch 5 use this patch. =E2=80=94 Best Regards, Yan Zi --=_MailMate_83ECF82A-1505-4C55-ABCA-DBCDD06046C5_= Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJDBAEBCgAtFiEEh7yFAW3gwjwQ4C9anbJR82th+ooFAl9ySO8PHHppeUBudmlk aWEuY29tAAoJEJ2yUfNrYfqKoGkQAKV82OEF77appH1OFz2MqoDmHo6e199Rh095 hRkKAt0xYOrrFTBgGfMXZAkLhGwvZzb97FMSU2kyt7uNF+T2TraDn+KCMnEinIQq h+bVxoSww3grUsyadTnJuTLuug95/Uv0zvIaTuAeZSPTIYvh3C5B91KRoStuL5c8 BNBzaMUjZfvCWMTOizgf4rihSn5y1f1jMaw5nWSkt24eXlV4nE5Tk2xnynwKAWOW V2EcJkiL+DTLjgbcP037XuB79Fe7kyHKkV2JEiDa7xSbJSG9Vw0agKXETvJkKExJ K7wRUqKMOt9NQFnQJX0gSHVhhdYVR+GiVHtgCxHttz/ZpmBfOfdPgGirOg+8fC/h AtWeGQOA1Gfe0E6Lo4o4ovqAZFBzuWl/8fXbkuZSd94ZBaGD5A0SC/rH48h6JSpP FKGK2tuIg6RRp2IZxz3Qph0U6q/orwV+xOqioZMRhtPpe5OTLXCsicmd40BVu5hI M2pgupc2GJitBZ2iWtCGvjYv+wjvMp42Vy9b4pgYfMOE8eu5V9D6HIjg8YfZQC0U FmaJOTbhFXqjSSC4whxSQ6WdvoEHqKxbSn3jiRuI8NLqy5jMF6u3UN5rmVQeUuo1 AyEaGfhYuV/gw8q3OUCNuTVmQXHKfnYBSp+K5dThyKTQwwIPqDxbLwH+kUBmgEgf UMJ4/Frr =VR4d -----END PGP SIGNATURE----- --=_MailMate_83ECF82A-1505-4C55-ABCA-DBCDD06046C5_=--