linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jia He <hejianet@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>,
	linux-mm@kvack.org
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Pavel Tatashin <pasha.tatashin@oracle.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	Gioh Kim <gi-oh.kim@profitbricks.com>,
	Daniel Vacek <neelx@redhat.com>,
	linux-kernel@vger.kernel.org, Jia He <hejianet@gmail.com>,
	Jia He <jia.he@hxt-semitech.com>
Subject: [PATCH] Revert "mm/memblock.c: hardcode the end_pfn being -1"
Date: Thu, 15 Mar 2018 19:56:06 -0700	[thread overview]
Message-ID: <1521168966-5245-1-git-send-email-hejianet@gmail.com> (raw)

This reverts commit 379b03b7fa05f7db521b7732a52692448a3c34fe.

Commit 864b75f9d6b0 ("mm/page_alloc: fix memmap_init_zone pageblock
alignment") introduced boot hang issues in arm/arm64 machines, so
Ard Biesheuvel reverted in commit 3e04040df6d4. But there is a
preparation patch for commit 864b75f9d6b0. So just revert it for
the sake of caution.

Signed-off-by: Jia He <jia.he@hxt-semitech.com>
---
 mm/memblock.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index b6ba6b7..5a9ca2a 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1107,7 +1107,7 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
 	struct memblock_type *type = &memblock.memory;
 	unsigned int right = type->cnt;
 	unsigned int mid, left = 0;
-	phys_addr_t addr = PFN_PHYS(++pfn);
+	phys_addr_t addr = PFN_PHYS(pfn + 1);
 
 	do {
 		mid = (right + left) / 2;
@@ -1118,15 +1118,15 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
 				  type->regions[mid].size))
 			left = mid + 1;
 		else {
-			/* addr is within the region, so pfn is valid */
-			return pfn;
+			/* addr is within the region, so pfn + 1 is valid */
+			return min(pfn + 1, max_pfn);
 		}
 	} while (left < right);
 
 	if (right == type->cnt)
-		return -1UL;
+		return max_pfn;
 	else
-		return PHYS_PFN(type->regions[right].base);
+		return min(PHYS_PFN(type->regions[right].base), max_pfn);
 }
 
 /**
-- 
2.7.4

             reply	other threads:[~2018-03-16  2:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16  2:56 Jia He [this message]
2018-03-16  9:06 ` [PATCH] Revert "mm/memblock.c: hardcode the end_pfn being -1" Michal Hocko
2018-03-16  9:26   ` Jia He
2018-03-16 10:27     ` Michal Hocko

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=1521168966-5245-1-git-send-email-hejianet@gmail.com \
    --to=hejianet@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=gi-oh.kim@profitbricks.com \
    --cc=jia.he@hxt-semitech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=neelx@redhat.com \
    --cc=pasha.tatashin@oracle.com \
    --cc=takahiro.akashi@linaro.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;
as well as URLs for NNTP newsgroup(s).