From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 20 Oct 2017 11:31:48 +0200 From: Christoph Hellwig Subject: Re: [PATCH v3 00/13] dax: fix dma vs truncate and remove 'page-less' support Message-ID: <20171020093148.GA20304@lst.de> References: <150846713528.24336.4459262264611579791.stgit@dwillia2-desk3.amr.corp.intel.com> <20171020074750.GA13568@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171020074750.GA13568@lst.de> Sender: owner-linux-mm@kvack.org To: Dan Williams Cc: akpm@linux-foundation.org, Michal Hocko , Jan Kara , Benjamin Herrenschmidt , Dave Hansen , Dave Chinner , "J. Bruce Fields" , linux-mm@kvack.org, Paul Mackerras , Sean Hefty , Jeff Layton , Matthew Wilcox , linux-rdma@vger.kernel.org, Michael Ellerman , Jeff Moyer , hch@lst.de, Jason Gunthorpe , Doug Ledford , Ross Zwisler , Hal Rosenstock , Heiko Carstens , linux-nvdimm@lists.01.org, Alexander Viro , Gerald Schaefer , "Darrick J. Wong" , linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, Martin Schwidefsky , linux-fsdevel@vger.kernel.org, "Kirill A. Shutemov" List-ID: On Fri, Oct 20, 2017 at 09:47:50AM +0200, Christoph Hellwig wrote: > I'd like to brainstorm how we can do something better. > > How about: > > If we hit a page with an elevated refcount in truncate / hole puch > etc for a DAX file system we do not free the blocks in the file system, > but add it to the extent busy list. We mark the page as delayed > free (e.g. page flag?) so that when it finally hits refcount zero we > call back into the file system to remove it from the busy list. Brainstorming some more: Given that on a DAX file there shouldn't be any long-term page references after we unmap it from the page table and don't allow get_user_pages calls why not wait for the references for all DAX pages to go away first? E.g. if we find a DAX page in truncate_inode_pages_range that has an elevated refcount we set a new flag to prevent new references from showing up, and then simply wait for it to go away. Instead of a busy way we can do this through a few hashed waitqueued in dev_pagemap. And in fact put_zone_device_page already gets called when putting the last page so we can handle the wakeup from there. In fact if we can't find a page flag for the stop new callers things we could probably come up with a way to do that through dev_pagemap somehow, but I'm not sure how efficient that would be. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH v3 00/13] dax: fix dma vs truncate and remove 'page-less' support Date: Fri, 20 Oct 2017 11:31:48 +0200 Message-ID: <20171020093148.GA20304@lst.de> References: <150846713528.24336.4459262264611579791.stgit@dwillia2-desk3.amr.corp.intel.com> <20171020074750.GA13568@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20171020074750.GA13568@lst.de> Sender: owner-linux-mm@kvack.org To: Dan Williams Cc: akpm@linux-foundation.org, Michal Hocko , Jan Kara , Benjamin Herrenschmidt , Dave Hansen , Dave Chinner , "J. Bruce Fields" , linux-mm@kvack.org, Paul Mackerras , Sean Hefty , Jeff Layton , Matthew Wilcox , linux-rdma@vger.kernel.org, Michael Ellerman , Jeff Moyer , hch@lst.de, Jason Gunthorpe , Doug Ledford , Ross Zwisler , Hal Rosenstock , Heiko Carstens , linux-nvdimm@lists.01.org, Alexander Viro , Gerald Schaefer , Darri List-Id: linux-rdma@vger.kernel.org On Fri, Oct 20, 2017 at 09:47:50AM +0200, Christoph Hellwig wrote: > I'd like to brainstorm how we can do something better. > > How about: > > If we hit a page with an elevated refcount in truncate / hole puch > etc for a DAX file system we do not free the blocks in the file system, > but add it to the extent busy list. We mark the page as delayed > free (e.g. page flag?) so that when it finally hits refcount zero we > call back into the file system to remove it from the busy list. Brainstorming some more: Given that on a DAX file there shouldn't be any long-term page references after we unmap it from the page table and don't allow get_user_pages calls why not wait for the references for all DAX pages to go away first? E.g. if we find a DAX page in truncate_inode_pages_range that has an elevated refcount we set a new flag to prevent new references from showing up, and then simply wait for it to go away. Instead of a busy way we can do this through a few hashed waitqueued in dev_pagemap. And in fact put_zone_device_page already gets called when putting the last page so we can handle the wakeup from there. In fact if we can't find a page flag for the stop new callers things we could probably come up with a way to do that through dev_pagemap somehow, but I'm not sure how efficient that would be. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752689AbdJTJbx (ORCPT ); Fri, 20 Oct 2017 05:31:53 -0400 Received: from verein.lst.de ([213.95.11.211]:47783 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752074AbdJTJbv (ORCPT ); Fri, 20 Oct 2017 05:31:51 -0400 Date: Fri, 20 Oct 2017 11:31:48 +0200 From: Christoph Hellwig To: Dan Williams Cc: akpm@linux-foundation.org, Michal Hocko , Jan Kara , Benjamin Herrenschmidt , Dave Hansen , Dave Chinner , "J. Bruce Fields" , linux-mm@kvack.org, Paul Mackerras , Sean Hefty , Jeff Layton , Matthew Wilcox , linux-rdma@vger.kernel.org, Michael Ellerman , Jeff Moyer , hch@lst.de, Jason Gunthorpe , Doug Ledford , Ross Zwisler , Hal Rosenstock , Heiko Carstens , linux-nvdimm@lists.01.org, Alexander Viro , Gerald Schaefer , "Darrick J. Wong" , linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, Martin Schwidefsky , linux-fsdevel@vger.kernel.org, "Kirill A. Shutemov" Subject: Re: [PATCH v3 00/13] dax: fix dma vs truncate and remove 'page-less' support Message-ID: <20171020093148.GA20304@lst.de> References: <150846713528.24336.4459262264611579791.stgit@dwillia2-desk3.amr.corp.intel.com> <20171020074750.GA13568@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171020074750.GA13568@lst.de> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 20, 2017 at 09:47:50AM +0200, Christoph Hellwig wrote: > I'd like to brainstorm how we can do something better. > > How about: > > If we hit a page with an elevated refcount in truncate / hole puch > etc for a DAX file system we do not free the blocks in the file system, > but add it to the extent busy list. We mark the page as delayed > free (e.g. page flag?) so that when it finally hits refcount zero we > call back into the file system to remove it from the busy list. Brainstorming some more: Given that on a DAX file there shouldn't be any long-term page references after we unmap it from the page table and don't allow get_user_pages calls why not wait for the references for all DAX pages to go away first? E.g. if we find a DAX page in truncate_inode_pages_range that has an elevated refcount we set a new flag to prevent new references from showing up, and then simply wait for it to go away. Instead of a busy way we can do this through a few hashed waitqueued in dev_pagemap. And in fact put_zone_device_page already gets called when putting the last page so we can handle the wakeup from there. In fact if we can't find a page flag for the stop new callers things we could probably come up with a way to do that through dev_pagemap somehow, but I'm not sure how efficient that would be.