From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 74D012194D387 for ; Thu, 18 Oct 2018 10:43:03 -0700 (PDT) Date: Thu, 18 Oct 2018 19:43:00 +0200 From: Jan Kara Subject: Re: Problems with VM_MIXEDMAP removal from /proc//smaps Message-ID: <20181018174300.GT23493@quack2.suse.cz> References: <20181002142010.GB4963@linux-x5ow.site> <20181002144547.GA26735@infradead.org> <20181002150123.GD4963@linux-x5ow.site> <20181002150634.GA22209@infradead.org> <20181004100949.GF6682@linux-x5ow.site> <20181005062524.GA30582@infradead.org> <20181005063519.GA5491@linux-x5ow.site> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: Dan Williams Cc: Michal Hocko , Jan Kara , linux-nvdimm , Christoph Hellwig , Linux MM , linux-fsdevel List-ID: On Wed 17-10-18 13:01:15, Dan Williams wrote: > On Sun, Oct 14, 2018 at 8:47 AM Dan Williams wrote: > > > > On Fri, Oct 5, 2018 at 6:17 PM Dan Williams wrote: > > > > > > On Thu, Oct 4, 2018 at 11:35 PM Johannes Thumshirn wrote: > > > > > > > > On Thu, Oct 04, 2018 at 11:25:24PM -0700, Christoph Hellwig wrote: > > > > > Since when is an article on some website a promise (of what exactly) > > > > > by linux kernel developers? > > > > > > > > Let's stop it here, this doesn't make any sort of forward progress. > > > > > > > > > > I do think there is some progress we can make if we separate DAX as an > > > access mechanism vs DAX as a resource utilization contract. My attempt > > > at representing Christoph's position is that the kernel should not be > > > advertising / making access mechanism guarantees. That makes sense. > > > Even with MAP_SYNC+DAX the kernel reserves the right to write-protect > > > mappings at will and trap access into a kernel handler. Additionally, > > > whether read(2) / write(2) does anything different behind the scenes > > > in DAX mode, or not should be irrelevant to the application. > > > > > > That said what is certainly not irrelevant is a kernel giving > > > userspace visibility and control into resource utilization. Jan's > > > MADV_DIRECT_ACCESS let's the application make assumptions about page > > > cache utilization, we just need to another mechanism to read if a > > > mapping is effectively already in that state. > > > > I thought more about this today while reviewing the virtio-pmem driver > > that will behave mostly like a DAX-capable pmem device except it will > > be implemented by passing host page cache through to the guest as a > > pmem device with a paravirtualized / asynchronous flush interface. > > MAP_SYNC obviously needs to be disabled for this case, but still need > > allow to some semblance of DAX operation to save allocating page cache > > in the guest. The need to explicitly clarify the state of DAX is > > growing with the different nuances of DAX operation. > > > > Lets use a new MAP_DIRECT flag to positively assert that a given > > mmap() call is setting up a memory mapping without page-cache or > > buffered indirection. To be clear not my original MAP_DIRECT proposal > > from a while back, instead just a flag to mmap() that causes the > > mapping attempt to fail if there is any software buffering fronting > > the memory mapping, or any requirement for software to manage flushing > > outside of pushing writes through the cpu cache. This way, if we ever > > extend MAP_SYNC for a buffered use case we can still definitely assert > > that the mapping is "direct". So, MAP_DIRECT would fail for > > traditional non-DAX block devices, and for this new virtio-pmem case. > > It would also fail for any pmem device where we cannot assert that the > > platform will take care of flushing write-pending-queues on power-loss > > events. > > After letting this set for a few days I think I'm back to liking > MADV_DIRECT_ACCESS more since madvise() is more closely related to the > page-cache management than mmap. It does not solve the query vs enable > problem, but it's still a step towards giving applications what they > want with respect to resource expectations. Yeah, I don't have a strong opinion wrt mmap flag vs madvise flag. > Perhaps a new syscall to retrieve the effective advice for a range? > > int madvice(void *addr, size_t length, int *advice); After some thought, I'm not 100% sure this is really needed. I know about apps that want to make sure DRAM is not consumed - for those mmap / madvise flag is fine if it returns error in case the feature cannot be provided. Most other apps don't care whether DAX is on or off. So this call would be needed only if someone wanted to behave differently depending on whether DAX is used or not. And although I can imagine some application like that, I'm not sure how real that is... Honza -- Jan Kara SUSE Labs, CR _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 18 Oct 2018 19:43:00 +0200 From: Jan Kara To: Dan Williams Cc: Johannes Thumshirn , Christoph Hellwig , Jan Kara , linux-fsdevel , Linux MM , linux-nvdimm , Michal Hocko Subject: Re: Problems with VM_MIXEDMAP removal from /proc//smaps Message-ID: <20181018174300.GT23493@quack2.suse.cz> References: <20181002142010.GB4963@linux-x5ow.site> <20181002144547.GA26735@infradead.org> <20181002150123.GD4963@linux-x5ow.site> <20181002150634.GA22209@infradead.org> <20181004100949.GF6682@linux-x5ow.site> <20181005062524.GA30582@infradead.org> <20181005063519.GA5491@linux-x5ow.site> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: On Wed 17-10-18 13:01:15, Dan Williams wrote: > On Sun, Oct 14, 2018 at 8:47 AM Dan Williams wrote: > > > > On Fri, Oct 5, 2018 at 6:17 PM Dan Williams wrote: > > > > > > On Thu, Oct 4, 2018 at 11:35 PM Johannes Thumshirn wrote: > > > > > > > > On Thu, Oct 04, 2018 at 11:25:24PM -0700, Christoph Hellwig wrote: > > > > > Since when is an article on some website a promise (of what exactly) > > > > > by linux kernel developers? > > > > > > > > Let's stop it here, this doesn't make any sort of forward progress. > > > > > > > > > > I do think there is some progress we can make if we separate DAX as an > > > access mechanism vs DAX as a resource utilization contract. My attempt > > > at representing Christoph's position is that the kernel should not be > > > advertising / making access mechanism guarantees. That makes sense. > > > Even with MAP_SYNC+DAX the kernel reserves the right to write-protect > > > mappings at will and trap access into a kernel handler. Additionally, > > > whether read(2) / write(2) does anything different behind the scenes > > > in DAX mode, or not should be irrelevant to the application. > > > > > > That said what is certainly not irrelevant is a kernel giving > > > userspace visibility and control into resource utilization. Jan's > > > MADV_DIRECT_ACCESS let's the application make assumptions about page > > > cache utilization, we just need to another mechanism to read if a > > > mapping is effectively already in that state. > > > > I thought more about this today while reviewing the virtio-pmem driver > > that will behave mostly like a DAX-capable pmem device except it will > > be implemented by passing host page cache through to the guest as a > > pmem device with a paravirtualized / asynchronous flush interface. > > MAP_SYNC obviously needs to be disabled for this case, but still need > > allow to some semblance of DAX operation to save allocating page cache > > in the guest. The need to explicitly clarify the state of DAX is > > growing with the different nuances of DAX operation. > > > > Lets use a new MAP_DIRECT flag to positively assert that a given > > mmap() call is setting up a memory mapping without page-cache or > > buffered indirection. To be clear not my original MAP_DIRECT proposal > > from a while back, instead just a flag to mmap() that causes the > > mapping attempt to fail if there is any software buffering fronting > > the memory mapping, or any requirement for software to manage flushing > > outside of pushing writes through the cpu cache. This way, if we ever > > extend MAP_SYNC for a buffered use case we can still definitely assert > > that the mapping is "direct". So, MAP_DIRECT would fail for > > traditional non-DAX block devices, and for this new virtio-pmem case. > > It would also fail for any pmem device where we cannot assert that the > > platform will take care of flushing write-pending-queues on power-loss > > events. > > After letting this set for a few days I think I'm back to liking > MADV_DIRECT_ACCESS more since madvise() is more closely related to the > page-cache management than mmap. It does not solve the query vs enable > problem, but it's still a step towards giving applications what they > want with respect to resource expectations. Yeah, I don't have a strong opinion wrt mmap flag vs madvise flag. > Perhaps a new syscall to retrieve the effective advice for a range? > > int madvice(void *addr, size_t length, int *advice); After some thought, I'm not 100% sure this is really needed. I know about apps that want to make sure DRAM is not consumed - for those mmap / madvise flag is fine if it returns error in case the feature cannot be provided. Most other apps don't care whether DAX is on or off. So this call would be needed only if someone wanted to behave differently depending on whether DAX is used or not. And although I can imagine some application like that, I'm not sure how real that is... Honza -- Jan Kara SUSE Labs, CR