Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6091438ybi; Sun, 21 Jul 2019 09:04:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxARm7RdA/SsVr6n2Rs5EpZKxhvcO3cLn+RqE2LylCMbKiaRV0cNuTIdLiXyAO3WsGTlkv/ X-Received: by 2002:a63:c751:: with SMTP id v17mr51598270pgg.264.1563725050456; Sun, 21 Jul 2019 09:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563725050; cv=none; d=google.com; s=arc-20160816; b=p2pq10FecG6JyfpFsIP99MITklAelj6wc4G+enFdblI/1XTIrOncHu495dY77+oua4 1fiLUJ9WksYWQzhjMdfguRC/Wpw2F6v6sF1EbmzxggQ9HlEnXq7WHnbSrogN1QmfZdmV G8uqQZt4stj1XhwSiGvgu8YWRT6pXQzGxIAR1CcYTmZtQP26mYKaAGNrwN+k8PmJtER8 T58X6TiGjxGg1NZVhnQC2kGtXHUhq52rMaSr9U/dRpe4DsES3vyoMlzgD/CMb++bT3H5 XVTQiy5k7bBAe4yWjow5VvoxNkiswltAhqEkSW7abHXAkOONRc709pHDxJPnaIMCqnv9 /yhA== 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=5yrKtv7lLSBoGJQSfoUzlzXTf1lEOx7ratjEmiAYLgE=; b=ycoTTqH4Jpo7pkHM9bSMoyH4chV4FveY01G+Kr5Yq5L1UfE2jKW7iBl6aDNwvfI8zF eSpCQ4PIEstKftt9ZpW4O88FNnExatD/H+Uu2FsgDsO0vm9jmfkB2r5QbpzrYI957TN0 ffE/YAGHFrlW8Koqot6m/TWrqxX0nJVumwm7OGxLwKen1pcBUcnqSbu4F2qT+8wByMk5 VlJyTvdjdF2BGk4mUUlNH41h4mI5bq1p65b5eIa83QFVa3bm5NNL+i7MC+3kU4WzM77d rsQVpZSbvirVZ+rN9wRysCKvNdpma1gwT1JRxwWNLFBm/VK6G4PD2HXQ8qXYczSkFby/ X7/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qPRDkybI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si7231548pgn.77.2019.07.21.09.03.54; Sun, 21 Jul 2019 09:04:10 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qPRDkybI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726646AbfGUQCI (ORCPT + 99 others); Sun, 21 Jul 2019 12:02:08 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:47978 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726405AbfGUQCH (ORCPT ); Sun, 21 Jul 2019 12:02:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5yrKtv7lLSBoGJQSfoUzlzXTf1lEOx7ratjEmiAYLgE=; b=qPRDkybIjsnEQrqVrMLPTBeEH g+yoZazgqTczET0c+OjZrudOmnCNNeeKYrkwA6aEmtn9mQjTqHx23bAenOjrh5jk0rGjghmlHvPSH a7pDftoHUDwwSpZ5FCb9oX8CJ4xUnrxzWvxMdQSXrud25gn/yG0qirKbx7XIAZybfZG7c0MH4ooM7 TipoxwgxcNCmg7bWEMFLr81d+DTEAz7ouRpLwdkuQ5H+g7hOFjEaN+dVUPtfRaL9l7n6lrqT/ICrm a1qJk1F43VL+LYKSCijf7WKx7NIWMiToeOij1hHUySurmdqgN6Bfm7qW++/mWEMjDzENV5o+uaCEI b4R188mbQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hpEHk-00011f-FV; Sun, 21 Jul 2019 16:02:04 +0000 Date: Sun, 21 Jul 2019 09:02:04 -0700 From: Matthew Wilcox To: Ralph Campbell Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, John Hubbard , Vlastimil Babka , Christoph Lameter , Dave Hansen , =?iso-8859-1?B?Suly9G1l?= Glisse , "Kirill A . Shutemov" , Lai Jiangshan , Martin Schwidefsky , Pekka Enberg , Randy Dunlap , Andrey Ryabinin , Christoph Hellwig , Jason Gunthorpe , Andrew Morton , Linus Torvalds Subject: Re: [PATCH v2 1/3] mm: document zone device struct page field usage Message-ID: <20190721160204.GB363@bombadil.infradead.org> References: <20190719192955.30462-1-rcampbell@nvidia.com> <20190719192955.30462-2-rcampbell@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190719192955.30462-2-rcampbell@nvidia.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 19, 2019 at 12:29:53PM -0700, Ralph Campbell wrote: > Struct page for ZONE_DEVICE private pages uses the page->mapping and > and page->index fields while the source anonymous pages are migrated to > device private memory. This is so rmap_walk() can find the page when > migrating the ZONE_DEVICE private page back to system memory. > ZONE_DEVICE pmem backed fsdax pages also use the page->mapping and > page->index fields when files are mapped into a process address space. > > Restructure struct page and add comments to make this more clear. NAK. I just got rid of this kind of foolishness from struct page, and you're making it harder to understand, not easier. The comments could be improved, but don't lay it out like this again. > @@ -76,13 +76,35 @@ struct page { > * avoid collision and false-positive PageTail(). > */ > union { > - struct { /* Page cache and anonymous pages */ > - /** > - * @lru: Pageout list, eg. active_list protected by > - * pgdat->lru_lock. Sometimes used as a generic list > - * by the page owner. > - */ > - struct list_head lru; > + struct { /* Page cache, anonymous, ZONE_DEVICE pages */ > + union { > + /** > + * @lru: Pageout list, e.g., active_list > + * protected by pgdat->lru_lock. Sometimes > + * used as a generic list by the page owner. > + */ > + struct list_head lru; > + /** > + * ZONE_DEVICE pages are never on the lru > + * list so they reuse the list space. > + * ZONE_DEVICE private pages are counted as > + * being mapped so the @mapping and @index > + * fields are used while the page is migrated > + * to device private memory. > + * ZONE_DEVICE MEMORY_DEVICE_FS_DAX pages also > + * use the @mapping and @index fields when pmem > + * backed DAX files are mapped. > + */ > + struct { > + /** > + * @pgmap: Points to the hosting > + * device page map. > + */ > + struct dev_pagemap *pgmap; > + /** @zone_device_data: opaque data. */ > + void *zone_device_data; > + }; > + }; > /* See page-flags.h for PAGE_MAPPING_FLAGS */ > struct address_space *mapping; > pgoff_t index; /* Our offset within mapping. */ > @@ -155,12 +177,6 @@ struct page { > spinlock_t ptl; > #endif > }; > - struct { /* ZONE_DEVICE pages */ > - /** @pgmap: Points to the hosting device page map. */ > - struct dev_pagemap *pgmap; > - void *zone_device_data; > - unsigned long _zd_pad_1; /* uses mapping */ > - }; > > /** @rcu_head: You can use this to free a page by RCU. */ > struct rcu_head rcu_head; > -- > 2.20.1 >