From patchwork Tue Sep 4 18:33:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 10587763 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 AE16C180E for ; Tue, 4 Sep 2018 18:33:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99ABF29CAB for ; Tue, 4 Sep 2018 18:33:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DA6929F9F; Tue, 4 Sep 2018 18:33: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,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 285BB29CAB for ; Tue, 4 Sep 2018 18:33:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A80D66B6EE9; Tue, 4 Sep 2018 14:33:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A2F0E6B6EEA; Tue, 4 Sep 2018 14:33:42 -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 8FAE76B6EEB; Tue, 4 Sep 2018 14:33:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id 4E1836B6EE9 for ; Tue, 4 Sep 2018 14:33:42 -0400 (EDT) Received: by mail-pg1-f198.google.com with SMTP id m4-v6so2179323pgq.19 for ; Tue, 04 Sep 2018 11:33: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:subject:from:to:cc:date :message-id:in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=7/Q/tCQaxlLXUL3Xmqx/qU3OL5OX2wiOS9IyzmP03tA=; b=qtwSOk3ljv9aDlQyCijgIw9qiuqZJfo4mV4G/qjKTZtXJyl+oHJIrCJV/keiLbAHeR hFmp93gHaSTQxL1nhky0fZPkdsHS5DZ2V/jnHYz/fqb/vIEo385SBYE42HpGJ3pl+40v qlDkAesafX/1S5F6ER8j5G16ff9LzDijWwcuvG4eJ72c/gmx9TS3d+gLL32U8mZkZt7v K+amg3/+EimLbILgPnmRmfq9hITM5gZIR5sWvwCRnPK6bIBt9Ws3ubKyAuxVDd6+nMTC 7o5lUAY0lbl1gJxOlmVVshd84yjvHdyTMxglRg4DrtYLTm/yGGlewY55zmC1MG9hnRpT 33wg== X-Gm-Message-State: APzg51D8ISZ8KvLOjdeJvvU1o4egWQDGyzSqgKenFRcjzT/0KHUiuOeV MC7bjP9ge7BbY4tEIW7d/tWMLOkTjym1yqOBTn5bJQXADDvZfM7vVPjABgKddKDuBvmDsHchI5P NMoD9mBNutsTWH9ymOla+9h/6xpxr6JMhsIWe2v4+NJPOPTLWr3klVIMh0+WBHOvcv7w2rmQWLP bMS0iCx7w0Sbl43WTnlC04QgWV4wHmNRBCbEdBQKiOTcASMZ+RGXHUWY6BD/MFDbN8kkEPA8uSF gOac/bgE0QQvdhTpKkiQSuVNl5BtcCHN03NkM4OnJJpM567D3ANWCpf7kSdH3CYxTELxMKu4gkG gIavJI8Jwdrd8baHZYWI5BcRMmwnhIdeETDUoTLM17zTtkZtlFIZwwYx6lN0KwsFX9uRop+YJC5 t X-Received: by 2002:a17:902:b40e:: with SMTP id x14-v6mr34274167plr.314.1536086021938; Tue, 04 Sep 2018 11:33:41 -0700 (PDT) X-Received: by 2002:a17:902:b40e:: with SMTP id x14-v6mr34274129plr.314.1536086021176; Tue, 04 Sep 2018 11:33:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536086021; cv=none; d=google.com; s=arc-20160816; b=EDcmu9yPMZvJJfPt0fSh7QvcznGRXZn5GZPYKfzYlZ3wUqtPnELkMSKZ1/S6w4/0c0 UH+XvvuNJNBa+aLuXHrsLoIk0Silj6oHnjAwBeOKNO/tkBzeasvVJO3yPLrjjMlFdtem HX1Ac8DwNldqb17nq0wYJ1N5/R63eMS1CTMXcXptdX6huLC1fMa5t2qR4gO2fO9DU+55 2yEMF3D2oFJntH4u634XGcB6EJFl9GPPX3sGUekQ5QiF+tXjfbV0MOvSx8l2NWM8AIpF sQv3Je1NM/JQKBp914apAC8jy1ypRfNTg9cgleO949W2BVtgxFhFaEivs2MsHExxIRWX 6rzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=7/Q/tCQaxlLXUL3Xmqx/qU3OL5OX2wiOS9IyzmP03tA=; b=QvcpdeFwxh1k5cG9ZptkunwMtq+tajwp/ejqGYEJyQzDvgFTVPTusyZovbNsPupQjl Egb+VDro8ZvJYkim5N3PLv8MyHcq8z62phxPLbCdkEmHOsPl3zTJusuQ/liLXZteLEG4 4yTzI5Y9JW0cyAsiYeVS6c336M/T0uDIgas7y3kDhhyOoivJm4GXh+XMpRRY1gQaGitK GH3yGtj8hUBEa6y8qH/pmOkA8MDuyDbhBhrdfbiYCFCCC5hZ/tQg9v1kuYXN2MlSGcbO PeetOvRVmALupfHiwD/RJ0HvjQsjPaJYeOl4RVDyQXOand1wFtuTDV0YHuHWKOQxyCJG rlKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jOQpoiPD; spf=pass (google.com: domain of alexander.duyck@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=alexander.duyck@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 n12-v6sor4912420pgi.23.2018.09.04.11.33.41 for (Google Transport Security); Tue, 04 Sep 2018 11:33:41 -0700 (PDT) Received-SPF: pass (google.com: domain of alexander.duyck@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=jOQpoiPD; spf=pass (google.com: domain of alexander.duyck@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=alexander.duyck@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=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=7/Q/tCQaxlLXUL3Xmqx/qU3OL5OX2wiOS9IyzmP03tA=; b=jOQpoiPDG4SvQHXP8LLlZHZeGYRHGM2MsBuv0n0TCbER6H83Krkgwr8drpJZrEhc3b 6Rx8tQXa5gfI140Cfiii4NXbRFiiBUTTJkd6MlIFntd0jGtF8djEkWBCAsYZKyWaj9++ PKe4tSpmKGkhS8gk67g9IIwzNeBAmdOuQm5kx3IsWl/CCJz1Se/8y3NhA7X5cTjhNcee SG+xAB5yWqQ+8rrcS8TsTJ2VnN7nOFHd5VI6fJ8ZDMbgwQTU39IM6kdParpSeb5fbtMB viiLnjUXOTrf87GS4YEDL6x1OwImV0RxjdVj1nYy6n+LqQ0FjXofb7+fF/xIg2TLFTxi pGTw== X-Google-Smtp-Source: ANB0Vdayyfl3UWUjB9FQOhU7rc2IOohhTAuqudybck0+I6u3MF1JCokc/aNMpqcDQnRrySaEg0xlAQ== X-Received: by 2002:a65:6499:: with SMTP id e25-v6mr31199322pgv.224.1536086020768; Tue, 04 Sep 2018 11:33:40 -0700 (PDT) Received: from localhost.localdomain (static-50-53-21-37.bvtn.or.frontiernet.net. [50.53.21.37]) by smtp.gmail.com with ESMTPSA id l85-v6sm36666855pfk.34.2018.09.04.11.33.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 11:33:40 -0700 (PDT) Subject: [PATCH 1/2] mm: Move page struct poisoning from CONFIG_DEBUG_VM to CONFIG_DEBUG_VM_PGFLAGS From: Alexander Duyck To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: alexander.h.duyck@intel.com, pavel.tatashin@microsoft.com, mhocko@suse.com, akpm@linux-foundation.org, mingo@kernel.org, kirill.shutemov@linux.intel.com Date: Tue, 04 Sep 2018 11:33:39 -0700 Message-ID: <20180904183339.4416.44582.stgit@localhost.localdomain> In-Reply-To: <20180904181550.4416.50701.stgit@localhost.localdomain> References: <20180904181550.4416.50701.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 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 From: Alexander Duyck On systems with a large amount of memory it can take a significant amount of time to initialize all of the page structs with the PAGE_POISON_PATTERN value. I have seen it take over 2 minutes to initialize a system with over 12GB of RAM. In order to work around the issue I had to disable CONFIG_DEBUG_VM and then the boot time returned to something much more reasonable as the arch_add_memory call completed in milliseconds versus seconds. However in doing that I had to disable all of the other VM debugging on the system. I did a bit of research and it seems like the only function that checks for this poison value is the PagePoisoned function, and it is only called in two spots. One is the PF_POISONED_CHECK macro that is only in use when CONFIG_DEBUG_VM_PGFLAGS is defined, and the other is as a part of the __dump_page function which is using the check to prevent a recursive failure in the event of discovering a poisoned page. With this being the case I am opting to move the poisoning of the page structs from CONFIG_DEBUG_VM to CONFIG_DEBUG_VM_PGFLAGS so that we are only performing the memset if it will be used to test for failures. Signed-off-by: Alexander Duyck --- mm/memblock.c | 2 +- mm/sparse.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index 237944479d25..51e8ae927257 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1444,7 +1444,7 @@ void * __init memblock_virt_alloc_try_nid_raw( ptr = memblock_virt_alloc_internal(size, align, min_addr, max_addr, nid); -#ifdef CONFIG_DEBUG_VM +#ifdef CONFIG_DEBUG_VM_PGFLAGS if (ptr && size > 0) memset(ptr, PAGE_POISON_PATTERN, size); #endif diff --git a/mm/sparse.c b/mm/sparse.c index 10b07eea9a6e..0fd9ad5021b0 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -696,7 +696,7 @@ int __meminit sparse_add_one_section(struct pglist_data *pgdat, goto out; } -#ifdef CONFIG_DEBUG_VM +#ifdef CONFIG_DEBUG_VM_PGFLAGS /* * Poison uninitialized struct pages in order to catch invalid flags * combinations. From patchwork Tue Sep 4 18:33:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 10587765 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 3E870920 for ; Tue, 4 Sep 2018 18:33:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2890129CAB for ; Tue, 4 Sep 2018 18:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C5DD29F9F; Tue, 4 Sep 2018 18:33:50 +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 A463029CAB for ; Tue, 4 Sep 2018 18:33:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80D2A6B6EEC; Tue, 4 Sep 2018 14:33:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7E2FD6B6EED; Tue, 4 Sep 2018 14:33:48 -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 6D3706B6EEE; Tue, 4 Sep 2018 14:33:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 303B56B6EEC for ; Tue, 4 Sep 2018 14:33:48 -0400 (EDT) Received: by mail-pf1-f197.google.com with SMTP id j15-v6so2385010pff.12 for ; Tue, 04 Sep 2018 11:33:48 -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:subject:from:to:cc:date :message-id:in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=MdQ8PvK3fEzAtZADK3vfNmYziizL51ukKvOGILhXgkQ=; b=J24v41mJ4FOtJxOB7uWev9BUk9KfBzQo0Jgw8/nL6Wlg8TZtMx3XwjY5zR3TeQMpX/ 43DoaeDL0QY2rDm6Pr1xdDS3PRSk8SqdTf7bImNhh/9nhZjKf/m6NKgmmSt2BIMUc3N1 ovjHqsq9rddnPjikDUSfsiUBj+pXmZyNptcBDCADVGBg/uTVHrfYsUvqL+HU1BR2zGXG z5xISOGue8H6ot2Jo7qFz8Qqs6c54HLzARAs/WlOEag1MUhUOIoeYNe3qbg3PW+PLgv/ YEKnlnzQLYyhpQqGi3lMjj/x3crwwszvz3RVi3wLmCTKb0AKhL4Ukpx2yZmTo72cw2+9 Hb3A== X-Gm-Message-State: APzg51BonFU+nkCPBJaufx9fUsbjqut9DBhVdX3q5ce+kDuAC81nlfvc qVu9Pp97eWXMF5piywIQlj4WNhEU3outCVWxdWDZ5LmGu1JXM/wwuwMWs9tbp+0p5GFAVaTmc5s KYJf7IgD9knC5Fva3MgJnx7N0I4T4RpcfaDN9ktIWYEgY5DhB+WBor7FoGNDxCk+8zlvMuhpZYj Grw71BPGjA/qxIJeVh8FlWeuFxhnQ1Cuy/wG6Oo2J8A2KXIemvWMiBlMbxG9MNDsKxRZlFHU/83 v6zXDGpnO0lJpwUMYd4YCOyNsXMvyliWHm+dlRqgG7DFx+6gavvI8kpKxj6xaQwieJbFCw96X3t q8kIU51b7C9qeY4mew3V84zua46m/WwyvAanRC73+d4h/wKKPJXCuPPUr6/QtO0rirjt47lRg45 S X-Received: by 2002:a63:77ce:: with SMTP id s197-v6mr32997896pgc.172.1536086027880; Tue, 04 Sep 2018 11:33:47 -0700 (PDT) X-Received: by 2002:a63:77ce:: with SMTP id s197-v6mr32997860pgc.172.1536086027103; Tue, 04 Sep 2018 11:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536086027; cv=none; d=google.com; s=arc-20160816; b=uNfCiOehzzRmYknAQf8H1JrL/hYOHKOtj247NCmB1As8D+bkYIgZjmkuId2ojfo0BK SnWSLSjohaXGAoAQ7BZkQAuEype6M9Bi3IgCjPI5+YBZHvp4rxrlK5m32xGvXRGNAEsG c2odRveVTLAZCy7GyVmNccwp7EOPt01P58c7IO9xnjMTuxWBmVL52PjBRYBURWwiTsEU hGH41HwKowpJ0X93fvAeZWJf1PexGrpqTBBBq5dsQ5tN+ZOg3PZb+7S+vU4gEuJEl+1j XMtdRlW9CZ1zn2eJqwjYmC1GM99LL5tQSqgbJV3cFhjVKdmpymyie+NYOFK3QLVEC2M2 LCoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=MdQ8PvK3fEzAtZADK3vfNmYziizL51ukKvOGILhXgkQ=; b=y8tdimRt/alMuttStqjJWJzyNnK33BoWApyzvtWzqsl9+7BDpuEJr/cUMjYu3PWRv5 yBSezEOuCSX9RPoqsgtw2+FKAzov/zPcUBGGvpPx3ukkQ8aWw6eo05EwdagSXpjt9ROI +H/mA/ACq+tD1yecUF2TCE6ENYS/Wn6gwugSyWzRIgzTtp9L+Xppf2Is62PX09N5Q1D8 kHuHvIBZ92OAG+PjZCXFSnpZjld0vuSZGy+jZxrSW3QlOM5EEgXqF0QSvncLZk4aKB+d pFH+LglEngmCdDIsY4rToCWLDyjl9XEV4whG/j0XYpNz2MkvkRA8+lW1GRFfPm/OCTyM jHLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vAymjcbr; spf=pass (google.com: domain of alexander.duyck@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=alexander.duyck@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 s14-v6sor4961050pgh.317.2018.09.04.11.33.47 for (Google Transport Security); Tue, 04 Sep 2018 11:33:47 -0700 (PDT) Received-SPF: pass (google.com: domain of alexander.duyck@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=vAymjcbr; spf=pass (google.com: domain of alexander.duyck@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=alexander.duyck@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=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=MdQ8PvK3fEzAtZADK3vfNmYziizL51ukKvOGILhXgkQ=; b=vAymjcbry74LyDWWHChMOMli0JaF9Rn1u9+l/ZJehXD6D1Ov2IWrReo5sVaZSuMBHx uRql+te+bsLLUaVXxUaUT45NJ3XZvFwmEhHHVGRyVTVdh8yrJhzP53urc2lHn1CrYeUd u5VR4nXMOycYVJM4T4oXYW9N2MyZltBXQrShL8oqAp0G2jR0rJn0vZxkFziLQpjxlSLF MaJBw0jbGi4CMUv8DNpAWt+k/9UuQHYyFFdXBYQKLLSBVtEdAW97Z8GxdR/SB0YRhQU8 HxTPetcm2cQ4HB7iLcXPmyP1IfiaDHd8BfV34mbRp6YYlAXIYVSOjeu+1XB9ETZJWwwN d/wg== X-Google-Smtp-Source: ANB0Vdb3Q48obLzoVJB5Ry2gw1LRc+dCnMA7DUTg3dsOdugcCA0UW9ef986wZqHTXpDLKdMb0XpMMQ== X-Received: by 2002:a62:9349:: with SMTP id b70-v6mr36589325pfe.193.1536086026730; Tue, 04 Sep 2018 11:33:46 -0700 (PDT) Received: from localhost.localdomain (static-50-53-21-37.bvtn.or.frontiernet.net. [50.53.21.37]) by smtp.gmail.com with ESMTPSA id n83-v6sm38725497pfk.19.2018.09.04.11.33.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 11:33:46 -0700 (PDT) Subject: [PATCH 2/2] mm: Create non-atomic version of SetPageReserved for init use From: Alexander Duyck To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: alexander.h.duyck@intel.com, pavel.tatashin@microsoft.com, mhocko@suse.com, akpm@linux-foundation.org, mingo@kernel.org, kirill.shutemov@linux.intel.com Date: Tue, 04 Sep 2018 11:33:45 -0700 Message-ID: <20180904183345.4416.76515.stgit@localhost.localdomain> In-Reply-To: <20180904181550.4416.50701.stgit@localhost.localdomain> References: <20180904181550.4416.50701.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 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 From: Alexander Duyck It doesn't make much sense to use the atomic SetPageReserved at init time when we are using memset to clear the memory and manipulating the page flags via simple "&=" and "|=" operations in __init_single_page. This patch adds a non-atomic version __SetPageReserved that can be used during page init and shows about a 10% improvement in initialization times on the systems I have available for testing. Signed-off-by: Alexander Duyck Acked-by: Michal Hocko --- include/linux/page-flags.h | 1 + mm/page_alloc.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 74bee8cecf4c..57ec3fef7e9f 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -292,6 +292,7 @@ static inline int PagePoisoned(const struct page *page) PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND) __CLEARPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND) + __SETPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND) PAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL) __CLEARPAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL) __SETPAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 05e983f42316..9c7d6e971630 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1231,7 +1231,7 @@ void __meminit reserve_bootmem_region(phys_addr_t start, phys_addr_t end) /* Avoid false-positive PageTail() */ INIT_LIST_HEAD(&page->lru); - SetPageReserved(page); + __SetPageReserved(page); } } } @@ -5518,7 +5518,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, page = pfn_to_page(pfn); __init_single_page(page, pfn, zone, nid); if (context == MEMMAP_HOTPLUG) - SetPageReserved(page); + __SetPageReserved(page); /* * Mark the block movable so that blocks are reserved for