From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8187DC43331 for ; Fri, 3 Apr 2020 13:35:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F9E12078C for ; Fri, 3 Apr 2020 13:35:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="QbzBh9e+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F9E12078C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E3BC28E0009; Fri, 3 Apr 2020 09:35:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D76078E0007; Fri, 3 Apr 2020 09:35:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C662A8E0009; Fri, 3 Apr 2020 09:35:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0113.hostedemail.com [216.40.44.113]) by kanga.kvack.org (Postfix) with ESMTP id B012B8E0007 for ; Fri, 3 Apr 2020 09:35:55 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6A4055DE3 for ; Fri, 3 Apr 2020 13:35:55 +0000 (UTC) X-FDA: 76666641870.27.eye34_8afa511dd6163 X-HE-Tag: eye34_8afa511dd6163 X-Filterd-Recvd-Size: 5509 Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Apr 2020 13:35:54 +0000 (UTC) Received: by mail-qk1-f195.google.com with SMTP id v7so7961001qkc.0 for ; Fri, 03 Apr 2020 06:35:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=fGV3n8t+9BV7JTkRPUzZ2QXHvp25yaVJAKZtXq13X1k=; b=QbzBh9e+W+8iOpYg0+rGGGiU6KrpTT42G5riwwro+9vvy+mAOclzJDqQGKBZYWFEVK 0Y7WR7UKpFVgrB3UlLssjLQQzJS+DC8MZcX0LIiatPACJpJ/IqNvk+3mVyLsad+BkABl n4C0d9q5ZWEo6kYiRHX6nLpp3Z0zK5ruBmCa6xPv5CHirh0N7zn4YyotF0XL5gewijuw LjM2AbR6gi+RgiCqfmIKvxyZoUGjhmkxg2Lw5UqdtblJJiV4a0gcKOhwdmszBnSgL1sy n38Z1/glMlD6Q8ic0OU5MbyRrf5kzkmUZspLb4aGPEEhX/KArbhSuncZKrFdxWMofvj1 YXAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=fGV3n8t+9BV7JTkRPUzZ2QXHvp25yaVJAKZtXq13X1k=; b=QAUXozvi7mVeYVRmLw0kBVRDdhVWV4/UhM4Ptz9ozIKazLsas5NAOUKXjLSpjpgz0R UtPgqEpgTI5WetXigQh03jXNgX1NHhMKpjQim3qJkU6O0yOr/xa8T1GdWzGcebI/5Jf0 WLflJJyXECoGba2zWZms342v3+JCBPnG452dhg28a3UzVLh/N1hE3Rp34AlAx7rpsuCL wuExG+0AgHG6He+1f0N0XvtBIEw6CdwOcnb8QfR4PhcY9ZaVIJ5rVCFYMKxZzvCyLhiR 2/DZwBvge8B0Zvp3+/JP2T5mKmp1NPC1tCTMS2dHrAy5stZfN3Mmi6ugB1HJTcMeCq4T xsXw== X-Gm-Message-State: AGi0PubdOu2YQmRaX+1HhDJXTqQXXRQUY9cRlt8o2+yip3qrCgcXFLMP 2jag+yYVN0REn+Zbu1So4zDKuw== X-Google-Smtp-Source: APiQypJCvkMVix2XYKBYT3Rs1fxbKi+KbxCQXEGCj6HEdOr2BiuHAjnK+DDnF7WjEbM/Sl2K/RLu+Q== X-Received: by 2002:ae9:dd02:: with SMTP id r2mr8129764qkf.180.1585920953238; Fri, 03 Apr 2020 06:35:53 -0700 (PDT) Received: from localhost.localdomain (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id 17sm6210799qkm.105.2020.04.03.06.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 06:35:52 -0700 (PDT) From: Pavel Tatashin To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, mhocko@suse.com, linux-mm@kvack.org, dan.j.williams@intel.com, shile.zhang@linux.alibaba.com, daniel.m.jordan@oracle.com, pasha.tatashin@soleen.com, ktkhai@virtuozzo.com, david@redhat.com, jmorris@namei.org, sashal@kernel.org, vbabka@suse.cz Subject: [PATCH v3 1/3] mm: call touch_nmi_watchdog() on max order boundaries in deferred init Date: Fri, 3 Apr 2020 09:35:47 -0400 Message-Id: <20200403133549.14338-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200403133549.14338-1-pasha.tatashin@soleen.com> References: <20200403133549.14338-1-pasha.tatashin@soleen.com> 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: From: Daniel Jordan deferred_init_memmap() disables interrupts the entire time, so it calls touch_nmi_watchdog() periodically to avoid soft lockup splats. Soon it will run with interrupts enabled, at which point cond_resched() should be used instead. deferred_grow_zone() makes the same watchdog calls through code shared with deferred init but will continue to run with interrupts disabled, so it can't call cond_resched(). Pull the watchdog calls up to these two places to allow the first to be changed later, independently of the second. The frequency reduces from twice per pageblock (init and free) to once per max order block. Fixes: 3a2d7fa8a3d5 ("mm: disable interrupts while initializing deferred pages") Cc: stable@vger.kernel.org # 4.17+ Signed-off-by: Daniel Jordan Signed-off-by: Pavel Tatashin Reviewed-by: David Hildenbrand Acked-by: Michal Hocko Acked-by: Vlastimil Babka --- mm/page_alloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3c4eb750a199..e8ff6a176164 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1639,7 +1639,6 @@ static void __init deferred_free_pages(unsigned long pfn, } else if (!(pfn & nr_pgmask)) { deferred_free_range(pfn - nr_free, nr_free); nr_free = 1; - touch_nmi_watchdog(); } else { nr_free++; } @@ -1669,7 +1668,6 @@ static unsigned long __init deferred_init_pages(struct zone *zone, continue; } else if (!page || !(pfn & nr_pgmask)) { page = pfn_to_page(pfn); - touch_nmi_watchdog(); } else { page++; } @@ -1809,8 +1807,10 @@ static int __init deferred_init_memmap(void *data) * that we can avoid introducing any issues with the buddy * allocator. */ - while (spfn < epfn) + while (spfn < epfn) { nr_pages += deferred_init_maxorder(&i, zone, &spfn, &epfn); + touch_nmi_watchdog(); + } zone_empty: pgdat_resize_unlock(pgdat, &flags); @@ -1894,6 +1894,7 @@ deferred_grow_zone(struct zone *zone, unsigned int order) first_deferred_pfn = spfn; nr_pages += deferred_init_maxorder(&i, zone, &spfn, &epfn); + touch_nmi_watchdog(); /* We should only stop along section boundaries */ if ((first_deferred_pfn ^ spfn) < PAGES_PER_SECTION) -- 2.17.1