Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp38054imm; Wed, 5 Sep 2018 14:31:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYcD0u0R4G0BkH3sH2joa+lq0zaq55iqqz4NHtIoRuN45+WM6h1xTtcE7n7Brl6JtvtEwo6 X-Received: by 2002:a62:b0b:: with SMTP id t11-v6mr38622133pfi.36.1536183082613; Wed, 05 Sep 2018 14:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536183082; cv=none; d=google.com; s=arc-20160816; b=mGRa4p9q6a5vrMZJc6ID20DdYouKHikF4JOvfJrnZ0LWGwahWHzZwPuO8MCvg/pcXP dD7ZEx2G61aSUCZSeN4v1Rr9zXme2EbIM9MEclzXvGDWVNZon8303tGRGy6gMKcFX1yR tvV3iMjWUf9t5RBceotMpCDcF/ejerPyUvltIrDbDxxJVra4CNF0Af9HEIEiLPiRM81s d3JFsK9Jtsd5IG5LCgGJjhOcFOp9sdRYdj+VBNE3mZA+1EPPv5OP589HTLZmMuNKC4Qn l+V/bUGAW08ZQ+rs1rPuqf44UC0qrMRnHymMs8tYnDnUkHL3QVTZC9FnwFaRRn2z+tqC Qj+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=1oCVsbnt5PJ+KLu9uNHWr1SKLcAwX8jQ0frrC3Rujwg=; b=TxLKXsZL5hIwiW63kUeSUtIEF+fSo69hZOSUjXrtCCeI0vbmuEyUiPo5UXMY45zbaH FWzbyMh6+huHuG39TX7z/kz3x07oohHxhRtAwvmaEEWcUBs8oNBQTfwtILnxH/ry76nd hjjouXW7OrI+LrFdRDPVpwaL5qxhKKD55OPeEb/thmTqZJScjZA8qTyeEpWf93AoHUYA oWgOpTI2w/4Jcv/skJBWwYcBZtpDloRN+hqjw0wvBm+VHmv0fCQyNxLxBLsWkyET7QFa RvmcO3BLHcUq3dL4nNzvHMOhT8f1wSE8rbbg8+2yK7nCAZYpp5gjJtsYonqVBKSB9sQk 3KFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ReC4XtLn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 66-v6si2998073plb.428.2018.09.05.14.31.06; Wed, 05 Sep 2018 14:31:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ReC4XtLn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727731AbeIFCBX (ORCPT + 99 others); Wed, 5 Sep 2018 22:01:23 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:41250 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727257AbeIFCBW (ORCPT ); Wed, 5 Sep 2018 22:01:22 -0400 Received: by mail-io0-f196.google.com with SMTP id q4-v6so7188214iob.8 for ; Wed, 05 Sep 2018 14:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1oCVsbnt5PJ+KLu9uNHWr1SKLcAwX8jQ0frrC3Rujwg=; b=ReC4XtLnqlPlncun+/yta4flx3VuLJ3whEXvUD+Vczm1rKpOsrlRkME1wxrMVB6jbm 1pD2zW+nE3QsnjbCt6ju5+1p+VdxheXhCBfeFVLN3xqecQ3cvvj7Xwo5GROisKfV0p1t m+YwG02WQu3jgcUVF4l6HNEE+b7CWDXF7KFKsE0qNAtVpuWD0PzNbdqGL/AboYYQXeR2 a70jTRhItzlycxa1mXW/1gdcgK1GBIyjiqi4nRh7xY0IAkVAZp8oczyoHiXV5XQmFY4x qhLAXdFZlLPAD8q6+J18q6KyMFP9e/fdAsXNKh4o3VCtmrRN7291i3+/X7dZuZ/5uM35 QDFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1oCVsbnt5PJ+KLu9uNHWr1SKLcAwX8jQ0frrC3Rujwg=; b=J2ABjKq0bN7CFvJ9dnRRqjTZXRGr/P4h/nxva+IhM9IdbxfL8PqBV4WExOXo4Rcxam +EEl36Xebcln8CCS4VNyiEflQJqCq0N0HrgJHXhO7WC0RVxUdEnE9YZMQQh/v4K0tBF1 g60CavlOjMiBYPhmaL4IvUDqil/yIw3IxojXChA0r6uw7Z/TVxv9vbO9ijA2KOYnSfay p06Xx/D9Y5Act9yjcyCYS3oCwb2fkzGYo88I+3Sn52ylw1qAMvTME+p/Q4nvWvLtdLMd 9H60f89P3W7Woy+x23wGt+py7/k03YOR2zYkkl5RJGiCSvIZRqf7vPTGBPvDz7Cj7qcP eAqg== X-Gm-Message-State: APzg51CQL41vXjvybS62glemRS7nuoOL/9UTSP/Z1RID3L+WceHHN39o NUvtyYFuR5o1sKnfNUyPTYkszHYI04JnxT6SZ14= X-Received: by 2002:a6b:5911:: with SMTP id n17-v6mr28108510iob.68.1536182959506; Wed, 05 Sep 2018 14:29:19 -0700 (PDT) MIME-Version: 1.0 References: <20180905211041.3286.19083.stgit@localhost.localdomain> <20180905211328.3286.71674.stgit@localhost.localdomain> In-Reply-To: From: Alexander Duyck Date: Wed, 5 Sep 2018 14:29:07 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] mm: Move page struct poisoning to CONFIG_DEBUG_VM_PAGE_INIT_POISON To: Pavel.Tatashin@microsoft.com Cc: linux-mm , LKML , "Duyck, Alexander H" , Michal Hocko , Dave Hansen , Andrew Morton , Ingo Molnar , "Kirill A. Shutemov" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 5, 2018 at 2:22 PM Pasha Tatashin wrote: > > > > On 9/5/18 5:13 PM, Alexander Duyck wrote: > > 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. > > > > Instead of keeping the value in CONFIG_DEBUG_VM I am adding a new CONFIG > > value called CONFIG_DEBUG_VM_PAGE_INIT_POISON that will control the page > > poisoning independent of the CONFIG_DEBUG_VM option. > > > > Signed-off-by: Alexander Duyck > > --- > > include/linux/page-flags.h | 8 ++++++++ > > lib/Kconfig.debug | 14 ++++++++++++++ > > mm/memblock.c | 5 ++--- > > mm/sparse.c | 4 +--- > > 4 files changed, 25 insertions(+), 6 deletions(-) > > > > diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h > > index 74bee8cecf4c..0e95ca63375a 100644 > > --- a/include/linux/page-flags.h > > +++ b/include/linux/page-flags.h > > @@ -13,6 +13,7 @@ > > #include > > #include > > #endif /* !__GENERATING_BOUNDS_H */ > > +#include > > > > /* > > * Various page->flags bits: > > @@ -162,6 +163,13 @@ static inline int PagePoisoned(const struct page *page) > > return page->flags == PAGE_POISON_PATTERN; > > } > > > > +static inline void page_init_poison(struct page *page, size_t size) > > +{ > > +#ifdef CONFIG_DEBUG_VM_PAGE_INIT_POISON > > + memset(page, PAGE_POISON_PATTERN, size); > > +#endif > > +} > > + > > /* > > * Page flags policies wrt compound pages > > * > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > > index 613316724c6a..3b1277c52fed 100644 > > --- a/lib/Kconfig.debug > > +++ b/lib/Kconfig.debug > > @@ -637,6 +637,20 @@ config DEBUG_VM_PGFLAGS > > > > If unsure, say N. > > > > +config DEBUG_VM_PAGE_INIT_POISON > > + bool "Enable early page metadata poisoning" > > + default y > > + depends on DEBUG_VM > > + help > > + Seed the page metadata with a poison pattern to improve the > > + likelihood of detecting attempts to access the page prior to > > + initialization by the memory subsystem. > > + > > + This initialization can result in a longer boot time for systems > > + with a large amount of memory. > > What happens when DEBUG_VM_PGFLAGS = y and > DEBUG_VM_PAGE_INIT_POISON = n ? > > We are testing for pattern that was not set? > > I think DEBUG_VM_PAGE_INIT_POISON must depend on DEBUG_VM_PGFLAGS instead. > > Looks good otherwise. > > Thank you, > Pavel The problem is that I then end up in the same situation I had in the last patch where you have to have DEBUG_VM_PGFLAGS on in order to do the seeding with poison. I can wrap the bit of code in PagePoisoned to just always return false if we didn't set the pattern. I figure there is value to be had for running DEBUG_VM_PGFLAGS regardless of the poison check, or DEBUG_VM_PAGE_INIT_POISON without the PGFLAGS check. That is why I wanted to leave them independent. - Alex