Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp164686ybi; Tue, 16 Jul 2019 18:21:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVA0xyi+BsMigqQn7+WArzxdjZZGmFnwmwYoHpZNE1ba1oAnMInjfNoKGwyjvRfaWHRMGX X-Received: by 2002:a17:90a:d997:: with SMTP id d23mr38564656pjv.84.1563326500350; Tue, 16 Jul 2019 18:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563326500; cv=none; d=google.com; s=arc-20160816; b=0Ev6SIRxZJs9h1IFW4IYSUa7frutqRc02/oXhibYQBMLHdvkJ5B2/XpqTw2FfnCoKA n7G9kP7uDwY4dxZRgRrTBgOx622EpkfckKYndxwV76JAysZITozj9g9+ghnOO6mg03jB 8qUL3wr1vTJTEXt2Jiel0kELgvrmczlZt98g1tGVfNwPqDUgv2A/YmdPFKl5NKP8dtls aL8HBMgnHz3jcSDB1HH9yIdiW/eC9T8GVsvOiucCoEXlzZLkvJA9RaIvGimUjxKpWmTE 76NO/AJk26f9tDS/Pe24NYEIcE3wl9zJHxIOn5PvofhiwxRqL9CrdG3s76S16fipEQ4a 0aUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Vyc38CvrMI+IuIuIo5NTAipNHSrHTq4RP4d6/FH8/Ss=; b=pfw5S+x7j9fsTUstJDPXHuQCD2s05kZdlMHNJjWvxGmgo4GgpiBFcIQ9cF02k0pNYY ok695txxus4+2MtsxnfO58Rg7zM5AtUuEyGN/JGLBpC35fXRu0LPm5KIXglSl9YGDfTk X6/LQAe0ARDysqQ1fidB71013P7CFdVJs7oziSdFJHqCtss9MCpdqwnHfnUEL9mxZtIU 4uKGYC4/WTcPQk5nu31HO/ArBcTV6rWqSJIi+ZgpyI9VicTvWjaOG2xnfDWJJH14yLEl 11hU2IqPH8hyGMu0oXrAhk90WPl3n9abg0zN1GPwKFfb3P8TSoB6OGYdWYFYW6gCa1qP geOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=WO09GKZi; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si22024794pfk.189.2019.07.16.18.21.23; Tue, 16 Jul 2019 18:21:40 -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=@nvidia.com header.s=n1 header.b=WO09GKZi; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726112AbfGQBU2 (ORCPT + 99 others); Tue, 16 Jul 2019 21:20:28 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:19484 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbfGQBU2 (ORCPT ); Tue, 16 Jul 2019 21:20:28 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 16 Jul 2019 18:20:27 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 16 Jul 2019 18:20:27 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 16 Jul 2019 18:20:27 -0700 Received: from [10.110.48.28] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 17 Jul 2019 01:20:24 +0000 Subject: Re: [PATCH 1/3] mm: document zone device struct page reserved fields To: Ralph Campbell , CC: , Matthew Wilcox , Vlastimil Babka , Christoph Lameter , "Dave Hansen" , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , "Kirill A . Shutemov" , Lai Jiangshan , Martin Schwidefsky , Pekka Enberg , Randy Dunlap , Andrey Ryabinin , Christoph Hellwig , Jason Gunthorpe , Andrew Morton , Linus Torvalds References: <20190717001446.12351-1-rcampbell@nvidia.com> <20190717001446.12351-2-rcampbell@nvidia.com> X-Nvconfidentiality: public From: John Hubbard Message-ID: <26a47482-c736-22c4-c21b-eb5f82186363@nvidia.com> Date: Tue, 16 Jul 2019 18:20:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190717001446.12351-2-rcampbell@nvidia.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL106.nvidia.com (172.18.146.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1563326427; bh=Vyc38CvrMI+IuIuIo5NTAipNHSrHTq4RP4d6/FH8/Ss=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=WO09GKZipFxahEW5auLlDTfWxasD4caJ5DWx+kkRN+SKTnZgpslwxIm1aMHk+NDM5 oNro819e/6ny7tzneXhd7c3oFzjSAfCUAoyg+4fgYv94zvnDGpVTnEH8JC0Fs8u7i+ lQFDuRTd/mCIaObX6wuhRGeGlJh0q0TTi2K7OSbNLS61IcAvpK7XcAWEuW9NNbCZtC UVULswtoe3nVubu594nPb/vsUveh4uHeRbIdotQnPxCVYRhb6saCW2Rv6oSuZtwhTa yF2goo651+RXsGS6KJKvH/SqVF2bnh+pTJ8e85MDItskjDETciEas0UvsrqFTt/u9Z UFW14TArW4Q/g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/16/19 5:14 PM, Ralph Campbell wrote: > Struct page for ZONE_DEVICE private pages uses the reserved fields when > anonymous pages are migrated to device private memory. This is so > the page->mapping and page->index fields are preserved and the page can > be migrated back to system memory. > Document this in comments so it is more clear. >=20 > Signed-off-by: Ralph Campbell > Cc: Matthew Wilcox > Cc: Vlastimil Babka > Cc: Christoph Lameter > Cc: Dave Hansen > Cc: J=C3=A9r=C3=B4me Glisse > Cc: "Kirill A . Shutemov" > Cc: Lai Jiangshan > Cc: Martin Schwidefsky > Cc: Pekka Enberg > Cc: Randy Dunlap > Cc: Andrey Ryabinin > Cc: Christoph Hellwig > Cc: Jason Gunthorpe > Cc: Andrew Morton > Cc: Linus Torvalds > --- > include/linux/mm_types.h | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index 3a37a89eb7a7..d6ea74e20306 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -159,7 +159,14 @@ struct page { > /** @pgmap: Points to the hosting device page map. */ > struct dev_pagemap *pgmap; > void *zone_device_data; > - unsigned long _zd_pad_1; /* uses mapping */ > + /* > + * The following fields are used to hold the source > + * page anonymous mapping information while it is > + * migrated to device memory. See migrate_page(). > + */ > + unsigned long _zd_pad_1; /* aliases mapping */ > + unsigned long _zd_pad_2; /* aliases index */ > + unsigned long _zd_pad_3; /* aliases private */ Actually, I do think this helps. It's hard to document these fields, and the ZONE_DEVICE pages have a really complicated situation during migration to a device.=20 Additionally, I'm not sure, but should we go even further, and do this on t= he=20 other side of the alias: diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index d6ea74e20306..c5ce5989d8a8 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -83,7 +83,12 @@ struct page { * by the page owner. */ struct list_head lru; - /* See page-flags.h for PAGE_MAPPING_FLAGS */ + /* + * See page-flags.h for PAGE_MAPPING_FLAGS. + * + * Also: the next three fields (mapping, index and + * private) are all used by ZONE_DEVICE pages. + */ struct address_space *mapping; pgoff_t index; /* Our offset within mappin= g. */ /** ? Either way, you can add: Reviewed-by: John Hubbard thanks, --=20 John Hubbard NVIDIA