lkml.org 
[lkml]   [2021]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH V2 1/8] mm/highmem: Lift memcpy_[to|from]_page to core
Date
On 2/9/21 22:25, ira.weiny@intel.com wrote:
> From: Ira Weiny <ira.weiny@intel.com>
>
> Working through a conversion to a call kmap_local_page() instead of
> kmap() revealed many places where the pattern kmap/memcpy/kunmap
> occurred.
>
> Eric Biggers, Matthew Wilcox, Christoph Hellwig, Dan Williams, and Al
> Viro all suggested putting this code into helper functions. Al Viro
> further pointed out that these functions already existed in the iov_iter
> code.[1]
>
> Various locations for the lifted functions were considered.
>
> Headers like mm.h or string.h seem ok but don't really portray the
> functionality well. pagemap.h made some sense but is for page cache
> functionality.[2]
>
> Another alternative would be to create a new header for the promoted
> memcpy functions, but it masks the fact that these are designed to copy
> to/from pages using the kernel direct mappings and complicates matters
> with a new header.
>
> Placing these functions in 'highmem.h' is suboptimal especially with the
> changes being proposed in the functionality of kmap. From a caller
> perspective including/using 'highmem.h' implies that the functions
> defined in that header are only required when highmem is in use which is
> increasingly not the case with modern processors. However, highmem.h is
> where all the current functions like this reside (zero_user(),
> clear_highpage(), clear_user_highpage(), copy_user_highpage(), and
> copy_highpage()). So it makes the most sense even though it is
> distasteful for some.[3]
>
> Lift memcpy_to_page() and memcpy_from_page() to pagemap.h.
>
> [1] https://lore.kernel.org/lkml/20201013200149.GI3576660@ZenIV.linux.org.uk/
> https://lore.kernel.org/lkml/20201013112544.GA5249@infradead.org/
>
> [2] https://lore.kernel.org/lkml/20201208122316.GH7338@casper.infradead.org/
>
> [3] https://lore.kernel.org/lkml/20201013200149.GI3576660@ZenIV.linux.org.uk/#t
> https://lore.kernel.org/lkml/20201208163814.GN1563847@iweiny-DESK2.sc.intel.com/
>
> Cc: Boris Pismenny <borisp@mellanox.com>
> Cc: Or Gerlitz <gerlitz.or@gmail.com>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Suggested-by: Matthew Wilcox <willy@infradead.org>
> Suggested-by: Christoph Hellwig <hch@infradead.org>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
> Suggested-by: Eric Biggers <ebiggers@kernel.org>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>

Thanks for adding a new line in the new calls after variable declaration.
Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>


\
 
 \ /
  Last update: 2021-02-10 07:37    [W:0.185 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site