From: John Hubbard <jhubbard@nvidia.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 17/17] gup: Convert check_and_migrate_movable_pages() to use a folio
Date: Wed, 5 Jan 2022 01:00:17 -0800 [thread overview]
Message-ID: <3d51ffdb-7c3d-0d57-4850-0a220d391898@nvidia.com> (raw)
In-Reply-To: <20220102215729.2943705-18-willy@infradead.org>
On 1/2/22 13:57, Matthew Wilcox (Oracle) wrote:
> Switch from head pages to folios. This removes an assumption that
> THPs are the only way to have a high-order page.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> mm/gup.c | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
thanks,
--
John Hubbard
NVIDIA
> diff --git a/mm/gup.c b/mm/gup.c
> index 76717e05413d..eb7c66e2b785 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -1822,41 +1822,41 @@ static long check_and_migrate_movable_pages(unsigned long nr_pages,
> bool drain_allow = true;
> LIST_HEAD(movable_page_list);
> long ret = 0;
> - struct page *prev_head = NULL;
> - struct page *head;
> + struct folio *folio, *prev_folio = NULL;
> struct migration_target_control mtc = {
> .nid = NUMA_NO_NODE,
> .gfp_mask = GFP_USER | __GFP_NOWARN,
> };
>
> for (i = 0; i < nr_pages; i++) {
> - head = compound_head(pages[i]);
> - if (head == prev_head)
> + folio = page_folio(pages[i]);
> + if (folio == prev_folio)
> continue;
> - prev_head = head;
> + prev_folio = folio;
> /*
> * If we get a movable page, since we are going to be pinning
> * these entries, try to move them out if possible.
> */
> - if (!is_pinnable_page(head)) {
> - if (PageHuge(head)) {
> - if (!isolate_huge_page(head, &movable_page_list))
> + if (!is_pinnable_page(&folio->page)) {
> + if (folio_test_hugetlb(folio)) {
> + if (!isolate_huge_page(&folio->page,
> + &movable_page_list))
> isolation_error_count++;
> } else {
> - if (!PageLRU(head) && drain_allow) {
> + if (!folio_test_lru(folio) && drain_allow) {
> lru_add_drain_all();
> drain_allow = false;
> }
>
> - if (isolate_lru_page(head)) {
> + if (isolate_lru_folio(folio)) {
> isolation_error_count++;
> continue;
> }
> - list_add_tail(&head->lru, &movable_page_list);
> - mod_node_page_state(page_pgdat(head),
> + list_add_tail(&folio->lru, &movable_page_list);
> + node_stat_mod_folio(folio,
> NR_ISOLATED_ANON +
> - page_is_file_lru(head),
> - thp_nr_pages(head));
> + folio_is_file_lru(folio),
> + folio_nr_pages(folio));
> }
> }
> }
next prev parent reply other threads:[~2022-01-05 9:00 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-02 21:57 [PATCH 00/17] Convert GUP to folios Matthew Wilcox (Oracle)
2022-01-02 21:57 ` [PATCH 01/17] mm: Add folio_put_refs() Matthew Wilcox (Oracle)
2022-01-04 8:00 ` Christoph Hellwig
2022-01-04 21:15 ` John Hubbard
2022-01-02 21:57 ` [PATCH 02/17] mm: Add folio_pincount_available() Matthew Wilcox (Oracle)
2022-01-04 8:01 ` Christoph Hellwig
2022-01-04 18:25 ` Matthew Wilcox
2022-01-04 21:40 ` John Hubbard
2022-01-05 5:04 ` Matthew Wilcox
2022-01-05 6:24 ` John Hubbard
2022-01-02 21:57 ` [PATCH 03/17] mm: Add folio_pincount_ptr() Matthew Wilcox (Oracle)
2022-01-04 8:02 ` Christoph Hellwig
2022-01-04 21:43 ` John Hubbard
2022-01-06 21:57 ` William Kucharski
2022-01-02 21:57 ` [PATCH 04/17] mm: Convert page_maybe_dma_pinned() to use a folio Matthew Wilcox (Oracle)
2022-01-04 8:03 ` Christoph Hellwig
2022-01-04 22:01 ` John Hubbard
2022-01-02 21:57 ` [PATCH 05/17] gup: Add try_get_folio() Matthew Wilcox (Oracle)
2022-01-04 8:18 ` Christoph Hellwig
2022-01-05 1:25 ` John Hubbard
2022-01-05 7:00 ` John Hubbard
2022-01-07 18:23 ` Jason Gunthorpe
2022-01-08 1:37 ` Matthew Wilcox
2022-01-08 2:36 ` John Hubbard
2022-01-10 15:01 ` Jason Gunthorpe
2022-01-02 21:57 ` [PATCH 06/17] mm: Remove page_cache_add_speculative() and page_cache_get_speculative() Matthew Wilcox (Oracle)
2022-01-04 8:18 ` Christoph Hellwig
2022-01-05 1:29 ` John Hubbard
2022-01-02 21:57 ` [PATCH 07/17] gup: Add gup_put_folio() Matthew Wilcox (Oracle)
2022-01-04 8:22 ` Christoph Hellwig
2022-01-05 6:52 ` John Hubbard
2022-01-06 22:05 ` William Kucharski
2022-01-02 21:57 ` [PATCH 08/17] gup: Add try_grab_folio() Matthew Wilcox (Oracle)
2022-01-04 8:24 ` Christoph Hellwig
2022-01-05 7:06 ` John Hubbard
2022-01-02 21:57 ` [PATCH 09/17] gup: Convert gup_pte_range() to use a folio Matthew Wilcox (Oracle)
2022-01-04 8:25 ` Christoph Hellwig
2022-01-05 7:36 ` John Hubbard
2022-01-05 7:52 ` Matthew Wilcox
2022-01-05 7:57 ` John Hubbard
2022-01-02 21:57 ` [PATCH 10/17] gup: Convert gup_hugepte() " Matthew Wilcox (Oracle)
2022-01-04 8:26 ` Christoph Hellwig
2022-01-05 7:46 ` John Hubbard
2022-01-02 21:57 ` [PATCH 11/17] gup: Convert gup_huge_pmd() " Matthew Wilcox (Oracle)
2022-01-04 8:26 ` Christoph Hellwig
2022-01-05 7:50 ` John Hubbard
2022-01-02 21:57 ` [PATCH 12/17] gup: Convert gup_huge_pud() " Matthew Wilcox (Oracle)
2022-01-05 7:58 ` John Hubbard
2022-01-02 21:57 ` [PATCH 13/17] gup: Convert gup_huge_pgd() " Matthew Wilcox (Oracle)
2022-01-05 7:58 ` John Hubbard
2022-01-02 21:57 ` [PATCH 14/17] gup: Convert for_each_compound_head() to gup_for_each_folio() Matthew Wilcox (Oracle)
2022-01-04 8:32 ` Christoph Hellwig
2022-01-05 8:17 ` John Hubbard
2022-01-09 4:39 ` Matthew Wilcox
2022-01-09 8:01 ` John Hubbard
2022-01-10 15:22 ` Jan Kara
2022-01-10 15:52 ` Matthew Wilcox
2022-01-10 20:36 ` Jan Kara
2022-01-10 21:10 ` Matthew Wilcox
2022-01-17 12:07 ` Jan Kara
2022-01-02 21:57 ` [PATCH 15/17] gup: Convert for_each_compound_range() to gup_for_each_folio_range() Matthew Wilcox (Oracle)
2022-01-04 8:35 ` Christoph Hellwig
2022-01-05 8:30 ` John Hubbard
2022-01-02 21:57 ` [PATCH 16/17] mm: Add isolate_lru_folio() Matthew Wilcox (Oracle)
2022-01-04 8:36 ` Christoph Hellwig
2022-01-05 8:44 ` John Hubbard
2022-01-06 0:34 ` Matthew Wilcox
2022-01-02 21:57 ` [PATCH 17/17] gup: Convert check_and_migrate_movable_pages() to use a folio Matthew Wilcox (Oracle)
2022-01-04 8:37 ` Christoph Hellwig
2022-01-05 9:00 ` John Hubbard [this message]
2022-01-06 22:12 ` [PATCH 00/17] Convert GUP to folios William Kucharski
2022-01-07 18:54 ` Jason Gunthorpe
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=3d51ffdb-7c3d-0d57-4850-0a220d391898@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/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