From: Zhiguo Jiang <justinjiang@vivo.com>
To: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com, Zhiguo Jiang <justinjiang@vivo.com>
Subject: [PATCH] mm: page_alloc: remove MIGRATE_HIGHATOMIC order0 page
Date: Tue, 5 Sep 2023 23:32:30 +0800 [thread overview]
Message-ID: <20230905153230.1291-1-justinjiang@vivo.com> (raw)
The MIGRATE_HIGHATOMIC pages are used for order > 0 allocation,
so pages in MIGRATE_HIGHATOMIC order0 freelist are invalid.
This patch can solve the allocation failure from buddy, due to
the reserved MIGRATE_HIGHATOMIC order0 pages.
Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com>
---
mm/page_alloc.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 14b51d1ef4c3..10c5b053bedf 100755
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -831,6 +831,9 @@ static inline void __free_one_page(struct page *page,
else
to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order);
+ if (unlikely(!order && is_migrate_highatomic(migratetype)))
+ migratetype = MIGRATE_MOVABLE;
+
if (to_tail)
add_to_free_list_tail(page, zone, order, migratetype);
else
@@ -1639,9 +1642,13 @@ static int move_freepages(struct zone *zone,
VM_BUG_ON_PAGE(page_zone(page) != zone, page);
order = buddy_order(page);
- move_to_free_list(page, zone, order, migratetype);
+ if (unlikely(!order && is_migrate_highatomic(migratetype)))
+ move_to_free_list(page, zone, order, MIGRATE_MOVABLE);
+ else {
+ move_to_free_list(page, zone, order, migratetype);
+ pages_moved += 1 << order;
+ }
pfn += 1 << order;
- pages_moved += 1 << order;
}
return pages_moved;
--
2.39.0
reply other threads:[~2023-09-05 15:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230905153230.1291-1-justinjiang@vivo.com \
--to=justinjiang@vivo.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=opensource.kernel@vivo.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