linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: Muchun Song <songmuchun@bytedance.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	Matthew Wilcox <willy@infradead.org>,  Jan Kara <jack@suse.cz>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Alistair Popple <apopple@nvidia.com>,
	 Ralph Campbell <rcampbell@nvidia.com>,
	Hugh Dickins <hughd@google.com>,
	xiyuyang19@fudan.edu.cn,
	 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	zwisler@kernel.org,
	 Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,
	nvdimm@lists.linux.dev,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH 1/5] mm: rmap: fix cache flush on THP pages
Date: Fri, 21 Jan 2022 10:05:51 -0800	[thread overview]
Message-ID: <CAHbLzkqzu+20TJc8RGDDCyDaFmG+Q7xjkVgpJF5-uPqubMN2HA@mail.gmail.com> (raw)
In-Reply-To: <20220121075515.79311-1-songmuchun@bytedance.com>

On Thu, Jan 20, 2022 at 11:56 PM Muchun Song <songmuchun@bytedance.com> wrote:
>
> The flush_cache_page() only remove a PAGE_SIZE sized range from the cache.
> However, it does not cover the full pages in a THP except a head page.
> Replace it with flush_cache_range() to fix this issue. At least, no
> problems were found due to this. Maybe because the architectures that
> have virtual indexed caches is less.

Yeah, actually flush_cache_page()/flush_cache_range() are no-op for
the most architectures which have THP supported, i.e. x86, aarch64,
powerpc, etc.

And currently just tmpfs and read-only files support PMD-mapped THP,
but both don't have to do writeback. And it seems DAX doesn't have
writeback either, which uses __set_page_dirty_no_writeback() for
set_page_dirty. So this code should never be called IIUC.

But anyway your fix looks correct to me. Reviewed-by: Yang Shi
<shy828301@gmail.com>

>
> Fixes: f27176cfc363 ("mm: convert page_mkclean_one() to use page_vma_mapped_walk()")
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> ---
>  mm/rmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index b0fd9dc19eba..65670cb805d6 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -974,7 +974,7 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,
>                         if (!pmd_dirty(*pmd) && !pmd_write(*pmd))
>                                 continue;
>
> -                       flush_cache_page(vma, address, page_to_pfn(page));
> +                       flush_cache_range(vma, address, address + HPAGE_PMD_SIZE);
>                         entry = pmdp_invalidate(vma, address, pmd);
>                         entry = pmd_wrprotect(entry);
>                         entry = pmd_mkclean(entry);
> --
> 2.11.0
>


  parent reply	other threads:[~2022-01-21 18:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21  7:55 Muchun Song
2022-01-21  7:55 ` [PATCH 2/5] dax: fix cache flush on PMD-mapped pages Muchun Song
2022-01-24  7:34   ` Christoph Hellwig
2022-01-21  7:55 ` [PATCH 3/5] mm: page_vma_mapped: support checking if a pfn is mapped into a vma Muchun Song
2022-01-24  7:36   ` Christoph Hellwig
2022-01-24  9:01     ` Muchun Song
2022-01-21  7:55 ` [PATCH 4/5] dax: fix missing writeprotect the pte entry Muchun Song
2022-01-24  7:41   ` Christoph Hellwig
2022-01-24  9:07     ` Muchun Song
2022-01-21  7:55 ` [PATCH 5/5] mm: remove range parameter from follow_invalidate_pte() Muchun Song
2022-01-21 18:05 ` Yang Shi [this message]
2022-01-24  7:34 ` [PATCH 1/5] mm: rmap: fix cache flush on THP pages Christoph Hellwig
2022-01-24  8:51   ` Muchun Song

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=CAHbLzkqzu+20TJc8RGDDCyDaFmG+Q7xjkVgpJF5-uPqubMN2HA@mail.gmail.com \
    --to=shy828301@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=dan.j.williams@intel.com \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=rcampbell@nvidia.com \
    --cc=songmuchun@bytedance.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=xiyuyang19@fudan.edu.cn \
    --cc=zwisler@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