Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941283AbcJGRJA (ORCPT ); Fri, 7 Oct 2016 13:09:00 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:44254 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932268AbcJGRIx (ORCPT ); Fri, 7 Oct 2016 13:08:53 -0400 Date: Fri, 7 Oct 2016 18:08:42 +0100 From: Al Viro To: Brian Boylston Cc: linux-nvdimm@ml01.01.org, linux-kernel@vger.kernel.org, toshi.kani@hpe.com, oliver.moreno@hpe.com, Ross Zwisler , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Dan Williams Subject: Re: [PATCH] use a nocache copy for bvecs in copy_from_iter_nocache() Message-ID: <20161007170842.GQ19539@ZenIV.linux.org.uk> References: <20161007155511.21502-1-brian.boylston@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161007155511.21502-1-brian.boylston@hpe.com> User-Agent: Mutt/1.7.0 (2016-08-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 876 Lines: 18 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()