From patchwork Tue Jul 24 23:55:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tatashin X-Patchwork-Id: 10543347 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 A1A2E17FD for ; Wed, 25 Jul 2018 00:26:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91CA829634 for ; Wed, 25 Jul 2018 00:26:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84F4829686; Wed, 25 Jul 2018 00:26:04 +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 21B5929634 for ; Wed, 25 Jul 2018 00:26:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2A1F6B0266; Tue, 24 Jul 2018 20:26:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CAB9B6B0269; Tue, 24 Jul 2018 20:26:02 -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 B2DD26B026B; Tue, 24 Jul 2018 20:26:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f199.google.com (mail-qk0-f199.google.com [209.85.220.199]) by kanga.kvack.org (Postfix) with ESMTP id 7817F6B0266 for ; Tue, 24 Jul 2018 20:26:02 -0400 (EDT) Received: by mail-qk0-f199.google.com with SMTP id o18-v6so5100024qko.21 for ; Tue, 24 Jul 2018 17:26:02 -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 :in-reply-to:references; bh=6aWuan11IWk/DcBupTrYoAeSdfAJLrkW5ftubRZU8OU=; b=IyJyyoi+W32XhxFJipuHcTHsaGPE5D3M4OGxKm5usvEW3acNquxQs3+FhOuakxeExN dG61Ek+6CiKjB0oalYamFPMbLPEAkL64vzcu+o9LmJDdxAmtc59YEPi5Dg1OuKRu/XmC xLMERfjA3ngZLcfLPRaUzoJOJMFXOOcCdFBvvuv2KPlT2EIdI/bm63pwAjaR6C0Jf8o7 yM7hEzf1VrVIe4JZsLPhfyEdZXLQcvmpdb9gbCd4T2t3eqFYuQBoqr+U6I617QIvndmv wJJWDG46IO8xvKFD2V9WfI02nOdtw6VEWMv4tYTAiuEVjAMzXRRheh8j4KpZTyZbOiOt 23Zg== X-Gm-Message-State: AOUpUlF2ghSwk8Blboq/sPFQddwiNO74kegc9/+J6lwsZLvQEAbNYYwN vawxg4jpQtME9w6F6apBFjZqmcnsC5r8tgPkD2cqr3u+EFuN4S8F7rh42X8LaKmoPm2PTgssqwi M18F4WXaS0aXL6yIVVnaY8YGmpk09uAvOPl4HoOXuYL1Xul5vek3xCUUbRa3rjGx/oQ== X-Received: by 2002:a0c:ab11:: with SMTP id h17-v6mr16627333qvb.114.1532478362290; Tue, 24 Jul 2018 17:26:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe7gMXWtYEGMBnvg1WiQkWkM7809ZuBf6BylLQ4jc9zHLOfck5RYe24oa3Ot7OiNrJB3fAK X-Received: by 2002:a0c:ab11:: with SMTP id h17-v6mr16627317qvb.114.1532478361764; Tue, 24 Jul 2018 17:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532478361; cv=none; d=google.com; s=arc-20160816; b=ULGNftwcK535ppPJWRYsPmpkeXRo4MkXSjs1kvVsIzxdLbFoCYNcZmXJUtaroBAX/s gquOm5nkaSyLf3ai79Jihjw9CTWQqpLrR1FjvO3J6jHa7qwjIdCDU7OOi+q5Sz6Z/fS9 SqH6BMBHVjGq7jq2Ds7HXhP+7ejiuM+zuj1DDcgmh40EeCU/RtyV0+dJIsndM7TzEcF3 tGOuVfdln6+/fsPgUP0LRb/l1B/oWQM+nXssGHWYS9fue6EyrdnbMRFl9Kwcwq6hPHsX y5R2mdNKvMi1m6H0I1EgIwjpYWIU0ZVDUx+SxKFZpZvwTuN+Of+r933GzwOKtvJ/Cr3+ ZRHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=6aWuan11IWk/DcBupTrYoAeSdfAJLrkW5ftubRZU8OU=; b=0mlltboQ/ngNAR2DALfRe3yO2GY/zPlMxrcY2u/lGaaKVQtn9NMC76sjwIbV+XRpk3 Jeo88twCJFoUIcsUhd9kTu2sRVH3XKI3E+5BcHybJEEBdCp49ZYLBwaSVMWhNNE4b36l fSvtjeNUMOJwZ2rGqkXHKZ8dU0DoDnNVAqL1TpJj8kltaZKWbNrHDn3aLYeiyGE96ih1 OoSssjqqDTq9T/oqnX0qEiICuPxDtGYxDBKBS8zvlfAnvIBKWbK2EH6LWXZ1CW4YpjsQ 4eUqANNeyNHpLSjsxQSIX405X8iuCr3n4cOb5EJbueTO4c0AC/LIOhzpSUnl9VuPCcLp LZCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=o327C6cV; spf=pass (google.com: domain of pasha.tatashin@oracle.com designates 141.146.126.79 as permitted sender) smtp.mailfrom=pasha.tatashin@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from aserp2130.oracle.com (aserp2130.oracle.com. [141.146.126.79]) by mx.google.com with ESMTPS id e65-v6si75773qkd.158.2018.07.24.17.26.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 17:26:01 -0700 (PDT) Received-SPF: pass (google.com: domain of pasha.tatashin@oracle.com designates 141.146.126.79 as permitted sender) client-ip=141.146.126.79; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=o327C6cV; spf=pass (google.com: domain of pasha.tatashin@oracle.com designates 141.146.126.79 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 (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6P0NvdY146026; Wed, 25 Jul 2018 00:25:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=6aWuan11IWk/DcBupTrYoAeSdfAJLrkW5ftubRZU8OU=; b=o327C6cVX2BuJz1UGd+tYK9O6iWH/6vEnDrETVH4HfFfevq+MGKk8mbipzGifHpTTjWf gggz+9E6jMy6pwZbn6Iwh01M48HuUqx9hdWejRj1oC8OdgVgYMNjhLht6BaE0nXvC/NI pkTF5nxLPt1WDoBFjV/OWb024N3rfYgn6/RxBer8suFaGm91U2I6SDZx4vfNFQpLXbbK GLpudTcZ03HzaJJqwkbtxux7ZqFjwDWRYnCy6TZ0igXKNSiR7lvdGxEEMuBeZ1TcfqtK u1PQvzN1kFsFEncrCX9Ab8PkmZGzu4QYoAV6EEXau1Zzr4pWekhFUVmF6mF4u/5oKru0 sw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2kbtbcue8u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jul 2018 00:25:51 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6P0PoxH004882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jul 2018 00:25:50 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w6P0Pm6p012502; Wed, 25 Jul 2018 00:25:48 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 24 Jul 2018 16:55:27 -0700 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, dan.j.williams@intel.com, jack@suse.cz, jglisse@redhat.com, jrdr.linux@gmail.com, bhe@redhat.com, gregkh@linuxfoundation.org, vbabka@suse.cz, richard.weiyang@gmail.com, dave.hansen@intel.com, rientjes@google.com, mingo@kernel.org, osalvador@techadventures.net, pasha.tatashin@oracle.com, abdhalee@linux.vnet.ibm.com, mpe@ellerman.id.au Subject: [PATCH 1/3] mm: make memmap_init a proper function Date: Tue, 24 Jul 2018 19:55:18 -0400 Message-Id: <20180724235520.10200-2-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180724235520.10200-1-pasha.tatashin@oracle.com> References: <20180724235520.10200-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8964 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=605 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807250002 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 memmap_init is sometimes a macro sometimes a function based on __HAVE_ARCH_MEMMAP_INIT. It is only a function on ia64. Make memmap_init a weak function instead, and let ia64 redefine it. Signed-off-by: Pavel Tatashin Reviewed-by: Oscar Salvador --- arch/ia64/include/asm/pgtable.h | 1 - mm/page_alloc.c | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h index 165827774bea..b1e7468eb65a 100644 --- a/arch/ia64/include/asm/pgtable.h +++ b/arch/ia64/include/asm/pgtable.h @@ -544,7 +544,6 @@ extern struct page *zero_page_memmap_ptr; # ifdef CONFIG_VIRTUAL_MEM_MAP /* arch mem_map init routine is needed due to holes in a virtual mem_map */ -# define __HAVE_ARCH_MEMMAP_INIT extern void memmap_init (unsigned long size, int nid, unsigned long zone, unsigned long start_pfn); # endif /* CONFIG_VIRTUAL_MEM_MAP */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a790ef4be74e..cea749b26394 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5554,10 +5554,11 @@ static void __meminit zone_init_free_lists(struct zone *zone) } } -#ifndef __HAVE_ARCH_MEMMAP_INIT -#define memmap_init(size, nid, zone, start_pfn) \ - memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY, NULL) -#endif +void __meminit __weak memmap_init(unsigned long size, int nid, + unsigned long zone, unsigned long start_pfn) +{ + memmap_init_zone(size, nid, zone, start_pfn, MEMMAP_EARLY, NULL); +} static int zone_batchsize(struct zone *zone) { From patchwork Tue Jul 24 23:55:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tatashin X-Patchwork-Id: 10543345 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 3B5BC17FD for ; Wed, 25 Jul 2018 00:26:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28F2729634 for ; Wed, 25 Jul 2018 00:26:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B43B29686; Wed, 25 Jul 2018 00:26:02 +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 8D5F429634 for ; Wed, 25 Jul 2018 00:26:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A66BF6B000E; Tue, 24 Jul 2018 20:26:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9ECA46B0010; Tue, 24 Jul 2018 20:26:00 -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 866E26B0266; Tue, 24 Jul 2018 20:26:00 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f200.google.com (mail-qk0-f200.google.com [209.85.220.200]) by kanga.kvack.org (Postfix) with ESMTP id 56E8E6B000E for ; Tue, 24 Jul 2018 20:26:00 -0400 (EDT) Received: by mail-qk0-f200.google.com with SMTP id v65-v6so5064113qka.23 for ; Tue, 24 Jul 2018 17:26:00 -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 :in-reply-to:references; bh=GiLkvI8Rp3OQo1+Ryx+tNZlttGtHfZulAZ/cM6I2/6Y=; b=Ml7UvJ72nPAN7Zo1jrGnZs5dYGmgSBw9IEewrp6vgOwnX6sLaNQya8DrpZ8OQbPr8x FzklFrP96R7Fsdh9xWQLbuqt/STr1tkJ0YGivdyYevORQ2Yz+rbj/zpXfBpz4n2sTIWH 9wOAZzlosNcdBvEeQFH0DCwfuFp9OlcuztCHTIhOVbWg4yV06ObBIH+4Hh/QEk43p4gi deK4xX1HM4q3a75bTWU9NCFc6+Kt/nQMCXPX+x2mZg/OGdpsFiGa6IIHi5SFBUPaxqGj v9pqWlztAOpPiPFd+Mc7iuKFUeoj7ErtZf9+m2JCQb7oarpdNU7NVU3t3bWu59DUwUpO yOjg== X-Gm-Message-State: AOUpUlGPfjz6pt/QxqRePeCFHTfglDiO+JbyQk80F7/LGIT0WIe0JXiE g8DbFoZfkvxTZiHylCktDjNr29dFZS4DqKrL4HUjF35jqWCyDDFYjZaabWzh3kdPztlKcHya/iU yh6WwhEhn3kUKrE7W+kA+gjRgm58SgrT7mJQ2gtmN6uBe7AqOcn6Y/lR8C9Y9cqxeLw== X-Received: by 2002:ae9:e007:: with SMTP id m7-v6mr12878107qkk.268.1532478360093; Tue, 24 Jul 2018 17:26:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc7jP5qCrmnpmasHmIC0Ld+nEFROkk2i5uvoK3XXd0MmKzDaAPSGqNpyWnX/ISAfP9tB9ix X-Received: by 2002:ae9:e007:: with SMTP id m7-v6mr12878082qkk.268.1532478359537; Tue, 24 Jul 2018 17:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532478359; cv=none; d=google.com; s=arc-20160816; b=Y+i4ShGKFXlOwDLOz/Zp2tuqQ9qV0QJ/sQQGlIki5jlLWK9Me5PP8SvTkT+aGaEkIn hq/yNfvyg+vk6CCrF1JEJwE9CagYNTeaSA3kL3haOHh/UJnT369xfvOp8WRz5SeUENJH xaqp/RMo4yqLY2U0jm14q/i0z15zioaBVAU+rK+trVYLWSIzu9lqgqZs1eB7vIonkNsY s4yZCgu8zrgqWMTefzKlwwQz1b/Uu0m3ZAtqNypCxL2i6F/rKJbTK3+PRAEbKahg1PrU Gi0JPilFTguWBhiMtps1/yvT7s4jCXEcVLQZYIPEJtQS10H/H/eSx+NwaapHrs8VcNCe cvIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=GiLkvI8Rp3OQo1+Ryx+tNZlttGtHfZulAZ/cM6I2/6Y=; b=Vgbf4hJtONZt4yqDlVScYxSfagy+QRKQn/9ADSBq1HFeUk/cYov+QBr1JJPv9jcXN0 QF6i69FIXQiZeI+wKScbBoZXcZTwtz271+DnOrHhN7+piYumMHEp6PV7uO+qT3pdNA9y tZpOccCXdB19CoNOzCRP2C7mY4d3FuBFr48pRtpjw9JqY6lvgXGnlgIlX0PMLnmUn9/S QOyoG3gAI7ZCvMcrbjU6PYFrJiYqqoGkNL6CIDVxuIOl6fNiwRFxxd0/v5juvT9VOgEI JgFXZRaxUIyTPf4kFKGFB1WUloTUHEqb61oVx+SQpZZ1/izFoboVLf+tv2fU7BqBb4W8 cotw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=VPFq6wjj; spf=pass (google.com: domain of pasha.tatashin@oracle.com designates 156.151.31.85 as permitted sender) smtp.mailfrom=pasha.tatashin@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from userp2120.oracle.com (userp2120.oracle.com. [156.151.31.85]) by mx.google.com with ESMTPS id g187-v6si3872003qkb.320.2018.07.24.17.25.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 17:25:59 -0700 (PDT) Received-SPF: pass (google.com: domain of pasha.tatashin@oracle.com designates 156.151.31.85 as permitted sender) client-ip=156.151.31.85; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=VPFq6wjj; spf=pass (google.com: domain of pasha.tatashin@oracle.com designates 156.151.31.85 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 (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6P0O5Uq119841; Wed, 25 Jul 2018 00:25:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=GiLkvI8Rp3OQo1+Ryx+tNZlttGtHfZulAZ/cM6I2/6Y=; b=VPFq6wjj6HC3TyWIxOtTQlEht/S1fAm1umaLHyOrqa1ryEWJcg42S3BwFYeySC8bp1jY 9VJVoqrmIDFQg97jFTzoB5T2Ze/JzYWhqNeRZCM2z6bPdJ1jDKa2pFT19fUIHS4YxMLN duWdpjcm4ysQEmNjRH72gInuIca2wYJ2AbNKHSaH5yrO+EMwnEUI8R6OA+gQXeWqL/pR JzmdlegPtfeXZpesVfdEL9ejDin98DNJn4sMg0jhKZqIO5bwdRlFU2yiAf9RHzPG7gZ9 GBs0himAaB0CFj4gb+v4Cpwn8apN3TBShBdBVy0CIXPgOrOGRhv+IjbifMyUEdYYmMkX Cw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2kbwfpu969-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jul 2018 00:25:50 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6P0PmwF004846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jul 2018 00:25:49 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w6P0PmCk003387; Wed, 25 Jul 2018 00:25:48 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 24 Jul 2018 16:55:29 -0700 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, dan.j.williams@intel.com, jack@suse.cz, jglisse@redhat.com, jrdr.linux@gmail.com, bhe@redhat.com, gregkh@linuxfoundation.org, vbabka@suse.cz, richard.weiyang@gmail.com, dave.hansen@intel.com, rientjes@google.com, mingo@kernel.org, osalvador@techadventures.net, pasha.tatashin@oracle.com, abdhalee@linux.vnet.ibm.com, mpe@ellerman.id.au Subject: [PATCH 2/3] mm: calculate deferred pages after skipping mirrored memory Date: Tue, 24 Jul 2018 19:55:19 -0400 Message-Id: <20180724235520.10200-3-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180724235520.10200-1-pasha.tatashin@oracle.com> References: <20180724235520.10200-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8964 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807250002 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 update_defer_init() should be called only when struct page is about to be initialized. Because it counts number of initialized struct pages, but there we may skip struct pages if there is some mirrored memory. So move, update_defer_init() after checking for mirrored memory. Also, rename update_defer_init() to defer_init() and reverse the return boolean to emphasize that this is a boolean function, that tells that the reset of memmap initialization should be deferred. Make this function self-contained: do not pass number of already initialized pages in this zone by using static counters. Signed-off-by: Pavel Tatashin --- mm/page_alloc.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index cea749b26394..86c678cec6bd 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -306,24 +306,28 @@ static inline bool __meminit early_page_uninitialised(unsigned long pfn) } /* - * Returns false when the remaining initialisation should be deferred until + * Returns true when the remaining initialisation should be deferred until * later in the boot cycle when it can be parallelised. */ -static inline bool update_defer_init(pg_data_t *pgdat, - unsigned long pfn, unsigned long zone_end, - unsigned long *nr_initialised) +static inline bool defer_init(int nid, unsigned long pfn, unsigned long end_pfn) { + static unsigned long prev_end_pfn, nr_initialised; + + if (prev_end_pfn != end_pfn) { + prev_end_pfn = end_pfn; + nr_initialised = 0; + } + /* Always populate low zones for address-constrained allocations */ - if (zone_end < pgdat_end_pfn(pgdat)) - return true; - (*nr_initialised)++; - if ((*nr_initialised > pgdat->static_init_pgcnt) && - (pfn & (PAGES_PER_SECTION - 1)) == 0) { - pgdat->first_deferred_pfn = pfn; + if (end_pfn < pgdat_end_pfn(NODE_DATA(nid))) return false; + nr_initialised++; + if ((nr_initialised > NODE_DATA(nid)->static_init_pgcnt) && + (pfn & (PAGES_PER_SECTION - 1)) == 0) { + NODE_DATA(nid)->first_deferred_pfn = pfn; + return true; } - - return true; + return false; } #else static inline bool early_page_uninitialised(unsigned long pfn) @@ -331,11 +335,9 @@ static inline bool early_page_uninitialised(unsigned long pfn) return false; } -static inline bool update_defer_init(pg_data_t *pgdat, - unsigned long pfn, unsigned long zone_end, - unsigned long *nr_initialised) +static inline bool defer_init(int nid, unsigned long pfn, unsigned long end_pfn) { - return true; + return false; } #endif @@ -5462,9 +5464,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, struct vmem_altmap *altmap) { unsigned long end_pfn = start_pfn + size; - pg_data_t *pgdat = NODE_DATA(nid); unsigned long pfn; - unsigned long nr_initialised = 0; struct page *page; #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP struct memblock_region *r = NULL, *tmp; @@ -5492,8 +5492,6 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, continue; if (!early_pfn_in_nid(pfn, nid)) continue; - if (!update_defer_init(pgdat, pfn, end_pfn, &nr_initialised)) - break; #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP /* @@ -5516,6 +5514,8 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, } } #endif + if (defer_init(nid, pfn, end_pfn)) + break; not_early: page = pfn_to_page(pfn); From patchwork Tue Jul 24 23:55:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Tatashin X-Patchwork-Id: 10543339 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 EFCE714BC for ; Tue, 24 Jul 2018 23:55:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFF6929769 for ; Tue, 24 Jul 2018 23:55:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3058297F1; Tue, 24 Jul 2018 23:55:48 +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 4C3D829769 for ; Tue, 24 Jul 2018 23:55:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCAC56B0007; Tue, 24 Jul 2018 19:55:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C289A6B0008; Tue, 24 Jul 2018 19:55:45 -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 A52DA6B000A; Tue, 24 Jul 2018 19:55:45 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ua0-f197.google.com (mail-ua0-f197.google.com [209.85.217.197]) by kanga.kvack.org (Postfix) with ESMTP id 75E7F6B0007 for ; Tue, 24 Jul 2018 19:55:45 -0400 (EDT) Received: by mail-ua0-f197.google.com with SMTP id m10-v6so1840020uao.9 for ; Tue, 24 Jul 2018 16:55:45 -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 :in-reply-to:references; bh=I2FasBF0aIFRoHs4rlBGSdoIJv5z2OYszEDfER7UDpk=; b=CPbTLx4kNmxK9Kui0r2joG4jbmSjPh3zxQbkL73yUJn8MpTsyKyOuedWW5gYDe4CBR ENYHvwDP17jfpZdAitKjczfYEcoQ5ohHPKgK3W5PQnP8EG6ngWCGzI7HmKwDBXEtYzty I7NODdFsdswV2Jv17e29MsESQmRRqeijRI6E3wOAcErJRbUj3kso+jYM9TWMnBb6eYxO SNZzaTcb2Zbfu51aucq0HB9aJVPQH8Prm25JlXCpVRBQ2NK5eWeJFgL5GEtkKhZCTPCe D3H1R75MZMmkDp0sywybia0cf3avzrXeLMWT6hlzkivxzthkKWrakVFdk6eCDoUijqi/ uvBw== X-Gm-Message-State: AOUpUlGhz0sLWxDMfQA+DPHQOGqKNB5HhheYoEcwocp7uqYXFaCOJDgq FhgSjFHFGV8/VRdwnmTHG++6HgFZE/lC123e7y3yi66mxvAHpLFnALc024iFJ75X5i/4Hklvr4N jaKtBz+DMPn9CjlrCYKqRQ7VuI5pvRKXd5RqJ//OF2nInqZT2bkM/Lv5NU/ZO94MpCg== X-Received: by 2002:a9f:30c5:: with SMTP id k5-v6mr12970628uab.13.1532476545167; Tue, 24 Jul 2018 16:55:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdwh1V9w+Pdf/phoGQgRNA97eMYrRzoJZvwm941vBHB6mnSqWXGOGUbbCms0hblqjlUk4EE X-Received: by 2002:a9f:30c5:: with SMTP id k5-v6mr12970613uab.13.1532476544509; Tue, 24 Jul 2018 16:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532476544; cv=none; d=google.com; s=arc-20160816; b=d+DANWDwtffF0Id+ihhMkP/sViHMCWZaip2icD6gyMoWqsK2P+lICc+LHuqnuMOELU ad4TuNfCz1XhMqlUw9rWNw5t21DF1ViyWHuhqRwqg89o6wQEmdmX1qjN5gTdP6Q5AWVH dG1KC2T1W5qdPwOvrxOMYFBpABXvwrkZg01kDpGjYUOGYrTshdNejtCiwe3rKEnNz423 NiF+dIyG5u/Sfxl1bx19Goh8T9zGQryCyYgMcimXho686JY6SVB6I1HeD+v66W4Y9/Cl KL3eBiDHegVI2BDJWT/TKl/QRe9XnxnXf4gwAerNT+7/Fl4F+RVr73pX4mTyMoauuglj dSDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=I2FasBF0aIFRoHs4rlBGSdoIJv5z2OYszEDfER7UDpk=; b=Db4guqs312J5sV3BbWbzq50FU2bfXDsv3k+xR8Nrj3giEKXOnaHPgUC9NLocC3iZbU MBSE5sFE/CXjpFlvyjQ993i54OCjGkPbh3rtm0da6cGyfSCrm/5woYVWFPfrc5uSW2cB QcnQ3UHoGchsjgR95uQKlWiJc2xgeIGUfgTsnddMuD7twBv/FA842MbtyXOgMwXjbZ99 GargozOrRASwbbi212HFsk8/EjnSrecOedArMkQrY1UZ11SpRM4l3ZKuUsk+3RfyNjdN skUqj9esxI2OO0r6Afyg4LZAebRW+5b2456tROJ+AGkyqsgyBA9Y1Qm5ia8fy2+4jEzQ Mglg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=sY3stGZJ; 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 11-v6si6259254uaf.51.2018.07.24.16.55.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 16:55:44 -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=sY3stGZJ; 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 w6ONrqAj101316; Tue, 24 Jul 2018 23:55:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=I2FasBF0aIFRoHs4rlBGSdoIJv5z2OYszEDfER7UDpk=; b=sY3stGZJgwoP+W3pJRbD/NC+RoBKNS5IrCOjVIrYY/R5O9A+0tF43xoXv7tQ153cgchf P1Yz+SzQWVKpmFCDnGBxsCN/snGW4/rCkzNkJ1NT6JKbFOLFV8/+Gj7NBKr+QuFZVqrL kEVymq6LRn+jEOvo1Du0v9FJ4y2fEZ5Qd10uD5TJy/bFZNNO8t3DW6Xz3gaOmYWVfF2r bBO8Zvjyy4SZ0S1KgnVPEXXahKR22R3BAfTWcfufYETss6r8OQi2fTPRvnNQieVyji5/ vo+EreX3NGb3atY0LEHZkFYOxgaeWspsFToJSGPTIKqb+BLXlXjbaQizhpO8XiaBmJ1P sw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2kbv8t394f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Jul 2018 23:55:36 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w6ONtZvV003816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Jul 2018 23:55:35 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w6ONtVaQ019125; Tue, 24 Jul 2018 23:55:31 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 24 Jul 2018 16:55:31 -0700 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, dan.j.williams@intel.com, jack@suse.cz, jglisse@redhat.com, jrdr.linux@gmail.com, bhe@redhat.com, gregkh@linuxfoundation.org, vbabka@suse.cz, richard.weiyang@gmail.com, dave.hansen@intel.com, rientjes@google.com, mingo@kernel.org, osalvador@techadventures.net, pasha.tatashin@oracle.com, abdhalee@linux.vnet.ibm.com, mpe@ellerman.id.au Subject: [PATCH 3/3] mm: move mirrored memory specific code outside of memmap_init_zone Date: Tue, 24 Jul 2018 19:55:20 -0400 Message-Id: <20180724235520.10200-4-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180724235520.10200-1-pasha.tatashin@oracle.com> References: <20180724235520.10200-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8964 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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807240248 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 memmap_init_zone, is getting complex, because it is called from different contexts: hotplug, and during boot, and also because it must handle some architecture quirks. One of them is mirroed memory. Move the code that decides whether to skip mirrored memory outside of memmap_init_zone, into a separate function. Signed-off-by: Pavel Tatashin Reviewed-by: Oscar Salvador --- mm/page_alloc.c | 70 ++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 86c678cec6bd..d7dce4ccefd5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5454,6 +5454,29 @@ void __ref build_all_zonelists(pg_data_t *pgdat) #endif } +/* If zone is ZONE_MOVABLE but memory is mirrored, it is an overlapped init */ +static inline bool overlap_memmap_init(unsigned long zone, unsigned long *pfn) +{ +#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP + static struct memblock_region *r; + + if (mirrored_kernelcore && zone == ZONE_MOVABLE) { + if (!r || *pfn >= memblock_region_memory_end_pfn(r)) { + for_each_memblock(memory, r) { + if (*pfn < memblock_region_memory_end_pfn(r)) + break; + } + } + if (*pfn >= memblock_region_memory_base_pfn(r) && + memblock_is_mirror(r)) { + *pfn = memblock_region_memory_end_pfn(r); + return true; + } + } +#endif + return false; +} + /* * Initially all pages are reserved - free ones are freed * up by free_all_bootmem() once the early boot process is @@ -5463,12 +5486,8 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, unsigned long start_pfn, enum memmap_context context, struct vmem_altmap *altmap) { - unsigned long end_pfn = start_pfn + size; - unsigned long pfn; + unsigned long pfn, end_pfn = start_pfn + size; struct page *page; -#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP - struct memblock_region *r = NULL, *tmp; -#endif if (highest_memmap_pfn < end_pfn - 1) highest_memmap_pfn = end_pfn - 1; @@ -5485,39 +5504,17 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, * There can be holes in boot-time mem_map[]s handed to this * function. They do not exist on hotplugged memory. */ - if (context != MEMMAP_EARLY) - goto not_early; - - if (!early_pfn_valid(pfn)) - continue; - if (!early_pfn_in_nid(pfn, nid)) - continue; - -#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP - /* - * Check given memblock attribute by firmware which can affect - * kernel memory layout. If zone==ZONE_MOVABLE but memory is - * mirrored, it's an overlapped memmap init. skip it. - */ - if (mirrored_kernelcore && zone == ZONE_MOVABLE) { - if (!r || pfn >= memblock_region_memory_end_pfn(r)) { - for_each_memblock(memory, tmp) - if (pfn < memblock_region_memory_end_pfn(tmp)) - break; - r = tmp; - } - if (pfn >= memblock_region_memory_base_pfn(r) && - memblock_is_mirror(r)) { - /* already initialized as NORMAL */ - pfn = memblock_region_memory_end_pfn(r); + if (context == MEMMAP_EARLY) { + if (!early_pfn_valid(pfn)) continue; - } + if (!early_pfn_in_nid(pfn, nid)) + continue; + if (overlap_memmap_init(zone, &pfn)) + continue; + if (defer_init(nid, pfn, end_pfn)) + break; } -#endif - if (defer_init(nid, pfn, end_pfn)) - break; -not_early: page = pfn_to_page(pfn); __init_single_page(page, pfn, zone, nid); if (context == MEMMAP_HOTPLUG) @@ -5534,9 +5531,6 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, * can be created for invalid pages (for alignment) * check here not to call set_pageblock_migratetype() against * pfn out of zone. - * - * Please note that MEMMAP_HOTPLUG path doesn't clear memmap - * because this is done early in sparse_add_one_section */ if (!(pfn & (pageblock_nr_pages - 1))) { set_pageblock_migratetype(page, MIGRATE_MOVABLE);