From: Boaz Harrosh <boaz@plexistor.com>
To: Matthew Wilcox <matthew.r.wilcox@intel.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Matthew Wilcox <willy@linux.intel.com>
Subject: Re: [PATCH v2 2/6] dax: Use copy_from_iter_nocache
Date: Sun, 05 Jul 2015 16:11:07 +0300 [thread overview]
Message-ID: <55992CEB.60004@plexistor.com> (raw)
In-Reply-To: <1435934443-17090-3-git-send-email-matthew.r.wilcox@intel.com>
On 07/03/2015 05:40 PM, Matthew Wilcox wrote:
> From: Matthew Wilcox <willy@linux.intel.com>
>
> When userspace does a write, there's no need for the written data to
> pollute the CPU cache. This matches the original XIP code.
>
> Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
> ---
> fs/dax.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index 99b5fbc..eaa9e06 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -155,7 +155,7 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
> }
>
> if (iov_iter_rw(iter) == WRITE)
> - len = copy_from_iter(addr, max - pos, iter);
> + len = copy_from_iter_nocache(addr, max - pos, iter);
> else if (!hole)
> len = copy_to_iter(addr, max - pos, iter);
> else
>
With the current ioremap_nocache at pmem none of this matters for pmem.
For brd yes, so We've been conducting some measurements and regular ext4
(no DAX) benchmark gives 6-16% increase in performance with this above.
And DAX is almost x2 then no DAX.
Is why the network guys been using this for a long time. So I'd say this
is a good default for any page-cache writes. (Think about it it makes sense,
we will 95% of the time flush these to real memory before DMA)
For pmem with any sane cached mapping (We use page-stuct-pmem actually)
Then DAX, for it to actually work (persist) with pmem, needs this:
static size_t copy_from_iter_nt(void *addr, size_t bytes, struct iov_iter *ii)
{
size_t ret = copy_from_iter_nocache(addr, bytes, ii);
if (unlikely((ii->type & ITER_BVEC) || (ii->type & ITER_KVEC))) {
/* FIXME: copy_from_iter_nocache did regular copy for Kernel
* buffers (BVEC or KVEC). Before we fix it do cl_flush
* for now.
*/
cl_flush(addr, bytes, false);
} else {
/* copy_from_iter_nocache only persists in 8-byte aligned words.
* Lets persist remaining unaligned edges.
*/
if (unlikely((ulong)addr & 0x7))
cl_flush(addr, 1, false);
if (unlikely((ulong)(addr + bytes) & 0x7))
cl_flush((addr + bytes), 1, false);
}
return ret;
}
This is based on an not-in-kernel cl_flush().
The first part FIXME above could be fixed with Dan's memcpy_persistent() patches
Cheers
Boaz
next prev parent reply other threads:[~2015-07-05 13:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-03 14:40 [PATCH v2 0/6] Miscellaneous DAX patches, take 2 Matthew Wilcox
2015-07-03 14:40 ` [PATCH v2 1/6] dax: Add block size note to documentation Matthew Wilcox
2015-07-04 5:03 ` Christoph Hellwig
2015-07-05 8:43 ` Boaz Harrosh
2015-07-03 14:40 ` [PATCH v2 2/6] dax: Use copy_from_iter_nocache Matthew Wilcox
2015-07-05 13:11 ` Boaz Harrosh [this message]
2015-07-03 14:40 ` [PATCH v2 3/6] ext4: Use ext4_get_block_write() for DAX Matthew Wilcox
2015-07-03 18:30 ` Theodore Ts'o
2015-07-03 18:48 ` Matthew Wilcox
2015-07-03 19:07 ` Theodore Ts'o
2015-07-05 13:29 ` Boaz Harrosh
2015-07-03 14:40 ` [PATCH v2 4/6] vfs: Allow truncate, chomd and chown to be interrupted by fatal signals Matthew Wilcox
2015-07-03 14:40 ` [PATCH v2 5/6] block: Add support for DAX reads/writes to block devices Matthew Wilcox
2015-07-05 13:47 ` Boaz Harrosh
2015-07-03 14:40 ` [PATCH v2 6/6] dax: bdev_direct_access() may sleep Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55992CEB.60004@plexistor.com \
--to=boaz@plexistor.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.r.wilcox@intel.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).