From: Andrew Morton <akpm@linux-foundation.org>
To: Huan Yang <link@vivo.com>
Cc: usamaarif642@gmail.com, yuzhao@google.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, opensource.kernel@vivo.com
Subject: Re: [PATCH] mm: move the easily assessable conditions forward
Date: Thu, 15 Aug 2024 15:35:24 -0700 [thread overview]
Message-ID: <20240815153524.6bb7c26dc32feb93dd1ba513@linux-foundation.org> (raw)
In-Reply-To: <20240815083102.653820-1-link@vivo.com>
On Thu, 15 Aug 2024 16:31:01 +0800 Huan Yang <link@vivo.com> wrote:
> Current try_to_map_unused_to_zeropage try to use shared zero page to
> save some memory of sub page.
>
> If forbids zeropage, no need to do anything rather than attempting to
> assess wthether to use it afterwards.
>
> ...
>
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -192,6 +192,9 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw,
> VM_BUG_ON_PAGE(!PageLocked(page), page);
> VM_BUG_ON_PAGE(pte_present(*pvmw->pte), page);
>
> + if (mm_forbids_zeropage(pvmw->vma->vm_mm))
> + return false;
> +
> if (PageMlocked(page) || (pvmw->vma->vm_flags & VM_LOCKED))
> return false;
>
> @@ -204,7 +207,7 @@ static bool try_to_map_unused_to_zeropage(struct page_vma_mapped_walk *pvmw,
> contains_data = memchr_inv(addr, 0, PAGE_SIZE);
> kunmap_local(addr);
>
> - if (contains_data || mm_forbids_zeropage(pvmw->vma->vm_mm))
> + if (contains_data)
> return false;
>
Looks sensible. I'll add it as a fixup to "mm: remap unused subpages to shared zeropage when splitting isolated thp".
prev parent reply other threads:[~2024-08-15 22:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 8:31 Huan Yang
2024-08-15 22:35 ` Andrew Morton [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=20240815153524.6bb7c26dc32feb93dd1ba513@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=link@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=opensource.kernel@vivo.com \
--cc=usamaarif642@gmail.com \
--cc=yuzhao@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