linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: akpm@linux-foundation.org, willy@infradead.org, david@redhat.com,
	osalvador@suse.de, Sidhartha Kumar <sidhartha.kumar@oracle.com>
Subject: [PATCH 2/2] mm/memory_hotplug: remove head page reference in scan_movable_pages()
Date: Mon, 23 Jan 2023 12:23:47 -0800	[thread overview]
Message-ID: <20230123202347.317065-2-sidhartha.kumar@oracle.com> (raw)
In-Reply-To: <20230123202347.317065-1-sidhartha.kumar@oracle.com>

Remove one user of the Huge Page macros which take in a page. Also remove
a reference to a head page variable by using a folio instead.

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---
 mm/memory_hotplug.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index ad09189786b1..d5a0672cdf3a 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1579,7 +1579,8 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
 	unsigned long pfn;
 
 	for (pfn = start; pfn < end; pfn++) {
-		struct page *page, *head;
+		struct page *page;
+		struct folio *folio;
 		unsigned long skip;
 
 		if (!pfn_valid(pfn))
@@ -1599,9 +1600,9 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
 		if (PageOffline(page) && page_count(page))
 			return -EBUSY;
 
-		if (!PageHuge(page))
+		folio = page_folio(page);
+		if (!folio_test_hugetlb(folio))
 			continue;
-		head = compound_head(page);
 		/*
 		 * This test is racy as we hold no reference or lock.  The
 		 * hugetlb page could have been free'ed and head is no longer
@@ -1609,9 +1610,9 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
 		 * cases false positives and negatives are possible.  Calling
 		 * code must deal with these scenarios.
 		 */
-		if (HPageMigratable(head))
+		if (folio_test_hugetlb_migratable(folio))
 			goto found;
-		skip = compound_nr(head) - (page - head);
+		skip = folio_nr_pages(folio) - (page - &folio->page);
 		pfn += skip - 1;
 	}
 	return -ENOENT;
-- 
2.39.1



  reply	other threads:[~2023-01-23 20:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 20:23 [PATCH 1/2] mm/memory_hotplug: remove head page reference in do_migrate_range Sidhartha Kumar
2023-01-23 20:23 ` Sidhartha Kumar [this message]
2023-01-23 20:39   ` [PATCH 2/2] mm/memory_hotplug: remove head page reference in scan_movable_pages() Matthew Wilcox
2023-01-23 20:37 ` [PATCH 1/2] mm/memory_hotplug: remove head page reference in do_migrate_range Matthew Wilcox
2023-01-23 21:08   ` Sidhartha Kumar
2023-01-24  2:32     ` Matthew Wilcox
2023-01-24 10:17   ` David Hildenbrand

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=20230123202347.317065-2-sidhartha.kumar@oracle.com \
    --to=sidhartha.kumar@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --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