From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-mm@kvack.org, Johannes Weiner <hannes@cmpxchg.org>,
Vlastimil Babka <vbabka@suse.cz>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>
Subject: [PATCH v2 5/6] mm/khugepaged: Use a folio more in collapse_file()
Date: Thu, 28 Dec 2023 08:57:47 +0000 [thread overview]
Message-ID: <20231228085748.1083901-6-willy@infradead.org> (raw)
In-Reply-To: <20231228085748.1083901-1-willy@infradead.org>
This function is not yet fully converted to the folio API, but
this removes a few uses of old APIs.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
mm/khugepaged.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 13c6eadbeda3..b9b0742e4d9a 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2126,23 +2126,23 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
xas_lock_irq(&xas);
}
- nr = thp_nr_pages(hpage);
+ folio = page_folio(hpage);
+ nr = folio_nr_pages(folio);
if (is_shmem)
- __mod_lruvec_page_state(hpage, NR_SHMEM_THPS, nr);
+ __lruvec_stat_mod_folio(folio, NR_SHMEM_THPS, nr);
else
- __mod_lruvec_page_state(hpage, NR_FILE_THPS, nr);
+ __lruvec_stat_mod_folio(folio, NR_FILE_THPS, nr);
if (nr_none) {
- __mod_lruvec_page_state(hpage, NR_FILE_PAGES, nr_none);
+ __lruvec_stat_mod_folio(folio, NR_FILE_PAGES, nr_none);
/* nr_none is always 0 for non-shmem. */
- __mod_lruvec_page_state(hpage, NR_SHMEM, nr_none);
+ __lruvec_stat_mod_folio(folio, NR_SHMEM, nr_none);
}
/*
* Mark hpage as uptodate before inserting it into the page cache so
* that it isn't mistaken for an fallocated but unwritten page.
*/
- folio = page_folio(hpage);
folio_mark_uptodate(folio);
folio_ref_add(folio, HPAGE_PMD_NR - 1);
@@ -2152,7 +2152,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
/* Join all the small entries into a single multi-index entry. */
xas_set_order(&xas, start, HPAGE_PMD_ORDER);
- xas_store(&xas, hpage);
+ xas_store(&xas, folio);
WARN_ON_ONCE(xas_error(&xas));
xas_unlock_irq(&xas);
@@ -2163,7 +2163,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
retract_page_tables(mapping, start);
if (cc && !cc->is_khugepaged)
result = SCAN_PTE_MAPPED_HUGEPAGE;
- unlock_page(hpage);
+ folio_unlock(folio);
/*
* The collapse has succeeded, so free the old pages.
--
2.43.0
next prev parent reply other threads:[~2023-12-28 8:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-28 8:57 [PATCH v2 0/6] Remove some lruvec page accounting functions Matthew Wilcox (Oracle)
2023-12-28 8:57 ` [PATCH v2 1/6] mm: Remove inc/dec lruvec page state functions Matthew Wilcox (Oracle)
2024-01-02 11:02 ` Vlastimil Babka
2023-12-28 8:57 ` [PATCH v2 2/6] slub: Use alloc_pages_node() in alloc_slab_page() Matthew Wilcox (Oracle)
2023-12-28 20:37 ` David Rientjes
2024-01-02 11:06 ` Vlastimil Babka
2024-07-09 17:12 ` Christoph Lameter (Ampere)
2024-07-10 10:35 ` Vlastimil Babka
2024-07-10 16:43 ` Christoph Lameter (Ampere)
2024-07-11 7:54 ` Vlastimil Babka
2024-07-11 18:04 ` Christoph Lameter (Ampere)
2024-07-12 7:47 ` Vlastimil Babka
2023-12-28 8:57 ` [PATCH v2 3/6] slub: Use folio APIs in free_large_kmalloc() Matthew Wilcox (Oracle)
2023-12-28 20:37 ` David Rientjes
2024-01-02 11:10 ` Vlastimil Babka
2023-12-28 8:57 ` [PATCH v2 4/6] slub: Use a folio in __kmalloc_large_node Matthew Wilcox (Oracle)
2023-12-28 20:37 ` David Rientjes
2024-01-02 11:21 ` Vlastimil Babka
2023-12-28 8:57 ` Matthew Wilcox (Oracle) [this message]
2023-12-28 21:10 ` [PATCH v2 5/6] mm/khugepaged: Use a folio more in collapse_file() Zi Yan
2024-01-02 11:24 ` Vlastimil Babka
2023-12-28 8:57 ` [PATCH v2 6/6] mm/memcontrol: Remove __mod_lruvec_page_state() Matthew Wilcox (Oracle)
2023-12-28 21:24 ` Zi Yan
2023-12-28 22:31 ` Shakeel Butt
2024-01-02 11:56 ` Vlastimil Babka
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=20231228085748.1083901-6-willy@infradead.org \
--to=willy@infradead.org \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).