From patchwork Sun Dec 16 12:56:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 10732463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 48CA31399 for ; Sun, 16 Dec 2018 12:56:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B96529C9D for ; Sun, 16 Dec 2018 12:56:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0765129CA1; Sun, 16 Dec 2018 12:56:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8544029C9D for ; Sun, 16 Dec 2018 12:56:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D4138E0004; Sun, 16 Dec 2018 07:56:38 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 55D0E8E0001; Sun, 16 Dec 2018 07:56:38 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FF4F8E0004; Sun, 16 Dec 2018 07:56:38 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id F04868E0001 for ; Sun, 16 Dec 2018 07:56:37 -0500 (EST) Received: by mail-pf1-f198.google.com with SMTP id l22so8881441pfb.2 for ; Sun, 16 Dec 2018 04:56:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id; bh=3vYesHvk/ulght2NVg2rNvNtqqOs9knEFKyr7Wi3SzY=; b=UeAs7ymVRR1NQfvEl4eYTTe8ibvO4NKWR+XV2sj4gyvkf2CTyG+lfs42m1fE418jhV h9jHCXlEb0g36uCN+CQeYmGiQqqaD38EGBKRZVwZDX0MjW1cuaRwjLkT5kEfXPhXKTJh 0CIOV2NouJPqaWIIlPN3/bmGUcvyrcwf1rkcL3gsPQ0g1oBbK1VFgAX9zIM5OEt7iGS1 STcB3I2vtWROL3kG1fOK16vqY2RdugoJT3fDzZN+kKoF1fwZ5J6A8hXBeB4D8ej9lJy2 J9Pou5Dsol00OptZNxazY5fgXHb6iSFZwrKLrECCebwqalEp4AMyA1oWBCqce3cjbnLd cvzg== X-Gm-Message-State: AA+aEWY1oPM+y3dXa3yvns57JoVczdrRV8QmJNAwhm9/JJhooPcHpxVc bkoSSsJC/q2BhtGE5W1K7MhiGdYmXzL3BkdqenQbMMCDxG/lyfNLl0bEG4MAwMk/EqeLXgR7ZGn M7EoXJHPcNLCAf8UQsIwAQ2/u5sd7vOsn5zJAJqra8qV+Q+Dwspoxj1bAjhCgeyZKEfCUPoSUwy Wvzg9tp7ewVQDVtC7wGvCZy/dwsJ8tQdIRnVR2NOrzPp2l4XBALSA1sBM7bLdkQXKoBakduiThS 0L3zqiI9lw0yQj9mPb0AcGPJ4lNgLe5CrmwaexlTTkuqucYyqj6w76aJLFlWPc9DGBUiLLiAbKq STw0CTCsqGD7jUU20hMaEPZMWytZ8d8xU7jXQp7kAE2IhrdjbOAe8D/4eWS+lomNhwIEjL74PXm E X-Received: by 2002:a62:1f9d:: with SMTP id l29mr9433575pfj.14.1544964997566; Sun, 16 Dec 2018 04:56:37 -0800 (PST) X-Received: by 2002:a62:1f9d:: with SMTP id l29mr9433553pfj.14.1544964996743; Sun, 16 Dec 2018 04:56:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544964996; cv=none; d=google.com; s=arc-20160816; b=hxWBEilQdVpko0DKY5GmZemYg9KJU9SajLEWrTJLppVPoejD8UIpPs1qeC9DgcQV+n 1RIcIemsf7dcU8cJbDuCEyy7rZzDB0sD4j8EK+gmJG9Oy8zXC8Ym00IVXPeulcYcFlcB ZdRoNjXNfXMbvAu4CxBMsqU7fGIPzx7ZbsgRt4ZWkViq4xqKBOxs3qiIh8JR0ZfpP0PE PbXTeJu61XoCbAdof55fkvY2Q+CNZOF6avAqbfHntv3vL0/Kia/02VMk3sGxH1ay60SE 6LU3u1UPcHtwr88X5efoieDMyttL8cPzQQH3iMTK90GjhZgFpyfaJgGih4THSpf17MW+ Djow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=3vYesHvk/ulght2NVg2rNvNtqqOs9knEFKyr7Wi3SzY=; b=jR4m+dEvBv8UteO7uKJLQLk4wRkHr/wUTkHGIzuki1ug9lf/+D7GIbg3s3ymF3Rx/e LBuL3Njg0lzbovconTcDNdSLbBFk7BdfkpYXO6AiK9z+T4XSd8l6E5ATlDH+gPETZe95 PjL0hLurX/+dMm+olgJAThXo+sJMO3IY7iYQjU14wVLuLrrMNoA0Ow+RJL73gprhwUCQ NcAdUek0oXQfFMgzVPyWJxbI4fx5SPVLIwW2mP44qZdU0Q6Q1WN19shQUAufwzdGT9F6 L/Hdxjw6/aI4FUwzc5FIjtvZxyG6HCb/0QYfaiYNZQmLH99wQ3Vt2aWC+rpu4iRWKmA8 t+FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MAV8CtrW; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id l185sor16632667pge.32.2018.12.16.04.56.36 for (Google Transport Security); Sun, 16 Dec 2018 04:56:36 -0800 (PST) Received-SPF: pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MAV8CtrW; spf=pass (google.com: domain of richard.weiyang@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=3vYesHvk/ulght2NVg2rNvNtqqOs9knEFKyr7Wi3SzY=; b=MAV8CtrWXcxm32DyP2gfGp3ItfHswZQTh7dFfzHuus9URKJ8daxqy2UDrMFpcL2Gkd DvGbTOJ4RBCLMtLavJmMhtMeGS+s746YPLHLEK1Fi4CrPeJMgfrqWLvGYpQ8ZE1KUJqT KSGyWsbGE+WTfbYog9NANRE+212xWnXwa0WGTJO2j057VCtDbQ7emAzKaEErCKk5njU4 /JcvvCGjmidqzXxYioLsehEV6BGSbbngumT64NbwUJgy7pY86VrO4+Q2N/2tgQTlU1y0 JCtszj/XEBHDS7OQP4z4yZZPSChO0zevxuVvtT1dyLWc95f2PVyUH7f2SG4XrVM1rPja HgbQ== X-Google-Smtp-Source: AFSGD/VxuGa4PPghUjMJslJ7vhaVbTEZKJGWavdHTZECuN/Y1bg5IbT0JW3q842D/Q98DcQN6ZJnHQ== X-Received: by 2002:a63:db48:: with SMTP id x8mr8633652pgi.365.1544964996023; Sun, 16 Dec 2018 04:56:36 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id u186sm15065799pfu.51.2018.12.16.04.56.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Dec 2018 04:56:35 -0800 (PST) From: Wei Yang To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, mgorman@techsingularity.net, mhocko@suse.com, osalvador@suse.de, Wei Yang Subject: [PATCH] mm, page_alloc: clear zone_movable_pfn if the node doesn't have ZONE_MOVABLE Date: Sun, 16 Dec 2018 20:56:24 +0800 Message-Id: <20181216125624.3416-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.15.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP A non-zero zone_movable_pfn indicates this node has ZONE_MOVABLE, while current implementation doesn't comply with this rule when kernel parameter "kernelcore=" is used. Current implementation doesn't harm the system, since the value in zone_movable_pfn is out of the range of current zone. While user would see this message during bootup, even that node doesn't has ZONE_MOVABLE. Movable zone start for each node Node 0: 0x0000000080000000 This fix takes advantage of the highest bit of a pfn to indicate it is used for the calculation instead of the final result. And clear those pfn whose highest bit is set after entire calculation. Signed-off-by: Wei Yang --- include/linux/mm.h | 1 + mm/page_alloc.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 5411de93a363..c3d8a3346dd1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2141,6 +2141,7 @@ static inline unsigned long get_num_physpages(void) * See mm/page_alloc.c for more information on each function exposed by * CONFIG_HAVE_MEMBLOCK_NODE_MAP. */ +#define zone_movable_pfn_highestbit (1UL << (BITS_PER_LONG - 1)) extern void free_area_init_nodes(unsigned long *max_zone_pfn); unsigned long node_map_pfn_alignment(void); unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn, diff --git a/mm/page_alloc.c b/mm/page_alloc.c index eb4df3f63f5e..cd3a77b9cb95 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6841,6 +6841,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { unsigned long size_pages; + zone_movable_pfn[nid] &= ~zone_movable_pfn_highestbit; start_pfn = max(start_pfn, zone_movable_pfn[nid]); if (start_pfn >= end_pfn) continue; @@ -6866,6 +6867,13 @@ static void __init find_zone_movable_pfns_for_nodes(void) * not double account here */ zone_movable_pfn[nid] = end_pfn; + + /* + * Set highest bit to indicate it is + * used for calculation. + */ + zone_movable_pfn[nid] |= + zone_movable_pfn_highestbit; continue; } start_pfn = usable_startpfn; @@ -6904,6 +6912,13 @@ static void __init find_zone_movable_pfns_for_nodes(void) if (usable_nodes && required_kernelcore > usable_nodes) goto restart; + /* + * clear zone_movable_pfn if its highest bit is set + */ + for_each_node_state(nid, N_MEMORY) + if (zone_movable_pfn[nid] & zone_movable_pfn_highestbit) + zone_movable_pfn[nid] = 0; + out2: /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */ for (nid = 0; nid < MAX_NUMNODES; nid++)