From: Ira Weiny <ira.weiny@intel.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/2] mm: call flush_dcache_page in memcpy_to_page and memzero_page
Date: Wed, 14 Jul 2021 01:09:35 -0700 [thread overview]
Message-ID: <20210714080935.GK3169279@iweiny-DESK2.sc.intel.com> (raw)
In-Reply-To: <20210713055231.137602-2-hch@lst.de>
On Tue, Jul 13, 2021 at 07:52:30AM +0200, Christoph Hellwig wrote:
> memcpy_to_page and memzero_page can write to arbitrary pages, which could
> be in the page cache or in high memory, so call flush_kernel_dcache_pages
> to flush the dcache.
>
> Fixes: bb90d4bc7b6a ("mm/highmem: Lift memcpy_[to|from]_page to core")
> Fixes: 28961998f858 ("iov_iter: lift memzero_page() to highmem.h")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> ---
> include/linux/highmem.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/highmem.h b/include/linux/highmem.h
> index 8c6e8e996c87..8e7e50a53a12 100644
> --- a/include/linux/highmem.h
> +++ b/include/linux/highmem.h
> @@ -318,6 +318,7 @@ static inline void memcpy_to_page(struct page *page, size_t offset,
>
> VM_BUG_ON(offset + len > PAGE_SIZE);
> memcpy(to + offset, from, len);
> + flush_dcache_page(page);
> kunmap_local(to);
> }
>
> @@ -325,6 +326,7 @@ static inline void memzero_page(struct page *page, size_t offset, size_t len)
> {
> char *addr = kmap_atomic(page);
> memset(addr + offset, 0, len);
> + flush_dcache_page(page);
> kunmap_atomic(addr);
> }
>
> --
> 2.30.2
>
next prev parent reply other threads:[~2021-07-14 8:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-13 5:52 fix " Christoph Hellwig
2021-07-13 5:52 ` [PATCH 1/2] mm: call flush_dcache_page in " Christoph Hellwig
2021-07-14 1:31 ` Andrew Morton
2021-07-14 5:28 ` Christoph Hellwig
2021-07-14 8:09 ` Ira Weiny [this message]
2021-07-13 5:52 ` [PATCH 2/2] mm: use kmap_local_page in memzero_page Christoph Hellwig
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=20210714080935.GK3169279@iweiny-DESK2.sc.intel.com \
--to=ira.weiny@intel.com \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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