All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Nick Terrell <terrelln@fb.com>,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>, Ira Weiny <ira.weiny@intel.com>
Subject: Re: [f2fs-dev] [PATCH] f2fs: Delete f2fs_copy_page() and replace with memcpy_page()
Date: Sun, 24 Jul 2022 18:25:40 +0800	[thread overview]
Message-ID: <daecf6fe-6e12-ea6f-5463-747fdd0dd52e@kernel.org> (raw)
In-Reply-To: <20220717083613.3861-1-fmdefrancesco@gmail.com>

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@infradead.org>
> Suggested-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao@kernel.org>
To: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Nick Terrell <terrelln@fb.com>,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>, Ira Weiny <ira.weiny@intel.com>
Subject: Re: [PATCH] f2fs: Delete f2fs_copy_page() and replace with memcpy_page()
Date: Sun, 24 Jul 2022 18:25:40 +0800	[thread overview]
Message-ID: <daecf6fe-6e12-ea6f-5463-747fdd0dd52e@kernel.org> (raw)
In-Reply-To: <20220717083613.3861-1-fmdefrancesco@gmail.com>

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@infradead.org>
> Suggested-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

  parent reply	other threads:[~2022-07-24 10:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-17  8:36 [f2fs-dev] [PATCH] f2fs: Delete f2fs_copy_page() and replace with memcpy_page() Fabio M. De Francesco
2022-07-17  8:36 ` Fabio M. De Francesco
2022-07-18  5:14 ` [f2fs-dev] " Christoph Hellwig
2022-07-18  5:14   ` Christoph Hellwig
2022-07-24 10:25 ` Chao Yu [this message]
2022-07-24 10:25   ` Chao Yu

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=daecf6fe-6e12-ea6f-5463-747fdd0dd52e@kernel.org \
    --to=chao@kernel.org \
    --cc=fmdefrancesco@gmail.com \
    --cc=hch@infradead.org \
    --cc=ira.weiny@intel.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=terrelln@fb.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 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.