Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1269363 > unrolled thread
| Started by | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| First post | 2015-11-14 01:10 +0100 |
| Last post | 2015-11-16 21:10 +0100 |
| Articles | 19 on this page of 39 — 6 participants |
Back to article view | Back to linux.kernel
[PATCH v2 00/11] DAX fsynx/msync support Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:10 +0100
[PATCH v2 09/11] ext2: add support for DAX fsync/msync Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:10 +0100
[PATCH v2 07/11] mm: add find_get_entries_tag() Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:10 +0100
Re: [PATCH v2 07/11] mm: add find_get_entries_tag() Dave Chinner <david@fromorbit.com> - 2015-11-16 23:50 +0100
Re: [PATCH v2 07/11] mm: add find_get_entries_tag() Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-17 19:20 +0100
[PATCH v2 10/11] ext4: add support for DAX fsync/msync Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:10 +0100
[PATCH v2 11/11] xfs: add support for DAX fsync/msync Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:10 +0100
Re: [PATCH v2 11/11] xfs: add support for DAX fsync/msync Dave Chinner <david@fromorbit.com> - 2015-11-17 00:20 +0100
Re: [PATCH v2 11/11] xfs: add support for DAX fsync/msync Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-17 20:10 +0100
Re: [PATCH v2 11/11] xfs: add support for DAX fsync/msync Dave Chinner <david@fromorbit.com> - 2015-11-20 01:50 +0100
[PATCH v2 05/11] mm: add follow_pte_pmd() Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:20 +0100
[PATCH v2 01/11] pmem: add wb_cache_pmem() to the PMEM API Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:20 +0100
[PATCH v2 08/11] dax: add support for fsync/sync Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:20 +0100
Re: [PATCH v2 08/11] dax: add support for fsync/sync Dave Chinner <david@fromorbit.com> - 2015-11-17 00:00 +0100
Re: [PATCH v2 08/11] dax: add support for fsync/sync Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-17 19:40 +0100
[PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:20 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Dan Williams <dan.j.williams@intel.com> - 2015-11-14 01:30 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Andreas Dilger <adilger@dilger.ca> - 2015-11-14 01:50 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Dan Williams <dan.j.williams@intel.com> - 2015-11-14 03:40 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Jan Kara <jack@suse.cz> - 2015-11-16 14:40 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Jan Kara <jack@suse.cz> - 2015-11-16 15:20 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Dan Williams <dan.j.williams@intel.com> - 2015-11-16 18:30 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-16 20:50 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Dan Williams <dan.j.williams@intel.com> - 2015-11-16 21:40 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-17 01:00 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Dave Chinner <david@fromorbit.com> - 2015-11-16 23:20 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-17 00:30 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Dave Chinner <david@fromorbit.com> - 2015-11-17 00:50 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-16 21:10 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Jan Kara <jack@suse.cz> - 2015-11-18 11:50 +0100
Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-18 17:20 +0100
[PATCH v2 06/11] mm: add pgoff_mkclean() Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:20 +0100
[PATCH v2 02/11] mm: add pmd_mkclean() Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:20 +0100
Re: [PATCH v2 02/11] mm: add pmd_mkclean() Dave Hansen <dave.hansen@intel.com> - 2015-11-14 02:10 +0100
Re: [PATCH v2 02/11] mm: add pmd_mkclean() Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-17 19:00 +0100
[PATCH v2 04/11] dax: support dirty DAX entries in radix tree Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-14 01:20 +0100
Re: [PATCH v2 00/11] DAX fsynx/msync support Jan Kara <jack@suse.cz> - 2015-11-16 15:50 +0100
Re: [PATCH v2 00/11] DAX fsynx/msync support Dan Williams <dan.j.williams@intel.com> - 2015-11-16 18:00 +0100
Re: [PATCH v2 00/11] DAX fsynx/msync support Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-11-16 21:10 +0100
Page 2 of 2 — ← Prev page 1 [2]
| From | Jan Kara <jack@suse.cz> |
|---|---|
| Date | 2015-11-16 15:20 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qvsNr-8o3-7@gated-at.bofh.it> |
| In reply to | #1270136 |
On Mon 16-11-15 14:37:14, Jan Kara wrote: > On Fri 13-11-15 18:32:40, Dan Williams wrote: > > On Fri, Nov 13, 2015 at 4:43 PM, Andreas Dilger <adilger@dilger.ca> wrote: > > > On Nov 13, 2015, at 5:20 PM, Dan Williams <dan.j.williams@intel.com> wrote: > > >> > > >> On Fri, Nov 13, 2015 at 4:06 PM, Ross Zwisler > > >> <ross.zwisler@linux.intel.com> wrote: > > >>> Currently the PMEM driver doesn't accept REQ_FLUSH or REQ_FUA bios. These > > >>> are sent down via blkdev_issue_flush() in response to a fsync() or msync() > > >>> and are used by filesystems to order their metadata, among other things. > > >>> > > >>> When we get an msync() or fsync() it is the responsibility of the DAX code > > >>> to flush all dirty pages to media. The PMEM driver then just has issue a > > >>> wmb_pmem() in response to the REQ_FLUSH to ensure that before we return all > > >>> the flushed data has been durably stored on the media. > > >>> > > >>> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> > > >> > > >> Hmm, I'm not seeing why we need this patch. If the actual flushing of > > >> the cache is done by the core why does the driver need support > > >> REQ_FLUSH? Especially since it's just a couple instructions. REQ_FUA > > >> only makes sense if individual writes can bypass the "drive" cache, > > >> but no I/O submitted to the driver proper is ever cached we always > > >> flush it through to media. > > > > > > If the upper level filesystem gets an error when submitting a flush > > > request, then it assumes the underlying hardware is broken and cannot > > > be as aggressive in IO submission, but instead has to wait for in-flight > > > IO to complete. > > > > Upper level filesystems won't get errors when the driver does not > > support flush. Those requests are ended cleanly in > > generic_make_request_checks(). Yes, the fs still needs to wait for > > outstanding I/O to complete but in the case of pmem all I/O is > > synchronous. There's never anything to await when flushing at the > > pmem driver level. > > > > > Since FUA/FLUSH is basically a no-op for pmem devices, > > > it doesn't make sense _not_ to support this functionality. > > > > Seems to be a nop either way. Given that DAX may lead to dirty data > > pending to the device in the cpu cache that a REQ_FLUSH request will > > not touch, its better to leave it all to the mm core to handle. I.e. > > it doesn't make sense to call the driver just for two instructions > > (sfence + pcommit) when the mm core is taking on the cache flushing. > > Either handle it all in the mm or the driver, not a mixture. > > So I think REQ_FLUSH requests *must* end up doing sfence + pcommit because > e.g. journal writes going through block layer or writes done through > dax_do_io() must be on permanent storage once REQ_FLUSH request finishes > and the way driver does IO doesn't guarantee this, does it? Hum, and looking into how dax_do_io() works and what drivers/nvdimm/pmem.c does, I'm indeed wrong because they both do wmb_pmem() after each write which seems to include sfence + pcommit. Sorry for confusion. But a question: Won't it be better to do sfence + pcommit only in response to REQ_FLUSH request and don't do it after each write? I'm not sure how expensive these instructions are but in theory it could be a performance win, couldn't it? For filesystems this is enough wrt persistency guarantees... Honza -- Jan Kara <jack@suse.com> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2015-11-16 18:30 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qvvLk-1Mp-23@gated-at.bofh.it> |
| In reply to | #1270205 |
On Mon, Nov 16, 2015 at 6:05 AM, Jan Kara <jack@suse.cz> wrote: > On Mon 16-11-15 14:37:14, Jan Kara wrote: [..] > But a question: Won't it be better to do sfence + pcommit only in response > to REQ_FLUSH request and don't do it after each write? I'm not sure how > expensive these instructions are but in theory it could be a performance > win, couldn't it? For filesystems this is enough wrt persistency > guarantees... We would need to gather the performance data... The expectation is that the cache flushing is more expensive than the sfence + pcommit. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2015-11-16 20:50 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qvxWO-36X-19@gated-at.bofh.it> |
| In reply to | #1270405 |
On Mon, Nov 16, 2015 at 09:28:59AM -0800, Dan Williams wrote: > On Mon, Nov 16, 2015 at 6:05 AM, Jan Kara <jack@suse.cz> wrote: > > On Mon 16-11-15 14:37:14, Jan Kara wrote: > [..] > > But a question: Won't it be better to do sfence + pcommit only in response > > to REQ_FLUSH request and don't do it after each write? I'm not sure how > > expensive these instructions are but in theory it could be a performance > > win, couldn't it? For filesystems this is enough wrt persistency > > guarantees... > > We would need to gather the performance data... The expectation is > that the cache flushing is more expensive than the sfence + pcommit. I think we should revisit the idea of removing wmb_pmem() from the I/O path in both the PMEM driver and in DAX, and just relying on the REQ_FUA/REQ_FLUSH path to do wmb_pmem() for all cases. This was brought up in the thread dealing with the "big hammer" fsync/msync patches as well. https://lkml.org/lkml/2015/11/3/730 I think we can all agree from the start that wmb_pmem() will have a nonzero cost, both because of the PCOMMIT and because of the ordering caused by the sfence. If it's possible to avoid doing it on each I/O, I think that would be a win. So, here would be our new flows: PMEM I/O: write I/O(s) to the driver PMEM I/O writes the data using non-temporal stores REQ_FUA/REQ_FLUSH to the PMEM driver wmb_pmem() to order all previous writes and flushes, and to PCOMMIT the dirty data durably to the DIMMs DAX I/O: write I/O(s) to the DAX layer write the data using regular stores (eventually to be replaced with non-temporal stores) flush the data with wb_cache_pmem() (removed when we use non-temporal stores) REQ_FUA/REQ_FLUSH to the PMEM driver wmb_pmem() to order all previous writes and flushes, and to PCOMMIT the dirty data durably to the DIMMs DAX msync/fsync: writes happen to DAX mmaps from userspace DAX fsync/msync all dirty pages are written back using wb_cache_pmem() REQ_FUA/REQ_FLUSH to the PMEM driver wmb_pmem() to order all previous writes and flushes, and to PCOMMIT the dirty data durably to the DIMMs DAX/PMEM zeroing (suggested by Dave: https://lkml.org/lkml/2015/11/2/772): PMEM driver receives zeroing request writes a bunch of zeroes using non-temporal stores REQ_FUA/REQ_FLUSH to the PMEM driver wmb_pmem() to order all previous writes and flushes, and to PCOMMIT the dirty data durably to the DIMMs Having all these flows wait to do wmb_pmem() in the PMEM driver in response to REQ_FUA/REQ_FLUSH has several advantages: 1) The work done and guarantees provided after each step closely match the normal block I/O to disk case. This means that the existing algorithms used by filesystems to make sure that their metadata is ordered properly and synced at a known time should all work the same. 2) By delaying wmb_pmem() until REQ_FUA/REQ_FLUSH time we can potentially do many I/Os at different levels, and order them all with a single wmb_pmem(). This should result in a performance win. Is there any reason why this wouldn't work or wouldn't be a good idea? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2015-11-16 21:40 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qvyJc-3Ft-15@gated-at.bofh.it> |
| In reply to | #1270522 |
On Mon, Nov 16, 2015 at 11:48 AM, Ross Zwisler <ross.zwisler@linux.intel.com> wrote: > On Mon, Nov 16, 2015 at 09:28:59AM -0800, Dan Williams wrote: >> On Mon, Nov 16, 2015 at 6:05 AM, Jan Kara <jack@suse.cz> wrote: >> > On Mon 16-11-15 14:37:14, Jan Kara wrote: [..] > Is there any reason why this wouldn't work or wouldn't be a good idea? We don't have numbers to support the claim that pcommit is so expensive as to need be deferred, especially if the upper layers are already taking the hit on doing the flushes. REQ_FLUSH, means flush your volatile write cache. Currently all I/O through the driver never hits a volatile cache so there's no need to tell the block layer that we have a volatile write cache, especially when you have the core mm taking responsibility for doing cache maintenance for dax-mmap ranges. We also don't have numbers on if/when wbinvd is a more performant solution. tl;dr Now that we have a baseline implementation can we please use data to make future arch decisions? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2015-11-17 01:00 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qvBQK-5zm-19@gated-at.bofh.it> |
| In reply to | #1270560 |
On Mon, Nov 16, 2015 at 12:34:55PM -0800, Dan Williams wrote: > On Mon, Nov 16, 2015 at 11:48 AM, Ross Zwisler > <ross.zwisler@linux.intel.com> wrote: > > On Mon, Nov 16, 2015 at 09:28:59AM -0800, Dan Williams wrote: > >> On Mon, Nov 16, 2015 at 6:05 AM, Jan Kara <jack@suse.cz> wrote: > >> > On Mon 16-11-15 14:37:14, Jan Kara wrote: > [..] > > Is there any reason why this wouldn't work or wouldn't be a good idea? > > We don't have numbers to support the claim that pcommit is so > expensive as to need be deferred, especially if the upper layers are > already taking the hit on doing the flushes. > > REQ_FLUSH, means flush your volatile write cache. Currently all I/O > through the driver never hits a volatile cache so there's no need to > tell the block layer that we have a volatile write cache, especially > when you have the core mm taking responsibility for doing cache > maintenance for dax-mmap ranges. > > We also don't have numbers on if/when wbinvd is a more performant solution. > > tl;dr Now that we have a baseline implementation can we please use > data to make future arch decisions? Sure, fair enough. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Dave Chinner <david@fromorbit.com> |
|---|---|
| Date | 2015-11-16 23:20 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qvAhX-4Jx-3@gated-at.bofh.it> |
| In reply to | #1270205 |
On Mon, Nov 16, 2015 at 03:05:26PM +0100, Jan Kara wrote: > On Mon 16-11-15 14:37:14, Jan Kara wrote: > > On Fri 13-11-15 18:32:40, Dan Williams wrote: > > > On Fri, Nov 13, 2015 at 4:43 PM, Andreas Dilger <adilger@dilger.ca> wrote: > > > > On Nov 13, 2015, at 5:20 PM, Dan Williams <dan.j.williams@intel.com> wrote: > > > >> > > > >> On Fri, Nov 13, 2015 at 4:06 PM, Ross Zwisler > > > >> <ross.zwisler@linux.intel.com> wrote: > > > >>> Currently the PMEM driver doesn't accept REQ_FLUSH or REQ_FUA bios. These > > > >>> are sent down via blkdev_issue_flush() in response to a fsync() or msync() > > > >>> and are used by filesystems to order their metadata, among other things. > > > >>> > > > >>> When we get an msync() or fsync() it is the responsibility of the DAX code > > > >>> to flush all dirty pages to media. The PMEM driver then just has issue a > > > >>> wmb_pmem() in response to the REQ_FLUSH to ensure that before we return all > > > >>> the flushed data has been durably stored on the media. > > > >>> > > > >>> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> > > > >> > > > >> Hmm, I'm not seeing why we need this patch. If the actual flushing of > > > >> the cache is done by the core why does the driver need support > > > >> REQ_FLUSH? Especially since it's just a couple instructions. REQ_FUA > > > >> only makes sense if individual writes can bypass the "drive" cache, > > > >> but no I/O submitted to the driver proper is ever cached we always > > > >> flush it through to media. > > > > > > > > If the upper level filesystem gets an error when submitting a flush > > > > request, then it assumes the underlying hardware is broken and cannot > > > > be as aggressive in IO submission, but instead has to wait for in-flight > > > > IO to complete. > > > > > > Upper level filesystems won't get errors when the driver does not > > > support flush. Those requests are ended cleanly in > > > generic_make_request_checks(). Yes, the fs still needs to wait for > > > outstanding I/O to complete but in the case of pmem all I/O is > > > synchronous. There's never anything to await when flushing at the > > > pmem driver level. > > > > > > > Since FUA/FLUSH is basically a no-op for pmem devices, > > > > it doesn't make sense _not_ to support this functionality. > > > > > > Seems to be a nop either way. Given that DAX may lead to dirty data > > > pending to the device in the cpu cache that a REQ_FLUSH request will > > > not touch, its better to leave it all to the mm core to handle. I.e. > > > it doesn't make sense to call the driver just for two instructions > > > (sfence + pcommit) when the mm core is taking on the cache flushing. > > > Either handle it all in the mm or the driver, not a mixture. > > > > So I think REQ_FLUSH requests *must* end up doing sfence + pcommit because > > e.g. journal writes going through block layer or writes done through > > dax_do_io() must be on permanent storage once REQ_FLUSH request finishes > > and the way driver does IO doesn't guarantee this, does it? > > Hum, and looking into how dax_do_io() works and what drivers/nvdimm/pmem.c > does, I'm indeed wrong because they both do wmb_pmem() after each write > which seems to include sfence + pcommit. Sorry for confusion. Which I want to remove, because it makes DAX IO 3x slower than buffered IO on ramdisk based testing. > But a question: Won't it be better to do sfence + pcommit only in response > to REQ_FLUSH request and don't do it after each write? I'm not sure how > expensive these instructions are but in theory it could be a performance > win, couldn't it? For filesystems this is enough wrt persistency > guarantees... I'm pretty sure it would be, because all of the overhead (and therefore latency) I measured is in the cache flushing instructions. But before we can remove the wmb_pmem() from dax_do_io(), we need the underlying device to support REQ_FLUSH correctly... Cheers, Dave. -- Dave Chinner david@fromorbit.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2015-11-17 00:30 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qvBnI-5nT-17@gated-at.bofh.it> |
| In reply to | #1270640 |
On Tue, Nov 17, 2015 at 09:14:12AM +1100, Dave Chinner wrote: > On Mon, Nov 16, 2015 at 03:05:26PM +0100, Jan Kara wrote: > > On Mon 16-11-15 14:37:14, Jan Kara wrote: > > > On Fri 13-11-15 18:32:40, Dan Williams wrote: > > > > On Fri, Nov 13, 2015 at 4:43 PM, Andreas Dilger <adilger@dilger.ca> wrote: > > > > > On Nov 13, 2015, at 5:20 PM, Dan Williams <dan.j.williams@intel.com> wrote: > > > > >> > > > > >> On Fri, Nov 13, 2015 at 4:06 PM, Ross Zwisler > > > > >> <ross.zwisler@linux.intel.com> wrote: > > > > >>> Currently the PMEM driver doesn't accept REQ_FLUSH or REQ_FUA bios. These > > > > >>> are sent down via blkdev_issue_flush() in response to a fsync() or msync() > > > > >>> and are used by filesystems to order their metadata, among other things. > > > > >>> > > > > >>> When we get an msync() or fsync() it is the responsibility of the DAX code > > > > >>> to flush all dirty pages to media. The PMEM driver then just has issue a > > > > >>> wmb_pmem() in response to the REQ_FLUSH to ensure that before we return all > > > > >>> the flushed data has been durably stored on the media. > > > > >>> > > > > >>> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> > > > > >> > > > > >> Hmm, I'm not seeing why we need this patch. If the actual flushing of > > > > >> the cache is done by the core why does the driver need support > > > > >> REQ_FLUSH? Especially since it's just a couple instructions. REQ_FUA > > > > >> only makes sense if individual writes can bypass the "drive" cache, > > > > >> but no I/O submitted to the driver proper is ever cached we always > > > > >> flush it through to media. > > > > > > > > > > If the upper level filesystem gets an error when submitting a flush > > > > > request, then it assumes the underlying hardware is broken and cannot > > > > > be as aggressive in IO submission, but instead has to wait for in-flight > > > > > IO to complete. > > > > > > > > Upper level filesystems won't get errors when the driver does not > > > > support flush. Those requests are ended cleanly in > > > > generic_make_request_checks(). Yes, the fs still needs to wait for > > > > outstanding I/O to complete but in the case of pmem all I/O is > > > > synchronous. There's never anything to await when flushing at the > > > > pmem driver level. > > > > > > > > > Since FUA/FLUSH is basically a no-op for pmem devices, > > > > > it doesn't make sense _not_ to support this functionality. > > > > > > > > Seems to be a nop either way. Given that DAX may lead to dirty data > > > > pending to the device in the cpu cache that a REQ_FLUSH request will > > > > not touch, its better to leave it all to the mm core to handle. I.e. > > > > it doesn't make sense to call the driver just for two instructions > > > > (sfence + pcommit) when the mm core is taking on the cache flushing. > > > > Either handle it all in the mm or the driver, not a mixture. > > > > > > So I think REQ_FLUSH requests *must* end up doing sfence + pcommit because > > > e.g. journal writes going through block layer or writes done through > > > dax_do_io() must be on permanent storage once REQ_FLUSH request finishes > > > and the way driver does IO doesn't guarantee this, does it? > > > > Hum, and looking into how dax_do_io() works and what drivers/nvdimm/pmem.c > > does, I'm indeed wrong because they both do wmb_pmem() after each write > > which seems to include sfence + pcommit. Sorry for confusion. > > Which I want to remove, because it makes DAX IO 3x slower than > buffered IO on ramdisk based testing. > > > But a question: Won't it be better to do sfence + pcommit only in response > > to REQ_FLUSH request and don't do it after each write? I'm not sure how > > expensive these instructions are but in theory it could be a performance > > win, couldn't it? For filesystems this is enough wrt persistency > > guarantees... > > I'm pretty sure it would be, because all of the overhead (and > therefore latency) I measured is in the cache flushing instructions. > But before we can remove the wmb_pmem() from dax_do_io(), we need > the underlying device to support REQ_FLUSH correctly... By "support REQ_FLUSH correctly" do you mean call wmb_pmem() as I do in my set? Or do you mean something that also involves cache flushing such as the "big hammer" that flushes everything or something like WBINVD? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Dave Chinner <david@fromorbit.com> |
|---|---|
| Date | 2015-11-17 00:50 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qvBH3-5vs-5@gated-at.bofh.it> |
| In reply to | #1270691 |
On Mon, Nov 16, 2015 at 04:29:27PM -0700, Ross Zwisler wrote: > On Tue, Nov 17, 2015 at 09:14:12AM +1100, Dave Chinner wrote: > > On Mon, Nov 16, 2015 at 03:05:26PM +0100, Jan Kara wrote: > > > On Mon 16-11-15 14:37:14, Jan Kara wrote: > > > > On Fri 13-11-15 18:32:40, Dan Williams wrote: > > > > > On Fri, Nov 13, 2015 at 4:43 PM, Andreas Dilger <adilger@dilger.ca> wrote: > > > > > > On Nov 13, 2015, at 5:20 PM, Dan Williams <dan.j.williams@intel.com> wrote: > > > > > >> > > > > > >> On Fri, Nov 13, 2015 at 4:06 PM, Ross Zwisler > > > > > >> <ross.zwisler@linux.intel.com> wrote: > > > > > >>> Currently the PMEM driver doesn't accept REQ_FLUSH or REQ_FUA bios. These > > > > > >>> are sent down via blkdev_issue_flush() in response to a fsync() or msync() > > > > > >>> and are used by filesystems to order their metadata, among other things. > > > > > >>> > > > > > >>> When we get an msync() or fsync() it is the responsibility of the DAX code > > > > > >>> to flush all dirty pages to media. The PMEM driver then just has issue a > > > > > >>> wmb_pmem() in response to the REQ_FLUSH to ensure that before we return all > > > > > >>> the flushed data has been durably stored on the media. > > > > > >>> > > > > > >>> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> > > > > > >> > > > > > >> Hmm, I'm not seeing why we need this patch. If the actual flushing of > > > > > >> the cache is done by the core why does the driver need support > > > > > >> REQ_FLUSH? Especially since it's just a couple instructions. REQ_FUA > > > > > >> only makes sense if individual writes can bypass the "drive" cache, > > > > > >> but no I/O submitted to the driver proper is ever cached we always > > > > > >> flush it through to media. > > > > > > > > > > > > If the upper level filesystem gets an error when submitting a flush > > > > > > request, then it assumes the underlying hardware is broken and cannot > > > > > > be as aggressive in IO submission, but instead has to wait for in-flight > > > > > > IO to complete. > > > > > > > > > > Upper level filesystems won't get errors when the driver does not > > > > > support flush. Those requests are ended cleanly in > > > > > generic_make_request_checks(). Yes, the fs still needs to wait for > > > > > outstanding I/O to complete but in the case of pmem all I/O is > > > > > synchronous. There's never anything to await when flushing at the > > > > > pmem driver level. > > > > > > > > > > > Since FUA/FLUSH is basically a no-op for pmem devices, > > > > > > it doesn't make sense _not_ to support this functionality. > > > > > > > > > > Seems to be a nop either way. Given that DAX may lead to dirty data > > > > > pending to the device in the cpu cache that a REQ_FLUSH request will > > > > > not touch, its better to leave it all to the mm core to handle. I.e. > > > > > it doesn't make sense to call the driver just for two instructions > > > > > (sfence + pcommit) when the mm core is taking on the cache flushing. > > > > > Either handle it all in the mm or the driver, not a mixture. > > > > > > > > So I think REQ_FLUSH requests *must* end up doing sfence + pcommit because > > > > e.g. journal writes going through block layer or writes done through > > > > dax_do_io() must be on permanent storage once REQ_FLUSH request finishes > > > > and the way driver does IO doesn't guarantee this, does it? > > > > > > Hum, and looking into how dax_do_io() works and what drivers/nvdimm/pmem.c > > > does, I'm indeed wrong because they both do wmb_pmem() after each write > > > which seems to include sfence + pcommit. Sorry for confusion. > > > > Which I want to remove, because it makes DAX IO 3x slower than > > buffered IO on ramdisk based testing. > > > > > But a question: Won't it be better to do sfence + pcommit only in response > > > to REQ_FLUSH request and don't do it after each write? I'm not sure how > > > expensive these instructions are but in theory it could be a performance > > > win, couldn't it? For filesystems this is enough wrt persistency > > > guarantees... > > > > I'm pretty sure it would be, because all of the overhead (and > > therefore latency) I measured is in the cache flushing instructions. > > But before we can remove the wmb_pmem() from dax_do_io(), we need > > the underlying device to support REQ_FLUSH correctly... > > By "support REQ_FLUSH correctly" do you mean call wmb_pmem() as I do in my > set? Or do you mean something that also involves cache flushing such as the > "big hammer" that flushes everything or something like WBINVD? Either. Both solve the problem of defering the cache flush penalty to the context that needs it.. Cheers, Dave. -- Dave Chinner david@fromorbit.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2015-11-16 21:10 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qvyga-3uf-7@gated-at.bofh.it> |
| In reply to | #1269393 |
On Fri, Nov 13, 2015 at 06:32:40PM -0800, Dan Williams wrote: > On Fri, Nov 13, 2015 at 4:43 PM, Andreas Dilger <adilger@dilger.ca> wrote: > > On Nov 13, 2015, at 5:20 PM, Dan Williams <dan.j.williams@intel.com> wrote: > >> > >> On Fri, Nov 13, 2015 at 4:06 PM, Ross Zwisler > >> <ross.zwisler@linux.intel.com> wrote: > >>> Currently the PMEM driver doesn't accept REQ_FLUSH or REQ_FUA bios. These > >>> are sent down via blkdev_issue_flush() in response to a fsync() or msync() > >>> and are used by filesystems to order their metadata, among other things. > >>> > >>> When we get an msync() or fsync() it is the responsibility of the DAX code > >>> to flush all dirty pages to media. The PMEM driver then just has issue a > >>> wmb_pmem() in response to the REQ_FLUSH to ensure that before we return all > >>> the flushed data has been durably stored on the media. > >>> > >>> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> > >> > >> Hmm, I'm not seeing why we need this patch. If the actual flushing of > >> the cache is done by the core why does the driver need support > >> REQ_FLUSH? Especially since it's just a couple instructions. REQ_FUA > >> only makes sense if individual writes can bypass the "drive" cache, > >> but no I/O submitted to the driver proper is ever cached we always > >> flush it through to media. > > > > If the upper level filesystem gets an error when submitting a flush > > request, then it assumes the underlying hardware is broken and cannot > > be as aggressive in IO submission, but instead has to wait for in-flight > > IO to complete. > > Upper level filesystems won't get errors when the driver does not > support flush. Those requests are ended cleanly in > generic_make_request_checks(). Yes, the fs still needs to wait for > outstanding I/O to complete but in the case of pmem all I/O is > synchronous. There's never anything to await when flushing at the > pmem driver level. > > > Since FUA/FLUSH is basically a no-op for pmem devices, > > it doesn't make sense _not_ to support this functionality. > > Seems to be a nop either way. Given that DAX may lead to dirty data > pending to the device in the cpu cache that a REQ_FLUSH request will > not touch, its better to leave it all to the mm core to handle. I.e. > it doesn't make sense to call the driver just for two instructions > (sfence + pcommit) when the mm core is taking on the cache flushing. > Either handle it all in the mm or the driver, not a mixture. Does anyone know if ext4 and/or XFS alter their algorithms based on whether the driver supports REQ_FLUSH/REQ_FUA? Will the filesystem behave more efficiently with respect to their internal I/O ordering, etc., if PMEM advertises REQ_FLUSH/REQ_FUA support, even though we could do the same thing at the DAX layer? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jan Kara <jack@suse.cz> |
|---|---|
| Date | 2015-11-18 11:50 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qw8tj-1Ir-3@gated-at.bofh.it> |
| In reply to | #1270539 |
On Mon 16-11-15 13:09:50, Ross Zwisler wrote: > On Fri, Nov 13, 2015 at 06:32:40PM -0800, Dan Williams wrote: > > On Fri, Nov 13, 2015 at 4:43 PM, Andreas Dilger <adilger@dilger.ca> wrote: > > > On Nov 13, 2015, at 5:20 PM, Dan Williams <dan.j.williams@intel.com> wrote: > > >> > > >> On Fri, Nov 13, 2015 at 4:06 PM, Ross Zwisler > > >> <ross.zwisler@linux.intel.com> wrote: > > >>> Currently the PMEM driver doesn't accept REQ_FLUSH or REQ_FUA bios. These > > >>> are sent down via blkdev_issue_flush() in response to a fsync() or msync() > > >>> and are used by filesystems to order their metadata, among other things. > > >>> > > >>> When we get an msync() or fsync() it is the responsibility of the DAX code > > >>> to flush all dirty pages to media. The PMEM driver then just has issue a > > >>> wmb_pmem() in response to the REQ_FLUSH to ensure that before we return all > > >>> the flushed data has been durably stored on the media. > > >>> > > >>> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> > > >> > > >> Hmm, I'm not seeing why we need this patch. If the actual flushing of > > >> the cache is done by the core why does the driver need support > > >> REQ_FLUSH? Especially since it's just a couple instructions. REQ_FUA > > >> only makes sense if individual writes can bypass the "drive" cache, > > >> but no I/O submitted to the driver proper is ever cached we always > > >> flush it through to media. > > > > > > If the upper level filesystem gets an error when submitting a flush > > > request, then it assumes the underlying hardware is broken and cannot > > > be as aggressive in IO submission, but instead has to wait for in-flight > > > IO to complete. > > > > Upper level filesystems won't get errors when the driver does not > > support flush. Those requests are ended cleanly in > > generic_make_request_checks(). Yes, the fs still needs to wait for > > outstanding I/O to complete but in the case of pmem all I/O is > > synchronous. There's never anything to await when flushing at the > > pmem driver level. > > > > > Since FUA/FLUSH is basically a no-op for pmem devices, > > > it doesn't make sense _not_ to support this functionality. > > > > Seems to be a nop either way. Given that DAX may lead to dirty data > > pending to the device in the cpu cache that a REQ_FLUSH request will > > not touch, its better to leave it all to the mm core to handle. I.e. > > it doesn't make sense to call the driver just for two instructions > > (sfence + pcommit) when the mm core is taking on the cache flushing. > > Either handle it all in the mm or the driver, not a mixture. > > Does anyone know if ext4 and/or XFS alter their algorithms based on whether > the driver supports REQ_FLUSH/REQ_FUA? Will the filesystem behave more > efficiently with respect to their internal I/O ordering, etc., if PMEM > advertises REQ_FLUSH/REQ_FUA support, even though we could do the same thing > at the DAX layer? So the information whether the driver supports FLUSH / FUA is generally ignored by filesystems. We issue REQ_FLUSH / REQ_FUA requests to achieve required ordering for fs consistency and expect that block layer does the right thing - i.e., if the device has volatile write cache, it will be flushed, if it doesn't have it, the request will be ignored. So the difference between supporting and not supporting REQ_FLUSH / REQ_FUA is only in how block layer handles such requests. Honza -- Jan Kara <jack@suse.com> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2015-11-18 17:20 +0100 |
| Subject | Re: [PATCH v2 03/11] pmem: enable REQ_FUA/REQ_FLUSH handling |
| Message-ID | <qwdCH-5iX-17@gated-at.bofh.it> |
| In reply to | #1272088 |
On Wed, Nov 18, 2015 at 11:40:55AM +0100, Jan Kara wrote: > On Mon 16-11-15 13:09:50, Ross Zwisler wrote: > > On Fri, Nov 13, 2015 at 06:32:40PM -0800, Dan Williams wrote: > > > On Fri, Nov 13, 2015 at 4:43 PM, Andreas Dilger <adilger@dilger.ca> wrote: > > > > On Nov 13, 2015, at 5:20 PM, Dan Williams <dan.j.williams@intel.com> wrote: > > > >> > > > >> On Fri, Nov 13, 2015 at 4:06 PM, Ross Zwisler > > > >> <ross.zwisler@linux.intel.com> wrote: > > > >>> Currently the PMEM driver doesn't accept REQ_FLUSH or REQ_FUA bios. These > > > >>> are sent down via blkdev_issue_flush() in response to a fsync() or msync() > > > >>> and are used by filesystems to order their metadata, among other things. > > > >>> > > > >>> When we get an msync() or fsync() it is the responsibility of the DAX code > > > >>> to flush all dirty pages to media. The PMEM driver then just has issue a > > > >>> wmb_pmem() in response to the REQ_FLUSH to ensure that before we return all > > > >>> the flushed data has been durably stored on the media. > > > >>> > > > >>> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> > > > >> > > > >> Hmm, I'm not seeing why we need this patch. If the actual flushing of > > > >> the cache is done by the core why does the driver need support > > > >> REQ_FLUSH? Especially since it's just a couple instructions. REQ_FUA > > > >> only makes sense if individual writes can bypass the "drive" cache, > > > >> but no I/O submitted to the driver proper is ever cached we always > > > >> flush it through to media. > > > > > > > > If the upper level filesystem gets an error when submitting a flush > > > > request, then it assumes the underlying hardware is broken and cannot > > > > be as aggressive in IO submission, but instead has to wait for in-flight > > > > IO to complete. > > > > > > Upper level filesystems won't get errors when the driver does not > > > support flush. Those requests are ended cleanly in > > > generic_make_request_checks(). Yes, the fs still needs to wait for > > > outstanding I/O to complete but in the case of pmem all I/O is > > > synchronous. There's never anything to await when flushing at the > > > pmem driver level. > > > > > > > Since FUA/FLUSH is basically a no-op for pmem devices, > > > > it doesn't make sense _not_ to support this functionality. > > > > > > Seems to be a nop either way. Given that DAX may lead to dirty data > > > pending to the device in the cpu cache that a REQ_FLUSH request will > > > not touch, its better to leave it all to the mm core to handle. I.e. > > > it doesn't make sense to call the driver just for two instructions > > > (sfence + pcommit) when the mm core is taking on the cache flushing. > > > Either handle it all in the mm or the driver, not a mixture. > > > > Does anyone know if ext4 and/or XFS alter their algorithms based on whether > > the driver supports REQ_FLUSH/REQ_FUA? Will the filesystem behave more > > efficiently with respect to their internal I/O ordering, etc., if PMEM > > advertises REQ_FLUSH/REQ_FUA support, even though we could do the same thing > > at the DAX layer? > > So the information whether the driver supports FLUSH / FUA is generally > ignored by filesystems. We issue REQ_FLUSH / REQ_FUA requests to achieve > required ordering for fs consistency and expect that block layer does the > right thing - i.e., if the device has volatile write cache, it will be > flushed, if it doesn't have it, the request will be ignored. So the > difference between supporting and not supporting REQ_FLUSH / REQ_FUA is > only in how block layer handles such requests. Cool, thank you for the info. Based on this I'll pull out the REQ_FLUSH/REQ_FUA patch for v3 of this series and move the wmb_pmem() call up to DAX as Dan suggests. If performance data shows that we can get a benefit from centralizing wmb_pmem() behind REQ_FUA/REQ_FLUSH, I'll add it back in later as part of that series. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2015-11-14 01:20 +0100 |
| Subject | [PATCH v2 06/11] mm: add pgoff_mkclean() |
| Message-ID | <quwJs-4ZF-15@gated-at.bofh.it> |
| In reply to | #1269363 |
Introduce pgoff_mkclean() which conceptually is similar to page_mkclean()
except it works in the absence of struct page and it can also be used to
clean PMDs. This is needed for DAX's dirty page handling.
pgoff_mkclean() doesn't return an error for a missing PTE/PMD when looping
through the VMAs because it's not a requirement that each of the
potentially many VMAs associated with a given struct address_space have a
mapping set up for our pgoff.
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
include/linux/rmap.h | 5 +++++
mm/rmap.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 29446ae..171a4ac 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -223,6 +223,11 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
int page_mkclean(struct page *);
/*
+ * Cleans and write protects the PTEs of shared mappings.
+ */
+void pgoff_mkclean(pgoff_t, struct address_space *);
+
+/*
* called in munlock()/munmap() path to check for other vmas holding
* the page mlocked.
*/
diff --git a/mm/rmap.c b/mm/rmap.c
index f5b5c1f..8114862 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -586,6 +586,16 @@ vma_address(struct page *page, struct vm_area_struct *vma)
return address;
}
+static inline unsigned long
+pgoff_address(pgoff_t pgoff, struct vm_area_struct *vma)
+{
+ unsigned long address;
+
+ address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
+ VM_BUG_ON_VMA(address < vma->vm_start || address >= vma->vm_end, vma);
+ return address;
+}
+
#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
static void percpu_flush_tlb_batch_pages(void *data)
{
@@ -1040,6 +1050,47 @@ int page_mkclean(struct page *page)
}
EXPORT_SYMBOL_GPL(page_mkclean);
+void pgoff_mkclean(pgoff_t pgoff, struct address_space *mapping)
+{
+ struct vm_area_struct *vma;
+ int ret = 0;
+
+ i_mmap_lock_read(mapping);
+ vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {
+ struct mm_struct *mm = vma->vm_mm;
+ pmd_t pmd, *pmdp = NULL;
+ pte_t pte, *ptep = NULL;
+ unsigned long address;
+ spinlock_t *ptl;
+
+ address = pgoff_address(pgoff, vma);
+
+ /* when this returns successfully ptl is locked */
+ ret = follow_pte_pmd(mm, address, &ptep, &pmdp, &ptl);
+ if (ret)
+ continue;
+
+ if (pmdp) {
+ flush_cache_page(vma, address, pmd_pfn(*pmdp));
+ pmd = pmdp_huge_clear_flush(vma, address, pmdp);
+ pmd = pmd_wrprotect(pmd);
+ pmd = pmd_mkclean(pmd);
+ set_pmd_at(mm, address, pmdp, pmd);
+ spin_unlock(ptl);
+ } else {
+ BUG_ON(!ptep);
+ flush_cache_page(vma, address, pte_pfn(*ptep));
+ pte = ptep_clear_flush(vma, address, ptep);
+ pte = pte_wrprotect(pte);
+ pte = pte_mkclean(pte);
+ set_pte_at(mm, address, ptep, pte);
+ pte_unmap_unlock(ptep, ptl);
+ }
+ }
+ i_mmap_unlock_read(mapping);
+}
+EXPORT_SYMBOL_GPL(pgoff_mkclean);
+
/**
* page_move_anon_rmap - move a page to our anon_vma
* @page: the page to move to our anon_vma
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2015-11-14 01:20 +0100 |
| Subject | [PATCH v2 02/11] mm: add pmd_mkclean() |
| Message-ID | <quwJs-4ZF-17@gated-at.bofh.it> |
| In reply to | #1269363 |
Currently PMD pages can be dirtied via pmd_mkdirty(), but cannot be
cleaned. For DAX mmap dirty page tracking we need to be able to clean PMD
pages when we flush them to media so that we get a new write fault the next
time the are written to.
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
arch/x86/include/asm/pgtable.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 867da5b..c548e4c 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -277,6 +277,11 @@ static inline pmd_t pmd_mkdirty(pmd_t pmd)
return pmd_set_flags(pmd, _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
}
+static inline pmd_t pmd_mkclean(pmd_t pmd)
+{
+ return pmd_clear_flags(pmd, _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
+}
+
static inline pmd_t pmd_mkhuge(pmd_t pmd)
{
return pmd_set_flags(pmd, _PAGE_PSE);
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Dave Hansen <dave.hansen@intel.com> |
|---|---|
| Date | 2015-11-14 02:10 +0100 |
| Subject | Re: [PATCH v2 02/11] mm: add pmd_mkclean() |
| Message-ID | <quxvQ-5zy-9@gated-at.bofh.it> |
| In reply to | #1269374 |
On 11/13/2015 04:06 PM, Ross Zwisler wrote:
> +static inline pmd_t pmd_mkclean(pmd_t pmd)
> +{
> + return pmd_clear_flags(pmd, _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
> +}
pte_mkclean() doesn't clear _PAGE_SOFT_DIRTY. What the thought behind
doing it here?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2015-11-17 19:00 +0100 |
| Subject | Re: [PATCH v2 02/11] mm: add pmd_mkclean() |
| Message-ID | <qvSHV-8dG-17@gated-at.bofh.it> |
| In reply to | #1269386 |
On Fri, Nov 13, 2015 at 05:02:48PM -0800, Dave Hansen wrote:
> On 11/13/2015 04:06 PM, Ross Zwisler wrote:
> > +static inline pmd_t pmd_mkclean(pmd_t pmd)
> > +{
> > + return pmd_clear_flags(pmd, _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
> > +}
>
> pte_mkclean() doesn't clear _PAGE_SOFT_DIRTY. What the thought behind
> doing it here?
I just wrote it to undo the work done by pmd_mkdirty() - you're right, it
should mirror the work done by pte_mkclean() and not clear _PAGE_SOFT_DIRTY.
I'll fix this for v3, thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2015-11-14 01:20 +0100 |
| Subject | [PATCH v2 04/11] dax: support dirty DAX entries in radix tree |
| Message-ID | <quwJs-4ZF-1@gated-at.bofh.it> |
| In reply to | #1269363 |
Add support for tracking dirty DAX entries in the struct address_space
radix tree. This tree is already used for dirty page writeback, and it
already supports the use of exceptional (non struct page*) entries.
In order to properly track dirty DAX pages we will insert new exceptional
entries into the radix tree that represent dirty DAX PTE or PMD pages.
These exceptional entries will also contain the writeback addresses for the
PTE or PMD faults that we can use at fsync/msync time.
There are currently two types of exceptional entries (shmem and shadow)
that can be placed into the radix tree, and this adds a third. There
shouldn't be any collisions between these various exceptional entries
because only one type of exceptional entry should be able to be found in a
radix tree at a time depending on how it is being used.
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
fs/block_dev.c | 3 ++-
fs/inode.c | 1 +
include/linux/dax.h | 5 ++++
include/linux/fs.h | 1 +
include/linux/radix-tree.h | 8 ++++++
mm/filemap.c | 10 +++++---
mm/truncate.c | 62 ++++++++++++++++++++++++++--------------------
7 files changed, 59 insertions(+), 31 deletions(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 073bb57..afaaf44 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -66,7 +66,8 @@ void kill_bdev(struct block_device *bdev)
{
struct address_space *mapping = bdev->bd_inode->i_mapping;
- if (mapping->nrpages == 0 && mapping->nrshadows == 0)
+ if (mapping->nrpages == 0 && mapping->nrshadows == 0 &&
+ mapping->nrdax == 0)
return;
invalidate_bh_lrus();
diff --git a/fs/inode.c b/fs/inode.c
index 78a17b8..f7c87a6 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -496,6 +496,7 @@ void clear_inode(struct inode *inode)
spin_lock_irq(&inode->i_data.tree_lock);
BUG_ON(inode->i_data.nrpages);
BUG_ON(inode->i_data.nrshadows);
+ BUG_ON(inode->i_data.nrdax);
spin_unlock_irq(&inode->i_data.tree_lock);
BUG_ON(!list_empty(&inode->i_data.private_list));
BUG_ON(!(inode->i_state & I_FREEING));
diff --git a/include/linux/dax.h b/include/linux/dax.h
index b415e52..e9d57f68 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -36,4 +36,9 @@ static inline bool vma_is_dax(struct vm_area_struct *vma)
{
return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host);
}
+
+static inline bool dax_mapping(struct address_space *mapping)
+{
+ return mapping->host && IS_DAX(mapping->host);
+}
#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 72d8a84..f791698 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -433,6 +433,7 @@ struct address_space {
/* Protected by tree_lock together with the radix tree */
unsigned long nrpages; /* number of total pages */
unsigned long nrshadows; /* number of shadow entries */
+ unsigned long nrdax; /* number of DAX entries */
pgoff_t writeback_index;/* writeback starts here */
const struct address_space_operations *a_ops; /* methods */
unsigned long flags; /* error bits/gfp mask */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 33170db..19a533a 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -51,6 +51,14 @@
#define RADIX_TREE_EXCEPTIONAL_ENTRY 2
#define RADIX_TREE_EXCEPTIONAL_SHIFT 2
+#define RADIX_DAX_MASK 0xf
+#define RADIX_DAX_PTE (0x4 | RADIX_TREE_EXCEPTIONAL_ENTRY)
+#define RADIX_DAX_PMD (0x8 | RADIX_TREE_EXCEPTIONAL_ENTRY)
+#define RADIX_DAX_TYPE(entry) ((__force u64)entry & RADIX_DAX_MASK)
+#define RADIX_DAX_ADDR(entry) ((void __pmem *)((u64)entry & ~RADIX_DAX_MASK))
+#define RADIX_DAX_PTE_ENTRY(addr) ((void *)((__force u64)addr | RADIX_DAX_PTE))
+#define RADIX_DAX_PMD_ENTRY(addr) ((void *)((__force u64)addr | RADIX_DAX_PMD))
+
static inline int radix_tree_is_indirect_ptr(void *ptr)
{
return (int)((unsigned long)ptr & RADIX_TREE_INDIRECT_PTR);
diff --git a/mm/filemap.c b/mm/filemap.c
index 327910c..d5e94fd 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -11,6 +11,7 @@
*/
#include <linux/export.h>
#include <linux/compiler.h>
+#include <linux/dax.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/capability.h>
@@ -538,6 +539,9 @@ static int page_cache_tree_insert(struct address_space *mapping,
p = radix_tree_deref_slot_protected(slot, &mapping->tree_lock);
if (!radix_tree_exceptional_entry(p))
return -EEXIST;
+
+ BUG_ON(dax_mapping(mapping));
+
if (shadowp)
*shadowp = p;
mapping->nrshadows--;
@@ -1201,9 +1205,9 @@ repeat:
if (radix_tree_deref_retry(page))
goto restart;
/*
- * A shadow entry of a recently evicted page,
- * or a swap entry from shmem/tmpfs. Return
- * it without attempting to raise page count.
+ * A shadow entry of a recently evicted page, a swap
+ * entry from shmem/tmpfs or a DAX entry. Return it
+ * without attempting to raise page count.
*/
goto export;
}
diff --git a/mm/truncate.c b/mm/truncate.c
index 76e35ad..32d2964 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/backing-dev.h>
+#include <linux/dax.h>
#include <linux/gfp.h>
#include <linux/mm.h>
#include <linux/swap.h>
@@ -34,31 +35,37 @@ static void clear_exceptional_entry(struct address_space *mapping,
return;
spin_lock_irq(&mapping->tree_lock);
- /*
- * Regular page slots are stabilized by the page lock even
- * without the tree itself locked. These unlocked entries
- * need verification under the tree lock.
- */
- if (!__radix_tree_lookup(&mapping->page_tree, index, &node, &slot))
- goto unlock;
- if (*slot != entry)
- goto unlock;
- radix_tree_replace_slot(slot, NULL);
- mapping->nrshadows--;
- if (!node)
- goto unlock;
- workingset_node_shadows_dec(node);
- /*
- * Don't track node without shadow entries.
- *
- * Avoid acquiring the list_lru lock if already untracked.
- * The list_empty() test is safe as node->private_list is
- * protected by mapping->tree_lock.
- */
- if (!workingset_node_shadows(node) &&
- !list_empty(&node->private_list))
- list_lru_del(&workingset_shadow_nodes, &node->private_list);
- __radix_tree_delete_node(&mapping->page_tree, node);
+
+ if (dax_mapping(mapping)) {
+ radix_tree_delete(&mapping->page_tree, index);
+ mapping->nrdax--;
+ } else {
+ /*
+ * Regular page slots are stabilized by the page lock even
+ * without the tree itself locked. These unlocked entries
+ * need verification under the tree lock.
+ */
+ if (!__radix_tree_lookup(&mapping->page_tree, index, &node, &slot))
+ goto unlock;
+ if (*slot != entry)
+ goto unlock;
+ radix_tree_replace_slot(slot, NULL);
+ mapping->nrshadows--;
+ if (!node)
+ goto unlock;
+ workingset_node_shadows_dec(node);
+ /*
+ * Don't track node without shadow entries.
+ *
+ * Avoid acquiring the list_lru lock if already untracked.
+ * The list_empty() test is safe as node->private_list is
+ * protected by mapping->tree_lock.
+ */
+ if (!workingset_node_shadows(node) &&
+ !list_empty(&node->private_list))
+ list_lru_del(&workingset_shadow_nodes, &node->private_list);
+ __radix_tree_delete_node(&mapping->page_tree, node);
+ }
unlock:
spin_unlock_irq(&mapping->tree_lock);
}
@@ -228,7 +235,8 @@ void truncate_inode_pages_range(struct address_space *mapping,
int i;
cleancache_invalidate_inode(mapping);
- if (mapping->nrpages == 0 && mapping->nrshadows == 0)
+ if (mapping->nrpages == 0 && mapping->nrshadows == 0 &&
+ mapping->nrdax == 0)
return;
/* Offsets within partial pages */
@@ -423,7 +431,7 @@ void truncate_inode_pages_final(struct address_space *mapping)
smp_rmb();
nrshadows = mapping->nrshadows;
- if (nrpages || nrshadows) {
+ if (nrpages || nrshadows || mapping->nrdax) {
/*
* As truncation uses a lockless tree lookup, cycle
* the tree lock to make sure any ongoing tree
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jan Kara <jack@suse.cz> |
|---|---|
| Date | 2015-11-16 15:50 +0100 |
| Message-ID | <qvtgv-6H-41@gated-at.bofh.it> |
| In reply to | #1269363 |
On Fri 13-11-15 17:06:39, Ross Zwisler wrote: > This patch series adds support for fsync/msync to DAX. > > Patches 1 through 7 add various utilities that the DAX code will eventually > need, and the DAX code itself is added by patch 8. Patches 9-11 update the > three filesystems that currently support DAX, ext2, ext4 and XFS, to use > the new DAX fsync/msync code. > > These patches build on the recent DAX locking changes from Dave Chinner, > Jan Kara and myself. Dave's changes for XFS and my changes for ext2 have > been merged in the v4.4 window, but Jan's are still unmerged. You can grab > them here: > > http://www.spinics.net/lists/linux-ext4/msg49951.html I had a quick look and the patches look sane to me. I'll try to give them more detailed look later this week. When thinking about the general design I was wondering: When we have this infrastructure to track data potentially lingering in CPU caches, would not it be a performance win to use standard cached stores in dax_io() and mark corresponding pages as dirty in page cache the same way as this patch set does it for mmaped writes? I have no idea how costly are non-temporal stores compared to cached ones and how would this compare to the cost of dirty tracking so this may be just completely bogus... Honza -- Jan Kara <jack@suse.com> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2015-11-16 18:00 +0100 |
| Message-ID | <qvvii-1lM-21@gated-at.bofh.it> |
| In reply to | #1270255 |
On Mon, Nov 16, 2015 at 6:41 AM, Jan Kara <jack@suse.cz> wrote: > On Fri 13-11-15 17:06:39, Ross Zwisler wrote: >> This patch series adds support for fsync/msync to DAX. >> >> Patches 1 through 7 add various utilities that the DAX code will eventually >> need, and the DAX code itself is added by patch 8. Patches 9-11 update the >> three filesystems that currently support DAX, ext2, ext4 and XFS, to use >> the new DAX fsync/msync code. >> >> These patches build on the recent DAX locking changes from Dave Chinner, >> Jan Kara and myself. Dave's changes for XFS and my changes for ext2 have >> been merged in the v4.4 window, but Jan's are still unmerged. You can grab >> them here: >> >> http://www.spinics.net/lists/linux-ext4/msg49951.html > > I had a quick look and the patches look sane to me. I'll try to give them > more detailed look later this week. When thinking about the general design > I was wondering: When we have this infrastructure to track data potentially > lingering in CPU caches, would not it be a performance win to use standard > cached stores in dax_io() and mark corresponding pages as dirty in page > cache the same way as this patch set does it for mmaped writes? I have no > idea how costly are non-temporal stores compared to cached ones and how > would this compare to the cost of dirty tracking so this may be just > completely bogus... Keep in mind that this approach will flush every virtual address that may be dirty. For example, if you touch 1byte in a 2MB page we'll end up looping through the entire 2MB range. At some point the dirty size becomes large enough that is cheaper to flush the entire cache, we have not measured where that crossover point is. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2015-11-16 21:10 +0100 |
| Message-ID | <qvyga-3uf-17@gated-at.bofh.it> |
| In reply to | #1270376 |
On Mon, Nov 16, 2015 at 08:58:11AM -0800, Dan Williams wrote: > On Mon, Nov 16, 2015 at 6:41 AM, Jan Kara <jack@suse.cz> wrote: > > On Fri 13-11-15 17:06:39, Ross Zwisler wrote: > >> This patch series adds support for fsync/msync to DAX. > >> > >> Patches 1 through 7 add various utilities that the DAX code will eventually > >> need, and the DAX code itself is added by patch 8. Patches 9-11 update the > >> three filesystems that currently support DAX, ext2, ext4 and XFS, to use > >> the new DAX fsync/msync code. > >> > >> These patches build on the recent DAX locking changes from Dave Chinner, > >> Jan Kara and myself. Dave's changes for XFS and my changes for ext2 have > >> been merged in the v4.4 window, but Jan's are still unmerged. You can grab > >> them here: > >> > >> http://www.spinics.net/lists/linux-ext4/msg49951.html > > > > I had a quick look and the patches look sane to me. I'll try to give them > > more detailed look later this week. When thinking about the general design > > I was wondering: When we have this infrastructure to track data potentially > > lingering in CPU caches, would not it be a performance win to use standard > > cached stores in dax_io() and mark corresponding pages as dirty in page > > cache the same way as this patch set does it for mmaped writes? I have no > > idea how costly are non-temporal stores compared to cached ones and how > > would this compare to the cost of dirty tracking so this may be just > > completely bogus... > > Keep in mind that this approach will flush every virtual address that > may be dirty. For example, if you touch 1byte in a 2MB page we'll end > up looping through the entire 2MB range. At some point the dirty size > becomes large enough that is cheaper to flush the entire cache, we > have not measured where that crossover point is. Yep, I expect there will be a crossover point where flushing the entire processor cache will be beneficial. I agree with Dan that we'll need to figure this out via measurement, and that we'd similarly need measurements to justify the decision to write dirty data at the DAX level without flushing and mark entries as dirty for fsync/msync to clean up later. It could turn out to be great, but we'll have to see. :) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.kernel
csiph-web