Skip to contentSkip to conversation

Patch "mm/memblock.c: hardcode the end_pfn being -1" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Mar 12, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

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

mm/memblock.c: hardcode the end_pfn being -1

to the 4.14-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-memblock.c-hardcode-the-end_pfn-being-1.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 379b03b7fa05f7db521b7732a52692448a3c34fe Mon Sep 17 00:00:00 2001

From: Daniel Vacek <[email protected]>
Date: Fri, 9 Mar 2018 15:51:09 -0800
Subject: mm/memblock.c: hardcode the end_pfn being -1

From: Daniel Vacek <[email protected]>

commit 379b03b7fa05f7db521b7732a52692448a3c34fe upstream.

This is just a cleanup. It aids handling the special end case in the next commit.

[[email protected]: make it work against current -linus, not against -mm]
[[email protected]: make it work against current -linus, not against -mm some more]
Cc Michal Hocko <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Pavel Tatashin <[email protected]>
Cc Paul Burton <[email protected]>
---
 mm/memblock.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
mm/memblock.c +5 -5
@@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_n
 	struct memblock_type *type = &memblock.memory;
 	unsigned int right = type->cnt;
 	unsigned int mid, left = 0;
-	phys_addr_t addr = PFN_PHYS(pfn + 1);
+	phys_addr_t addr = PFN_PHYS(++pfn);
 
 	do {
 		mid = (right + left) / 2;
@@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_n
 				  type->regions[mid].size))
 			left = mid + 1;
 		else {
-			/* addr is within the region, so pfn + 1 is valid */
-			return min(pfn + 1, max_pfn);
+			/* addr is within the region, so pfn is valid */
+			return pfn;
 		}
 	} while (left < right);
 
 	if (right == type->cnt)
-		return max_pfn;
+		return -1UL;
 	else
-		return min(PHYS_PFN(type->regions[right].base), max_pfn);
+		return PHYS_PFN(type->regions[right].base);
 }
 
 /**

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/mm-page_alloc-fix-memmap_init_zone-pageblock-alignment.patch queue-4.14/mm-memblock.c-hardcode-the-end_pfn-being-1.patch