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=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 E51C5C43331 for ; Thu, 2 Apr 2020 11:36:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B0A1C206F8 for ; Thu, 2 Apr 2020 11:36:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0A1C206F8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5ADF38E0008; Thu, 2 Apr 2020 07:36:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55E108E0007; Thu, 2 Apr 2020 07:36:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 473928E0008; Thu, 2 Apr 2020 07:36:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0163.hostedemail.com [216.40.44.163]) by kanga.kvack.org (Postfix) with ESMTP id 2C97A8E0007 for ; Thu, 2 Apr 2020 07:36:41 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D8F54180AD804 for ; Thu, 2 Apr 2020 11:36:40 +0000 (UTC) X-FDA: 76662712560.03.sun12_3a46ab3d56558 X-HE-Tag: sun12_3a46ab3d56558 X-Filterd-Recvd-Size: 3858 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Apr 2020 11:36:40 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C93B3AAB8; Thu, 2 Apr 2020 11:36:37 +0000 (UTC) Subject: Re: [PATCH v2 1/2] mm: call touch_nmi_watchdog() on max order boundaries in deferred init To: Pavel Tatashin , 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, ktkhai@virtuozzo.com, david@redhat.com, jmorris@namei.org, sashal@kernel.org References: <20200401225723.14164-1-pasha.tatashin@soleen.com> <20200401225723.14164-2-pasha.tatashin@soleen.com> From: Vlastimil Babka Message-ID: <7af01656-e961-8c7b-42e5-432ec0d18d4b@suse.cz> Date: Thu, 2 Apr 2020 13:36:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200401225723.14164-2-pasha.tatashin@soleen.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: On 4/2/20 12:57 AM, Pavel Tatashin wrote: > 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 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) >