Received: by 10.223.185.116 with SMTP id b49csp307374wrg; Fri, 2 Mar 2018 19:53:55 -0800 (PST) X-Google-Smtp-Source: AG47ELtPFSvv30y3JqkvWG+Y2FLAGwxJb0w7iwqmtvujyjCtXEezD/xV0RVczGgpYhuAzBk0Tmbc X-Received: by 2002:a17:902:2de4:: with SMTP id p91-v6mr7266578plb.405.1520049235730; Fri, 02 Mar 2018 19:53:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520049235; cv=none; d=google.com; s=arc-20160816; b=w7Ejg0plqu3+xCkk6irGjaWqEALdGrka0w0xBYJb+FlRJYqdaH+S2t82rHqep+6m9L clY/ZTFnSU5DDnfFC95arPT1O90u3REeGZRak86+Ihk5iqijmRHoY4oJOAvaufH8fH39 95Akzv3bEV/EkkGVoPP21j+ez0EUlUrwIj1Z9wabpxcHsLygoaASQnd3toc7e/glAl2F 50D+Lt3HKn88KpjFdbi8XLPqKyMo5PnuH0j2uJC5mAhNYwA6C/NDqMkG4bIfhMlkyPZc LLSnGeDJSRwT+d5ngZPVrnkvmr4/j3fjuD70ApuRMv+ZuVgj8laOBLFFoNwP86luBKlF cLCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bJbZE1UvO4xOP3qSgbcteZ2x1BoBwAR1f1pAl9CcMFc=; b=G2HG2V1+ydMLXd3amZhnNa5TypDBHSfz64s5sER6GyUTYwUB2BfRmHXrO59aDmbgF7 zerkSJs8zm3/6RjyjYbN7V7Un9ywwj6pC7yK+DYcPg/gGAF0k1/4GwOOGUyXjZWENMvV 6v7pTmV1O+OEpg0jr3BZq4yR6BBUWeCHDoOtDrVtjHkP9v8OgvBFoaUhiWpWq6OpQSDa ISpYShMHsl8gt3wyO3KCDhXciQS2vlGNjfJcH5XAf93D7k72+CWD8DjQjcGIlmqmeoA2 1OANVENBsn6nDy4i9VIXpvxloQyvpGg7o0w8XN9RYlSXXvdCP3iRRbGaJ777urwVmRQ1 LuXw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si5952566pfz.382.2018.03.02.19.53.41; Fri, 02 Mar 2018 19:53:55 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935297AbeCCANP (ORCPT + 99 others); Fri, 2 Mar 2018 19:13:15 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36230 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935244AbeCCAMr (ORCPT ); Fri, 2 Mar 2018 19:12:47 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB8F74023150; Sat, 3 Mar 2018 00:12:46 +0000 (UTC) Received: from slurm.brq.redhat.com (unknown [10.40.205.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id 398A32156601; Sat, 3 Mar 2018 00:12:45 +0000 (UTC) From: Daniel Vacek To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , Michal Hocko , Vlastimil Babka , Mel Gorman , Pavel Tatashin , Paul Burton , Daniel Vacek , stable@vger.kernel.org Subject: [PATCH v3 1/2] mm/memblock: hardcode the end_pfn being -1 Date: Sat, 3 Mar 2018 01:12:25 +0100 Message-Id: <1ca478d4269125a99bcfb1ca04d7b88ac1aee924.1520011944.git.neelx@redhat.com> In-Reply-To: References: <1519908465-12328-1-git-send-email-neelx@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sat, 03 Mar 2018 00:12:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sat, 03 Mar 2018 00:12:46 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'neelx@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is just a clean up. It aids preventing to handle the special end case in the next commit. Signed-off-by: Daniel Vacek Cc: stable@vger.kernel.org --- mm/memblock.c | 13 ++++++------- mm/page_alloc.c | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index 5a9ca2a1751b..2a5facd236bb 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1101,13 +1101,12 @@ void __init_memblock __next_mem_pfn_range(int *idx, int nid, *out_nid = r->nid; } -unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn, - unsigned long max_pfn) +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 + 1); + phys_addr_t addr = PFN_PHYS(++pfn); do { mid = (right + left) / 2; @@ -1118,15 +1117,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 + 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); } /** diff --git a/mm/page_alloc.c b/mm/page_alloc.c index cb416723538f..f2c57da5bbe5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5361,7 +5361,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, * end_pfn), such that we hit a valid pfn (or end_pfn) * on our next iteration of the loop. */ - pfn = memblock_next_valid_pfn(pfn, end_pfn) - 1; + pfn = memblock_next_valid_pfn(pfn) - 1; #endif continue; } -- 2.16.2