[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <daecf6fe-6e12-ea6f-5463-747fdd0dd52e@kernel.org>
Date: Sun, 24 Jul 2022 18:25:40 +0800
From: Chao Yu <chao@...nel.org>
To: "Fabio M. De Francesco" <fmdefrancesco@...il.com>,
Jaegeuk Kim <jaegeuk@...nel.org>,
Nick Terrell <terrelln@...com>,
linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Cc: Christoph Hellwig <hch@...radead.org>,
Ira Weiny <ira.weiny@...el.com>
Subject: Re: [PATCH] f2fs: Delete f2fs_copy_page() and replace with
memcpy_page()
On 2022/7/17 16:36, Fabio M. De Francesco wrote:
> f2fs_copy_page() is a wrapper around two kmap() + one memcpy() from/to
> the mapped pages. It unnecessarily duplicates a kernel API and it makes
> use of kmap(), which is being deprecated in favor of kmap_local_page().
>
> Two main problems with kmap(): (1) It comes with an overhead as mapping
> space is restricted and protected by a global lock for synchronization and
> (2) it also requires global TLB invalidation when the kmap’s pool wraps
> and it might block when the mapping space is fully utilized until a slot
> becomes available.
>
> With kmap_local_page() the mappings are per thread, CPU local, can take
> page faults, and can be called from any context (including interrupts).
> It is faster than kmap() in kernels with HIGHMEM enabled. Therefore, its
> use in __clone_blkaddrs() is safe and should be preferred.
>
> Delete f2fs_copy_page() and use a plain memcpy_page() in the only one
> site calling the removed function. memcpy_page() avoids open coding two
> kmap_local_page() + one memcpy() between the two kernel virtual addresses.
>
> Suggested-by: Christoph Hellwig <hch@...radead.org>
> Suggested-by: Ira Weiny <ira.weiny@...el.com>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@...il.com>
Reviewed-by: Chao Yu <chao@...nel.org>
Thanks,
Powered by blists - more mailing lists