From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753833AbbKBQbC (ORCPT ); Mon, 2 Nov 2015 11:31:02 -0500 Received: from smtprelay0114.hostedemail.com ([216.40.44.114]:40706 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752221AbbKBQa7 (ORCPT ); Mon, 2 Nov 2015 11:30:59 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::,RULES_HIT:41:355:379:541:599:617:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2828:2918:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:4385:5007:6117:6119:6261:7875:7903:9010:10004:10400:10848:11026:11232:11473:11658:11914:12296:12517:12519:12740:13069:13311:13357:14093:14097:21080:30034:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: game73_7c7022737c746 X-Filterd-Recvd-Size: 2794 Message-ID: <1446481854.24485.36.camel@perches.com> Subject: Re: [PATCH v3 08/15] mm, dax, pmem: introduce pfn_t From: Joe Perches To: Dan Williams Cc: axboe@fb.com, Dave Hansen , jack@suse.cz, linux-nvdimm@ml01.01.org, david@fromorbit.com, linux-kernel@vger.kernel.org, ross.zwisler@linux.intel.com, Andrew Morton , hch@lst.de Date: Mon, 02 Nov 2015 08:30:54 -0800 In-Reply-To: <20151102043025.6610.24022.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20151102042941.6610.27784.stgit@dwillia2-desk3.amr.corp.intel.com> <20151102043025.6610.24022.stgit@dwillia2-desk3.amr.corp.intel.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2015-11-01 at 23:30 -0500, Dan Williams wrote: > For the purpose of communicating the optional presence of a 'struct > page' for the pfn returned from ->direct_access(), introduce a type that > encapsulates a page-frame-number plus flags. These flags contain the > historical "page_link" encoding for a scatterlist entry, but can also > denote "device memory". Where "device memory" is a set of pfns that are > not part of the kernel's linear mapping by default, but are accessed via > the same memory controller as ram. > > The motivation for this new type is large capacity persistent memory > that needs struct page entries in the 'memmap' to support 3rd party DMA > (i.e. O_DIRECT I/O with a persistent memory source/target). However, we > also need it in support of maintaining a list of mapped inodes which > need to be unmapped at driver teardown or freeze_bdev() time. [] > diff --git a/include/linux/mm.h b/include/linux/mm.h [] > +#define PFN_FLAGS_MASK (~PAGE_MASK << (BITS_PER_LONG - PAGE_SHIFT)) > +#define PFN_SG_CHAIN (1UL << (BITS_PER_LONG - 1)) > +#define PFN_SG_LAST (1UL << (BITS_PER_LONG - 2)) > +#define PFN_DEV (1UL << (BITS_PER_LONG - 3)) > +#define PFN_MAP (1UL << (BITS_PER_LONG - 4)) [] > diff --git a/include/linux/pfn.h b/include/linux/pfn.h [] > @@ -3,6 +3,15 @@ [] > + * pfn_t: encapsulates a page-frame number that is optionally backed > + * by memmap (struct page). Whether a pfn_t has a 'struct page' > + * backing is indicated by flags in the high bits of the value. > + */ > +typedef struct { > + unsigned long val; > +} pfn_t; > #endif Perhaps this would be more intelligible as an anonymous union of bit-fields and unsigned long.