* [merged mm-hotfixes-stable] mm-page_alloc-reduce-potential-fragmentation-in-make_alloc_exact.patch removed from -mm tree
@ 2022-10-21 4:34 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-10-21 4:34 UTC (permalink / raw)
To: mm-commits, willy, Liam.Howlett, Liam.Howlett, akpm
The quilt patch titled
Subject: mm/page_alloc: reduce potential fragmentation in make_alloc_exact()
has been removed from the -mm tree. Its filename was
mm-page_alloc-reduce-potential-fragmentation-in-make_alloc_exact.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
Subject: mm/page_alloc: reduce potential fragmentation in make_alloc_exact()
Date: Tue, 31 May 2022 09:20:51 -0400
Try to avoid using the left over split page on the next request for a page
by calling __free_pages_ok() with FPI_TO_TAIL. This increases the
potential of defragmenting memory when it's used for a short period of
time.
Link: https://lkml.kernel.org/r/20220531185626.yvlmymbxyoe5vags@revolver
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Suggested-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/page_alloc.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
--- a/mm/page_alloc.c~mm-page_alloc-reduce-potential-fragmentation-in-make_alloc_exact
+++ a/mm/page_alloc.c
@@ -5784,14 +5784,18 @@ static void *make_alloc_exact(unsigned l
size_t size)
{
if (addr) {
- unsigned long alloc_end = addr + (PAGE_SIZE << order);
- unsigned long used = addr + PAGE_ALIGN(size);
+ unsigned long nr = DIV_ROUND_UP(size, PAGE_SIZE);
+ struct page *page = virt_to_page((void *)addr);
+ struct page *last = page + nr;
- split_page(virt_to_page((void *)addr), order);
- while (used < alloc_end) {
- free_page(used);
- used += PAGE_SIZE;
- }
+ split_page_owner(page, 1 << order);
+ split_page_memcg(page, 1 << order);
+ while (page < --last)
+ set_page_refcounted(last);
+
+ last = page + (1UL << order);
+ for (page += nr; page < last; page++)
+ __free_pages_ok(page, 0, FPI_TO_TAIL);
}
return (void *)addr;
}
_
Patches currently in -mm which might be from Liam.Howlett@Oracle.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-21 4:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-21 4:34 [merged mm-hotfixes-stable] mm-page_alloc-reduce-potential-fragmentation-in-make_alloc_exact.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.