Received: by 10.213.65.68 with SMTP id h4csp126754imn; Thu, 15 Mar 2018 19:59:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELsC00vSWuEi8SSURp8gkZMPGLQxRI+GMOzA2QK1E5VKsZlUkUqhPr6QrTyzxiBS/w1M6i9o X-Received: by 2002:a17:902:3a3:: with SMTP id d32-v6mr238793pld.219.1521169181376; Thu, 15 Mar 2018 19:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521169181; cv=none; d=google.com; s=arc-20160816; b=yBPYQxFcXKE9LelNueQH7zbt2GRbHxIpwx5fn5R1t3Ov7CL/Z5j6PZccF2n8DtMcuz a2/rrTRDCXYQByOvZSs/g3letQ3l0p7rmKJJhxCICcw46JwRglSbeJPBTyqy7KRO6G4V hoK1A2yXefUhpsXjUJds/4iGfipp3/bIz8AVLLPNxmPxLKjyuTCq/vdpW1EbQYTND6BE Bydqxjia2wF3ycvahY7GCqQww+nKW56o1ZDNHqKqCnHqP23tWRmH7MUI1+jhTeeeknGL sKi+dO6US7g+nnBzxaksUk6bEK1UCIaz4+KzTFh5hA7yF/MrZfkMHHaOvRJ57bGSl5r0 ou4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=zpTBwdaRyRHodDHMMCK5gGBQmLZ94VrjDBDrzk2s/DQ=; b=vaBNww0/MnH27qI0PgiBaxmVsEGNZKeWY8FWQPIDSRNd410lkXu6c8x96eFY6glHnZ VmHTuZh3P5ZCNnM1JrLjPS/ZOkREfep8dzoWQVhMhfhFEsmmqpx9F6qjNA/iGwbXrS1j UDdaR5LEPLxPCvVQipz5NVHsOFspSaCb3rH385Wxk8LwsaFDnIJdYDl8Yp/JDOqu2ncC QVzIdBiRN+VRTkFfx8P/Iry8/6YCRINYiIX8i3JN5oa2ZvyOKBWlZuYdL8awCHN4LTxU Lwy/JaJLoWi7qyZTl6WCYbsU6MCEbNI+1PQ6AKW49AhvN3OQAorUqzOhPMqrJlZNUkiF e5rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oV4vkqHV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6-v6si5202244pls.424.2018.03.15.19.59.27; Thu, 15 Mar 2018 19:59:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oV4vkqHV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933311AbeCPC4v (ORCPT + 99 others); Thu, 15 Mar 2018 22:56:51 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:45625 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932617AbeCPC4t (ORCPT ); Thu, 15 Mar 2018 22:56:49 -0400 Received: by mail-pg0-f68.google.com with SMTP id s13so3560144pgn.12 for ; Thu, 15 Mar 2018 19:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=zpTBwdaRyRHodDHMMCK5gGBQmLZ94VrjDBDrzk2s/DQ=; b=oV4vkqHVxyTJTHdqYd+DtKsvy8hVXnRCrWRBjfL/pB1HCMM0lfCflxuwhrvsRHgfzJ XGWHc3ZiSqizah0l71kj1WkIxBPR2iSYe0mywY0HqSnHfgoUDzX905CexWrifJ0fwEOX ciuwMkYkXyCdUpLRaSsE3kH6awHPydLGRuIKx7m0/GBA6sLKixUTa95qQJWYGptpt+u0 vqFGYKjNOWoWlylVNIFI+wuNnoStxEZmMR213ruZfrN9bDYi6erPpMX6gsLCfeLrcKrG Pfw1807rsoxBqE2f7pHU11iym2yNhFf9apVD3wpluWwvQaabBiFaIcko9QV20S0OVhMc jQGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zpTBwdaRyRHodDHMMCK5gGBQmLZ94VrjDBDrzk2s/DQ=; b=aF3tWlWpxuI/5NLjvuiaPbPgCEhKKRRHsgfL/jqrKgNQU8D4UxqiU9fnyNaTrRJ9Rs JAUidtH645t/KLrXn9vYDPI9e8dx00wi1G9b48nvhOYzL/PMn/6JtOFjFrnEjz9mr58f 4DKjgXLMlim/xiXB/IH7QbDwqggDuyBcZ2zxFzVWkv2wIJbeopDSSOz0jVNMLijcRbRq RPIdl7aLOvQTDE1aK+npVIxs4P7+IReJCD3flgPyymXAUl2OXMvjlKmYFHuWvmS7yS89 PIJ71IqwsmezNzft1gFA9LanDVUbvy/NAkmoLJFxYoQ/namno/4QUY82JtEU0ZMB6HYM Lplw== X-Gm-Message-State: AElRT7FkbvMkREHuGe2GjFLf1hJ5omY9/QiFfURTulc8O6SjX1KyW4ei poPlP7VkTTzyKp04g0RAIJV8bQ== X-Received: by 10.99.54.74 with SMTP id d71mr172111pga.86.1521169008516; Thu, 15 Mar 2018 19:56:48 -0700 (PDT) Received: from localhost.localdomain ([38.106.11.25]) by smtp.gmail.com with ESMTPSA id a72sm4380767pfj.95.2018.03.15.19.56.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Mar 2018 19:56:47 -0700 (PDT) From: Jia He To: Andrew Morton , Michal Hocko , linux-mm@kvack.org Cc: Catalin Marinas , Pavel Tatashin , Ard Biesheuvel , AKASHI Takahiro , Gioh Kim , Daniel Vacek , linux-kernel@vger.kernel.org, Jia He , Jia He Subject: [PATCH] Revert "mm/memblock.c: hardcode the end_pfn being -1" Date: Thu, 15 Mar 2018 19:56:06 -0700 Message-Id: <1521168966-5245-1-git-send-email-hejianet@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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