Patch "mm/huge_memory: minor cleanup for split_huge_pages_all" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mm/huge_memory: minor cleanup for split_huge_pages_all

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-huge_memory-minor-cleanup-for-split_huge_pages_al.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e82aa4522a50e75561e85c32d08c874cb1309143
Author: Miaohe Lin <linmiaohe@xxxxxxxxxx>
Date:   Mon Jul 4 21:21:57 2022 +0800

    mm/huge_memory: minor cleanup for split_huge_pages_all
    
    [ Upstream commit a17206dac7b262e7abed5a05e34a6bd6bd0a9b06 ]
    
    There is nothing to do if a zone doesn't have any pages managed by the
    buddy allocator. So we should check managed_zone instead. Also if a thp
    is found, there's no need to traverse the subpages again.
    
    Link: https://lkml.kernel.org/r/20220704132201.14611-13-linmiaohe@xxxxxxxxxx
    Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
    Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
    Cc: Muchun Song <songmuchun@xxxxxxxxxxxxx>
    Cc: Yang Shi <shy828301@xxxxxxxxx>
    Cc: Zach O'Keefe <zokeefe@xxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Stable-dep-of: 2b7aa91ba0e8 ("mm/huge_memory: use pfn_to_online_page() in split_huge_pages_all()")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 8cc150a88361..34d2979489fd 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2879,9 +2879,12 @@ static void split_huge_pages_all(void)
 	unsigned long total = 0, split = 0;
 
 	pr_debug("Split all THPs\n");
-	for_each_populated_zone(zone) {
+	for_each_zone(zone) {
+		if (!managed_zone(zone))
+			continue;
 		max_zone_pfn = zone_end_pfn(zone);
 		for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++) {
+			int nr_pages;
 			if (!pfn_valid(pfn))
 				continue;
 
@@ -2897,8 +2900,10 @@ static void split_huge_pages_all(void)
 
 			total++;
 			lock_page(page);
+			nr_pages = thp_nr_pages(page);
 			if (!split_huge_page(page))
 				split++;
+			pfn += nr_pages - 1;
 			unlock_page(page);
 next:
 			put_page(page);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux