From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753896AbbHMRf4 (ORCPT ); Thu, 13 Aug 2015 13:35:56 -0400 Received: from mga01.intel.com ([192.55.52.88]:29459 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753077AbbHMRfy (ORCPT ); Thu, 13 Aug 2015 13:35:54 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,671,1432623600"; d="scan'208";a="783119059" Date: Thu, 13 Aug 2015 13:35:52 -0400 From: Matthew Wilcox To: Dan Williams Cc: linux-kernel@vger.kernel.org, axboe@kernel.dk, riel@redhat.com, linux-nvdimm@ml01.01.org, linux-mm@kvack.org, mgorman@suse.de, torvalds@linux-foundation.org, hch@lst.de Subject: Re: [PATCH v5 2/5] allow mapping page-less memremaped areas into KVA Message-ID: <20150813173552.GA9645@linux.intel.com> References: <20150813025112.36703.21333.stgit@otcpl-skl-sds-2.jf.intel.com> <20150813030109.36703.21738.stgit@otcpl-skl-sds-2.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150813030109.36703.21738.stgit@otcpl-skl-sds-2.jf.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 12, 2015 at 11:01:09PM -0400, Dan Williams wrote: > +static inline __pfn_t page_to_pfn_t(struct page *page) > +{ > + __pfn_t pfn = { .val = page_to_pfn(page) << PAGE_SHIFT, }; > + > + return pfn; > +} static inline __pfn_t page_to_pfn_t(struct page *page) { __pfn_t __pfn; unsigned long pfn = page_to_pfn(page); BUG_ON(pfn > (-1UL >> PFN_SHIFT)) __pfn.val = pfn << PFN_SHIFT; return __pfn; } I have a problem wih PFN_SHIFT being equal to PAGE_SHIFT. Consider a 32-bit kernel; you're asserting that no memory represented by a struct page can have a physical address above 4GB. You only need three bits for flags so far ... how about making PFN_SHIFT be 6? That supports physical addresses up to 2^38 (256GB). That should be enough, but hardware designers have done some strange things in the past (I know that HP made PA-RISC hardware that can run 32-bit kernels with memory between 64GB and 68GB, and they can't be the only strange hardware people out there).