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.