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.8 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,URIBL_BLOCKED,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 57B5EC2D0F3 for ; Wed, 1 Apr 2020 22:57:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1BA6220CC7 for ; Wed, 1 Apr 2020 22:57:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="UHs9U9k2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BA6220CC7 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 C06F28E0008; Wed, 1 Apr 2020 18:57:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B42AE8E0006; Wed, 1 Apr 2020 18:57:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A07CF8E0008; Wed, 1 Apr 2020 18:57:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0214.hostedemail.com [216.40.44.214]) by kanga.kvack.org (Postfix) with ESMTP id 8B1478E0006 for ; Wed, 1 Apr 2020 18:57:28 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 500DA180AD80F for ; Wed, 1 Apr 2020 22:57:28 +0000 (UTC) X-FDA: 76660799376.15.story61_7b64b6064c237 X-HE-Tag: story61_7b64b6064c237 X-Filterd-Recvd-Size: 5368 Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Wed, 1 Apr 2020 22:57:27 +0000 (UTC) Received: by mail-qt1-f196.google.com with SMTP id c14so1776635qtp.0 for ; Wed, 01 Apr 2020 15:57:27 -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=MMaS53tZSqIL6YJ5x3w2mn/RHgoZkNbuAWUFVsV9ivc=; b=UHs9U9k2C1EhgFWvZnAXmT/6XD+OerUrLb5FiM1wNa/UCKga3AAUhi9x1/VnDFAV4B r5JqmQf05kfBF9QLq+tSkJ0jIOaYLt5o3YXXR0ifO2n2eY5IYLcK6QU11SF0wmGbAj64 nOlQGBO7gFdK42Sn1bN3iCyFgLb2ZdHiw4qu2dtIAtVyU50Prmi4dSSmH6+bXqqM8VkA DFR5l2B3Ad2mBVuYg6PquH1tM+Ae+pPnb4ZnMDEV0XrRq7+jaZJrk5fSRnO4dozaxqGH 4K7AxIJyPSNPuxIeEHGYOuIAuy+M5s8xLxYn5twwhxg5mUTQ7yEIeMp0OlTiNCRd3HW5 7VSA== 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=MMaS53tZSqIL6YJ5x3w2mn/RHgoZkNbuAWUFVsV9ivc=; b=HsvPluxeYrxmLfvoxNq4zoep5gRAjakth6uZ5r0gV8xUGNX7LtyvUK6uVeIttPEDUG FYJKOGf6jhMBtgkYdJO7JXzIPnpYNwGZd7AfyHqewFm/GmPzZ6/w+so79gA+VgOkj6kL IhxGP40SzXEcUQToTWgB5fv1Ta8jE4Om8ypzW6qMwD49K4o70SrpFY0hdPptEAedni9d IKZgsgSobBipeWbzSV7BpKHUELhCxPBkmCZ9XLggGcSDT+uqbY2ZRhw1NB9eHT/ldwZf s6DkFvSDxxia9vaLwDl3devpsVCp2NOqAn+ZlTmSvL1oAETMrPZJG+aQ0PM4O/mFmmxc fP2w== X-Gm-Message-State: AGi0PuYDElL9n8/YsVxvZKzOkEcHYypRA0Twb465W8zJSiJL7nrje3qm 6Rt4vyX65hIEZr4SOOCF1y65LQ== X-Google-Smtp-Source: APiQypKzSmKhyZAAE+IZSAM9mZJiLkxUuegftj7pW3YTBQoFXC2ggBROM/k/MPzthL+gvel4PnjukA== X-Received: by 2002:aed:2c06:: with SMTP id f6mr72178qtd.337.1585781847280; Wed, 01 Apr 2020 15:57:27 -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 q5sm2402635qkq.17.2020.04.01.15.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 15:57:26 -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 v2 1/2] mm: call touch_nmi_watchdog() on max order boundaries in deferred init Date: Wed, 1 Apr 2020 18:57:22 -0400 Message-Id: <20200401225723.14164-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200401225723.14164-1-pasha.tatashin@soleen.com> References: <20200401225723.14164-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 --- 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