linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ira.weiny@intel.com
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ira Weiny <ira.weiny@intel.com>,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	David Sterba <dsterba@suse.com>, Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] mm/highmem: Convert memzero_page() to kmap_local_page()
Date: Tue,  9 Mar 2021 13:21:36 -0800	[thread overview]
Message-ID: <20210309212137.2610186-3-ira.weiny@intel.com> (raw)
In-Reply-To: <20210309212137.2610186-1-ira.weiny@intel.com>

From: Ira Weiny <ira.weiny@intel.com>

The memset() does not need to be performed atomically.  Use
kmap_local_page() which will improved performance for this call.

Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: David Sterba <dsterba@suse.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 include/linux/highmem.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 832b49b50c7b..0dc0451cf1d1 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -334,9 +334,9 @@ static inline void memcpy_to_page(struct page *page, size_t offset,
 
 static inline void memzero_page(struct page *page, size_t offset, size_t len)
 {
-	char *addr = kmap_atomic(page);
+	char *addr = kmap_local_page(page);
 	memset(addr + offset, 0, len);
-	kunmap_atomic(addr);
+	kunmap_local(addr);
 }
 
 #endif /* _LINUX_HIGHMEM_H */
-- 
2.28.0.rc0.12.gb6a658bd00c9


  parent reply	other threads:[~2021-03-09 21:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 21:21 [PATCH 0/3] btrfs: Convert kmap/memset/kunmap to memzero_user() ira.weiny
2021-03-09 21:21 ` [PATCH 1/3] iov_iter: Lift memzero_page() to highmem.h ira.weiny
2021-03-09 21:21 ` ira.weiny [this message]
2021-03-09 21:21 ` [PATCH 3/3] btrfs: Use memzero_page() instead of open coded kmap pattern ira.weiny
2021-03-12 11:23   ` David Sterba
2021-03-10 23:58 ` [PATCH 0/3] btrfs: Convert kmap/memset/kunmap to memzero_user() Andrew Morton
2021-03-11 15:57   ` Ira Weiny
2021-03-12 11:57     ` David Sterba

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=20210309212137.2610186-3-ira.weiny@intel.com \
    --to=ira.weiny@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).