From patchwork Mon Jul 16 15:16:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tatashin X-Patchwork-Id: 10527085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4BBCA603ED for ; Mon, 16 Jul 2018 15:16:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3155528E7A for ; Mon, 16 Jul 2018 15:16:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23D4328E87; Mon, 16 Jul 2018 15:16:45 +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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY 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 B156828E7A for ; Mon, 16 Jul 2018 15:16:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DFD66B0008; Mon, 16 Jul 2018 11:16:43 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 28ECC6B000A; Mon, 16 Jul 2018 11:16:43 -0400 (EDT) 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 180576B000C; Mon, 16 Jul 2018 11:16:43 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f197.google.com (mail-qt0-f197.google.com [209.85.216.197]) by kanga.kvack.org (Postfix) with ESMTP id E53596B0008 for ; Mon, 16 Jul 2018 11:16:42 -0400 (EDT) Received: by mail-qt0-f197.google.com with SMTP id x26-v6so30015276qtb.2 for ; Mon, 16 Jul 2018 08:16:42 -0700 (PDT) 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:subject:date:message-id; bh=t7CKv5J4nGKVPPe7IH/P0j7Q5PeU21zXF/6+1/MMXRw=; b=Dpo2Yi7bXGfaaElszkqSUGnaoqAnQC1DV9QS32Zzb60c5JJff20zCEmAndj8dqAkhg bHFVh+b9keHWZe3CSmJuHsJihPLrR8qc6XuCqwDnmG9EBm+zQBfnWAc41YqmD1qTyRGR w90xZRY8ZfF8ensACJ4cPPaSfzds/PEBvqCnKcvOhCNFKxb0BDUlQ/Ilx1gHnGKFyGB0 kywrbmStY05/j93fNlUYNdZOdj3ggh9sHHqfaMtVO41Oz+h34BfEivi70TNIGkmFO84t UT68zLYkWIbg8VTf+PZWV9H8IFqcdhQJsQtYaO2L6m9mI4w+S7/yD8zNg5HlgXgX5v0z FDRw== X-Gm-Message-State: AOUpUlEk7W1HJZ+/GpkFyU02T+RORl9+D370awhfS13SL0H7JKQ89jkB gulL0EUMFMYDhuGELxNfwElKFHxdEaiIdzrU3AucHSWIyb0n4lEJsWZ///PVbV4KwJRDTBic8me 8NJXHzWzhFm+XBpDpqqlAP+pvOIR3IZBTqxi9QSpEBFRfOzuQLbaV5HV+ZVIjOyDQ2Q== X-Received: by 2002:ac8:73ca:: with SMTP id v10-v6mr15864391qtp.329.1531754202670; Mon, 16 Jul 2018 08:16:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf9xRUvDW6ujfecVJPcc5bhokXZnHbCq6svZ0LWq9RB0qwP3zjW+qPWdzLtZvPd51PAmqKj X-Received: by 2002:ac8:73ca:: with SMTP id v10-v6mr15864349qtp.329.1531754202078; Mon, 16 Jul 2018 08:16:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531754202; cv=none; d=google.com; s=arc-20160816; b=tXbNxWwRHAF6eCbbnAbRTL945pzIJm4ZPtrGHmTxGSL7mH0FhmEJ3hoSDLml8F9mDX OMGxaArzHyX2kDzVN4PI5/PHvIbYrbU2j36GL3OPH8UHd1d2IgoFRnURfu0AJBvDYulT 4QXB5xLZYPN0s+BQY7KdL0Jt0PR7UUNdpVTCXPE5Ij2PYKTixf/kB2wr6x9WyannU/oH JAendBDL8kTFACeY/79vOkCHM1NmSF7a6GNT7L5T7v8IRqlRdgjq9VAKZ0KAwSrCCblf q0jNmUvR6GXjVNsELd12MGXzpcsbwUaUJJiDnaFl0CntYCZokb04cIGFdE255InIm66O cjUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature :arc-authentication-results; bh=t7CKv5J4nGKVPPe7IH/P0j7Q5PeU21zXF/6+1/MMXRw=; b=rV/lf2sMZZJPTz+QdKb2XBjTeFotfhrqNcmxlHv9UHUWtBG/7yjHf+Be4vCTWBrB+x 3L7iMMb5csF8HU3ggspI+4kIzG2UtCXbVEr5mqQKTM3tQ58bQvtg3L7KjvCeG/fYgB7n B8LzUf6/Fq7cPVPacgqitdU6HBMPQHltwuWBtR3eXue1JqS/IyyI3+oRPwFZq58KbfRL kTMyTTOvQMffyOvS0LVFpPZslAZj3RVp20nop69YFvx6rrlVlscLvsjNe6C2kD8bo0AV 0/DWRD4R/0xSHq/heUabvcCK0h4vWBzyshUzTbtbai/ZbtTio0uNNwXkIFYR576VD4oS Z2RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=CNlttGtB; spf=pass (google.com: domain of pasha.tatashin@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=pasha.tatashin@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from userp2130.oracle.com (userp2130.oracle.com. [156.151.31.86]) by mx.google.com with ESMTPS id w2-v6si6677431qtb.345.2018.07.16.08.16.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jul 2018 08:16:42 -0700 (PDT) Received-SPF: pass (google.com: domain of pasha.tatashin@oracle.com designates 156.151.31.86 as permitted sender) client-ip=156.151.31.86; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=CNlttGtB; spf=pass (google.com: domain of pasha.tatashin@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=pasha.tatashin@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6GFDgPS049187; Mon, 16 Jul 2018 15:16:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id; s=corp-2018-07-02; bh=t7CKv5J4nGKVPPe7IH/P0j7Q5PeU21zXF/6+1/MMXRw=; b=CNlttGtB45UkETW8rJofuIey48OxEe3ZMHHiT27b/Te53M25Z/AVYluwxrQMMTignkWG Vpb9MlI9NW5bSJIlgP/9D3dHlCMmpJQOuvyk+VZDYDxls2GExzw0FMnuFZASzzTKZfyp Zb6EwL+rB255igUq3A69GvP+IEsWP88xZ2M83Ndex0gvvDRUR4Oyh1yEycD38BlSMalU Xq5WkDPWqCKgG56JJERzUwKKab09YrdGeUIPDIKG5V9KE19UNNah8NBumys3DzJ1CTL7 O24Cv/3cmBgJIWYU0MDc/w/AdnqqqdqCpmCH+ckvzuhlZv1DfL9P1liujK8gpU9p5Rxa yw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2k7a3t4x1g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Jul 2018 15:16:40 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6GFGdbG015651 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Jul 2018 15:16:39 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w6GFGaQt008948; Mon, 16 Jul 2018 15:16:36 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Jul 2018 15:16:35 +0000 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, mhocko@suse.com, linux-mm@kvack.org, mgorman@techsingularity.net, pasha.tatashin@oracle.com, torvalds@linux-foundation.org, gregkh@linuxfoundation.org Subject: [PATCH] mm: don't do zero_resv_unavail if memmap is not allocated Date: Mon, 16 Jul 2018 11:16:30 -0400 Message-Id: <20180716151630.770-1-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.18.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8956 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=920 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807160177 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 Moving zero_resv_unavail before memmap_init_zone(), caused a regression on x86-32. The cause is that we access struct pages before they are allocated when CONFIG_FLAT_NODE_MEM_MAP is used. free_area_init_nodes() zero_resv_unavail() mm_zero_struct_page(pfn_to_page(pfn)); <- struct page is not alloced free_area_init_node() if CONFIG_FLAT_NODE_MEM_MAP alloc_node_mem_map() memblock_virt_alloc_node_nopanic() <- struct page alloced here On the other hand memblock_virt_alloc_node_nopanic() zeroes all the memory that it returns, so we do not need to do zero_resv_unavail() here. Fixes: e181ae0c5db9 ("mm: zero unavailable pages before memmap init") Signed-off-by: Pavel Tatashin Tested-by: Matt Hart Acked-by: Michal Hocko --- include/linux/mm.h | 2 +- mm/page_alloc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index a0fbb9ffe380..3982c83fdcbf 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2132,7 +2132,7 @@ extern int __meminit __early_pfn_to_nid(unsigned long pfn, struct mminit_pfnnid_cache *state); #endif -#ifdef CONFIG_HAVE_MEMBLOCK +#if defined(CONFIG_HAVE_MEMBLOCK) && !defined(CONFIG_FLAT_NODE_MEM_MAP) void zero_resv_unavail(void); #else static inline void zero_resv_unavail(void) {} diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5d800d61ddb7..a790ef4be74e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6383,7 +6383,7 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size, free_area_init_core(pgdat); } -#ifdef CONFIG_HAVE_MEMBLOCK +#if defined(CONFIG_HAVE_MEMBLOCK) && !defined(CONFIG_FLAT_NODE_MEM_MAP) /* * Only struct pages that are backed by physical memory are zeroed and * initialized by going through __init_single_page(). But, there are some @@ -6421,7 +6421,7 @@ void __paginginit zero_resv_unavail(void) if (pgcnt) pr_info("Reserved but unavailable: %lld pages", pgcnt); } -#endif /* CONFIG_HAVE_MEMBLOCK */ +#endif /* CONFIG_HAVE_MEMBLOCK && !CONFIG_FLAT_NODE_MEM_MAP */ #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP