From: David Hildenbrand <david@redhat.com>
To: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>, linux-mm@kvack.org
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] mm/khugepaged: Convert __collapse_huge_page_isolate() to use folios
Date: Mon, 25 Sep 2023 09:18:40 +0200 [thread overview]
Message-ID: <fd2149bb-2c5f-222c-5134-ae251910b3cc@redhat.com> (raw)
In-Reply-To: <20230922193639.10158-2-vishal.moola@gmail.com>
On 22.09.23 21:36, Vishal Moola (Oracle) wrote:
> This is in preparation for the removal of the khugepaged compound_pagelist.
>
> Replaces 11 calls to compound_head() with 1, and removes 499 bytes of
> kernel text.
>
> Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
> ---
> mm/khugepaged.c | 52 ++++++++++++++++++++++++-------------------------
> 1 file changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 88433cc25d8a..f46a7a7c489f 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -541,7 +541,7 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
> struct collapse_control *cc,
> struct list_head *compound_pagelist)
> {
> - struct page *page = NULL;
> + struct folio *folio = NULL;
> pte_t *_pte;
> int none_or_zero = 0, shared = 0, result = SCAN_FAIL, referenced = 0;
> bool writable = false;
> @@ -570,15 +570,15 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
> result = SCAN_PTE_UFFD_WP;
> goto out;
> }
> - page = vm_normal_page(vma, address, pteval);
> - if (unlikely(!page) || unlikely(is_zone_device_page(page))) {
> + folio = vm_normal_folio(vma, address, pteval);
> + if (unlikely(!folio) || unlikely(folio_is_zone_device(folio))) {
> result = SCAN_PAGE_NULL;
> goto out;
> }
>
> - VM_BUG_ON_PAGE(!PageAnon(page), page);
> + VM_BUG_ON_FOLIO(!folio_test_anon(folio), folio);
>
> - if (page_mapcount(page) > 1) {
> + if (folio_estimated_sharers(folio) > 1) {
For a tail page of a PTE-mapped THP this is not the same.
The possible side effects this might have should be spelled out in the
patch description.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-09-25 7:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 19:36 [RFC PATCH 0/2] Remove compound_pagelist from khugepaged Vishal Moola (Oracle)
2023-09-22 19:36 ` [RFC PATCH 1/2] mm/khugepaged: Convert __collapse_huge_page_isolate() to use folios Vishal Moola (Oracle)
2023-09-22 19:46 ` Matthew Wilcox
2023-09-25 7:18 ` David Hildenbrand [this message]
2023-09-25 18:57 ` Vishal Moola
2023-09-22 19:36 ` [RFC PATCH 2/2] mm/khugepaged: Remove compound_pagelist Vishal Moola (Oracle)
2023-09-26 22:07 ` Yang Shi
2023-09-28 9:05 ` Matthew Wilcox
2023-09-28 19:33 ` Yang Shi
2023-10-02 15:55 ` Vishal Moola
2023-09-29 19:07 ` Yang Shi
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=fd2149bb-2c5f-222c-5134-ae251910b3cc@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vishal.moola@gmail.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