From: "Kani, Toshimitsu" <toshi.kani@hpe.com>
To: "viro@ZenIV.linux.org.uk" <viro@ZenIV.linux.org.uk>,
"Boylston, Brian" <brian.boylston@hpe.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
"Moreno," Oliver" <oliver.moreno@hpe.com>,
"x86@kernel.org, " <x86@kernel.org>,
linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"tglx@linutronix.de" <tglx@linutronix.de>
Subject: Re: [PATCH] use a nocache copy for bvecs in copy_from_iter_nocache()
Date: Mon, 10 Oct 2016 15:26:03 +0000 [thread overview]
Message-ID: <1476113071.20881.15.camel@hpe.com> (raw)
In-Reply-To: <20161007170842.GQ19539@ZenIV.linux.org.uk>
On Fri, 2016-10-07 at 18:08 +0100, Al Viro wrote:
> On Fri, Oct 07, 2016 at 10:55:11AM -0500, Brian Boylston wrote:
> >
> > copy_from_iter_nocache() is only "nocache" for iovecs. Enhance it
> > to also use a nocache copy for bvecs. This improves performance by
> > 2-3X when splice()ing to a file in a DAX-mounted, pmem-backed file
> > system.
>
> >
> > +static void memcpy_from_page_nocache(char *to, struct page *page,
> > size_t offset, size_t len)
> > +{
> > + char *from = kmap_atomic(page);
> > + __copy_from_user_inatomic_nocache(to, from, len);
> > + kunmap_atomic(from);
> > +}
>
> At the very least, it will blow up on any architecture with split
> userland and kernel MMU contexts. You *can't* feed a kernel pointer
> to things like that and expect it to work. At the very least, you
> need to add memcpy_nocache() and have it default to memcpy(), with
> non-dummy version on x86. And use _that_, rather than messing with
> __copy_from_user_inatomic_nocache()
Good point. I think we can add memcpy_nocache() which calls
__copy_from_user_inatomic_nocache() on x86 and defauts to memcpy() on
other architectures.
Thanks,
-Toshi
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
WARNING: multiple messages have this Message-ID (diff)
From: "Kani, Toshimitsu" <toshi.kani@hpe.com>
To: "viro@ZenIV.linux.org.uk" <viro@ZenIV.linux.org.uk>,
"Boylston, Brian" <brian.boylston@hpe.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"x86@kernel.org" <x86@kernel.org>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"hpa@zytor.com" <hpa@zytor.com>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@ml01.01.org>,
"Moreno, Oliver" <oliver.moreno@hpe.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"ross.zwisler@linux.intel.com" <ross.zwisler@linux.intel.com>
Subject: Re: [PATCH] use a nocache copy for bvecs in copy_from_iter_nocache()
Date: Mon, 10 Oct 2016 15:26:03 +0000 [thread overview]
Message-ID: <1476113071.20881.15.camel@hpe.com> (raw)
In-Reply-To: <20161007170842.GQ19539@ZenIV.linux.org.uk>
On Fri, 2016-10-07 at 18:08 +0100, Al Viro wrote:
> On Fri, Oct 07, 2016 at 10:55:11AM -0500, Brian Boylston wrote:
> >
> > copy_from_iter_nocache() is only "nocache" for iovecs. Enhance it
> > to also use a nocache copy for bvecs. This improves performance by
> > 2-3X when splice()ing to a file in a DAX-mounted, pmem-backed file
> > system.
>
> >
> > +static void memcpy_from_page_nocache(char *to, struct page *page,
> > size_t offset, size_t len)
> > +{
> > + char *from = kmap_atomic(page);
> > + __copy_from_user_inatomic_nocache(to, from, len);
> > + kunmap_atomic(from);
> > +}
>
> At the very least, it will blow up on any architecture with split
> userland and kernel MMU contexts. You *can't* feed a kernel pointer
> to things like that and expect it to work. At the very least, you
> need to add memcpy_nocache() and have it default to memcpy(), with
> non-dummy version on x86. And use _that_, rather than messing with
> __copy_from_user_inatomic_nocache()
Good point. I think we can add memcpy_nocache() which calls
__copy_from_user_inatomic_nocache() on x86 and defauts to memcpy() on
other architectures.
Thanks,
-Toshi
next prev parent reply other threads:[~2016-10-10 15:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-07 15:55 [PATCH] use a nocache copy for bvecs in copy_from_iter_nocache() Brian Boylston
2016-10-07 15:55 ` Brian Boylston
2016-10-07 17:08 ` Al Viro
2016-10-07 17:08 ` Al Viro
2016-10-10 15:26 ` Kani, Toshimitsu [this message]
2016-10-10 15:26 ` Kani, Toshimitsu
2016-10-11 13:26 ` Boylston, Brian
2016-10-11 13:26 ` Boylston, Brian
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=1476113071.20881.15.camel@hpe.com \
--to=toshi.kani@hpe.com \
--cc=brian.boylston@hpe.com \
--cc=linux-nvdimm@lists.01.org \
--cc=viro@ZenIV.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.