From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Lance Yang <ioworker0@gmail.com>, akpm@linux-foundation.org
Cc: 21cnbao@gmail.com, david@redhat.com, fengwei.yin@intel.com,
libang.li@antgroup.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, maskray@google.com, mhocko@suse.com,
minchan@kernel.org, peterx@redhat.com, ryan.roberts@arm.com,
shy828301@gmail.com, sj@kernel.org, songmuchun@bytedance.com,
wangkefeng.wang@huawei.com, willy@infradead.org,
xiehuan09@gmail.com, ziy@nvidia.com, zokeefe@google.com
Subject: Re: [PATCH v7 4/4] mm/vmscan: avoid split lazyfree THP during shrink_folio_list()
Date: Thu, 13 Jun 2024 16:20:36 +0800 [thread overview]
Message-ID: <d48bcbcc-0935-4d04-b6a8-f1ceec8190bf@linux.alibaba.com> (raw)
In-Reply-To: <20240613072858.16512-1-ioworker0@gmail.com>
On 2024/6/13 15:28, Lance Yang wrote:
> Hi Andrew,
>
> I'd like to fix the bug[1] I mentioned previously. Could you please fold the
> following changes into this patch?
>
> [1] https://lore.kernel.org/linux-mm/20240613065521.15960-1-ioworker0@gmail.com/
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index f409ea9fcc18..425374ae06ed 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2707,10 +2707,8 @@ static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma,
> if (unlikely(page_folio(page) != folio))
> return false;
>
> - if (folio_test_dirty(folio) || pmd_dirty(orig_pmd)) {
> - folio_set_swapbacked(folio);
> + if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
> return false;
> - }
>
> orig_pmd = pmdp_huge_clear_flush(vma, addr, pmdp);
>
> @@ -2737,10 +2735,8 @@ static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma,
> *
> * The only folio refs must be one from isolation plus the rmap(s).
> */
> - if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
> - folio_set_swapbacked(folio);
> -
> - if (folio_test_swapbacked(folio) || ref_count != map_count + 1) {
> + if (folio_test_dirty(folio) || pmd_dirty(orig_pmd) ||
> + ref_count != map_count + 1) {
> set_pmd_at(mm, addr, pmdp, orig_pmd);
> return false;
> }
> diff --git a/mm/rmap.c b/mm/rmap.c
> index b9e5943c8349..393e2c11c44c 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -1824,12 +1824,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
> */
> if (unlikely(folio_test_swapbacked(folio) !=
> folio_test_swapcache(folio))) {
> - /*
> - * unmap_huge_pmd_locked() will unmark a
> - * PMD-mapped folio as lazyfree if the folio or
> - * its PMD was redirtied.
> - */
> - WARN_ON_ONCE(!pmd_mapped);
> + WARN_ON_ONCE(1);
> goto walk_done_err;
> }
>
You can also drop the unused 'pmd_mapped' variable now.
next prev parent reply other threads:[~2024-06-13 8:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 12:02 [PATCH v7 0/4] Reclaim lazyfree THP without splitting Lance Yang
2024-06-10 12:02 ` [PATCH v7 1/4] mm/rmap: remove duplicated exit code in pagewalk loop Lance Yang
2024-06-13 7:52 ` Barry Song
2024-06-13 8:27 ` David Hildenbrand
2024-06-13 8:49 ` Lance Yang
2024-06-13 12:43 ` Lance Yang
2024-06-13 13:29 ` David Hildenbrand
2024-06-13 13:45 ` Lance Yang
2024-06-10 12:02 ` [PATCH v7 2/4] mm/rmap: add helper to restart pgtable walk on changes Lance Yang
2024-06-13 8:30 ` David Hildenbrand
2024-06-13 8:54 ` Lance Yang
2024-06-10 12:06 ` [PATCH v7 3/4] mm/rmap: integrate PMD-mapped folio splitting into pagewalk loop Lance Yang
2024-06-13 8:34 ` David Hildenbrand
2024-06-13 8:45 ` David Hildenbrand
2024-06-13 8:46 ` David Hildenbrand
2024-06-13 9:21 ` Lance Yang
2024-06-13 9:25 ` David Hildenbrand
2024-06-10 12:08 ` [PATCH v7 4/4] mm/vmscan: avoid split lazyfree THP during shrink_folio_list() Lance Yang
2024-06-13 6:55 ` Lance Yang
2024-06-13 7:28 ` Lance Yang
2024-06-13 8:20 ` Baolin Wang [this message]
2024-06-13 8:56 ` Lance Yang
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=d48bcbcc-0935-4d04-b6a8-f1ceec8190bf@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=fengwei.yin@intel.com \
--cc=ioworker0@gmail.com \
--cc=libang.li@antgroup.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maskray@google.com \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=peterx@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=shy828301@gmail.com \
--cc=sj@kernel.org \
--cc=songmuchun@bytedance.com \
--cc=wangkefeng.wang@huawei.com \
--cc=willy@infradead.org \
--cc=xiehuan09@gmail.com \
--cc=ziy@nvidia.com \
--cc=zokeefe@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox