From patchwork Fri Apr 3 14:09:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 11472917 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7C6481 for ; Fri, 3 Apr 2020 14:09:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 72819206E9 for ; Fri, 3 Apr 2020 14:09:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="HpXovz4Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72819206E9 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 AEDF68E000A; Fri, 3 Apr 2020 10:09:57 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A02AA8E0007; Fri, 3 Apr 2020 10:09:57 -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 8C8C98E000A; Fri, 3 Apr 2020 10:09:57 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 7A7D98E0007 for ; Fri, 3 Apr 2020 10:09:57 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2B740180AD815 for ; Fri, 3 Apr 2020 14:09:57 +0000 (UTC) X-FDA: 76666727634.01.pan85_910f72c1f415c X-Spam-Summary: 2,0,0,c7b1e230f0a56685,d41d8cd98f00b204,pasha.tatashin@soleen.com,,RULES_HIT:41:355:379:421:541:560:800:960:966:973:988:989:1260:1345:1359:1381:1437:1535:1542:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2693:2731:2898:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3872:3874:4321:4385:5007:6117:6119:6261:6653:6737:7576:8660:9038:10004:11026:11473:11658:11914:12048:12114:12294:12297:12438:12517:12519:12555:12679:12895:12986:13148:13230:13255:14093:14096:14181:14394:14721:21080:21094:21212:21323:21444:21451:21627:21966:30012:30054:30064:30070,0,RBL:209.85.222.194:@soleen.com:.lbl8.mailshell.net-66.100.201.201 62.2.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: pan85_910f72c1f415c X-Filterd-Recvd-Size: 5512 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Apr 2020 14:09:56 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id v7so8089390qkc.0 for ; Fri, 03 Apr 2020 07:09:56 -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=W9m99TDQLeV99+GCRdJBO+aIjPkNrUp3PY68/9xSZMw=; b=HpXovz4ZsBVfNcJM8Huhy4y+11+eUDOZ9KZA1gVuKjNX+47IkisawrgYg0JZq62uNc HoPclkVx0CGpDY+dYSju9U5SRJeJDGjLF4whCljM0I8a0oAZyzjp5/KlakMZeYTsHYrW eGK9htc5d5zU8rI13VPh+oCtFxNlfbEjr0ooCeYmstD10MtQ9dz4LT2lc/O9rH+Y+hf5 mxwNnZy2ITWY+AuunJn+bt0q2HJJFy2e5QgIOgwrMSzpjcyz2HnLIVDxCGBFjDYFDCYg MVXE6SwTnxFK853qKheN4CpGJHjjRqMQI+D6ammU+nAf3Y2Ooor+il0aYLsMTmft7/TX ZjkQ== 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=W9m99TDQLeV99+GCRdJBO+aIjPkNrUp3PY68/9xSZMw=; b=e+xT/zXgh9/w8Lr+0BHAO0OVDHFtXjd0Yl8B06LLyPyy7G3UTYkSZEvdbiS8howEPF oGgHBEPhhQ7lKpgQTBlnuKJm3G3l9incd/BKi5FBG2o3senjEkSXTIwbepg6DnhhG3ms fXnF71A35BbH3JE5dgox2uBLyJKcyHI0l3Y7j+xmrBAQtFNulsn3onM+Oe7eZnkOYIjr 9H9EqmipVD1tifELqvb2IqBMhBmgt85FEu1N8ClkGwH10nbj3PFBlf3zHXrSe0hXDEK4 BBFm7coSvYuLckchVnJ58KYmSmTWxjR7V0caDD/0T74zj9B/zwvndzYVAwrqR89KjHHi EVbw== X-Gm-Message-State: AGi0PubCrCrVsmMzDSmrI6HMTzJC1olzUfwB5SG/iJ1IgCkKQl0EDMSw F9b8xtUZPrmpY7ere7kS6YTZW8ybIMI= X-Google-Smtp-Source: APiQypLUS0gnfceDdAcOKLZDc0EqhYDRYzr6A+EIIDB2Vk60l0JH0T9kkeyznkI3MNOTkuodsi/zBQ== X-Received: by 2002:a37:4fc5:: with SMTP id d188mr8488831qkb.220.1585922996152; Fri, 03 Apr 2020 07:09:56 -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 s56sm6917392qtk.9.2020.04.03.07.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 07:09:55 -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 v4 1/3] mm: call touch_nmi_watchdog() on max order boundaries in deferred init Date: Fri, 3 Apr 2020 10:09:50 -0400 Message-Id: <20200403140952.17177-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200403140952.17177-1-pasha.tatashin@soleen.com> References: <20200403140952.17177-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 e5f76da8cd4e..d95bfd328107 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1633,7 +1633,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++; } @@ -1663,7 +1662,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++; } @@ -1803,8 +1801,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); @@ -1888,6 +1888,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)