LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yang Shi <shy828301@gmail.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: "Linux MM" <linux-mm@kvack.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
김성훈 <sfoon.kim@samsung.com>, "Song Liu" <songliubraving@fb.com>,
"Rik van Riel" <riel@surriel.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Hillf Danton" <hdanton@sina.com>,
"Hugh Dickins" <hughd@google.com>,
"William Kucharski" <william.kucharski@oracle.com>,
"Oleg Nesterov" <oleg@redhat.com>,
"Yang Shi" <yang.shi@linux.alibaba.com>
Subject: Re: [PATCH] mm/thp: decrease nr_thps in file's mapping on THP split
Date: Wed, 13 Oct 2021 14:44:25 -0700 [thread overview]
Message-ID: <CAHbLzkrjkpFZ1D7EnhLqa2xX4G_aXZYh5+ungF6ESAsYmewsCw@mail.gmail.com> (raw)
In-Reply-To: <20211012120237.2600-1-m.szyprowski@samsung.com>
On Tue, Oct 12, 2021 at 5:03 AM Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
>
> Decrease nr_thps counter in file's mapping to ensure that the page cache
> won't be dropped excessively on file write access if page has been
> already splitted.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Fixes: 09d91cda0e82 ("mm,thp: avoid writes to file with THP in pagecache")
> Fixes: 06d3eff62d9d ("mm/thp: fix node page state in split_huge_page_to_list()")
Reviewed-by: Yang Shi <shy828301@gmail.com>
> ---
> I've analyzed the code a few times but either I missed something or the
> nr_thps counter is not decremented during the THP split on non-shmem file
> pages.
> ---
> mm/huge_memory.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index ec2bb93f7431..a6c2ba59abcd 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2709,10 +2709,12 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
> }
> spin_unlock(&ds_queue->split_queue_lock);
> if (mapping) {
> - if (PageSwapBacked(head))
> + if (PageSwapBacked(head)) {
> __dec_node_page_state(head, NR_SHMEM_THPS);
> - else
> + } else {
> __dec_node_page_state(head, NR_FILE_THPS);
> + filemap_nr_thps_dec(mapping);
> + }
> }
>
> __split_huge_page(page, list, end, flags);
> --
> 2.17.1
>
>
prev parent reply other threads:[~2021-10-13 21:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20211012120247eucas1p1f66926c6fc334216cdbdd39285601aa8@eucas1p1.samsung.com>
2021-10-12 12:02 ` Marek Szyprowski
2021-10-12 12:43 ` Matthew Wilcox
2021-10-13 10:47 ` Marek Szyprowski
2021-10-13 12:01 ` Matthew Wilcox
2021-10-13 21:44 ` Yang Shi [this message]
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=CAHbLzkrjkpFZ1D7EnhLqa2xX4G_aXZYh5+ungF6ESAsYmewsCw@mail.gmail.com \
--to=shy828301@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=hdanton@sina.com \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=oleg@redhat.com \
--cc=riel@surriel.com \
--cc=sfoon.kim@samsung.com \
--cc=songliubraving@fb.com \
--cc=william.kucharski@oracle.com \
--cc=yang.shi@linux.alibaba.com \
--subject='Re: [PATCH] mm/thp: decrease nr_thps in file'\''s mapping on THP split' \
/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
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).