Received: by 10.213.65.68 with SMTP id h4csp564716imn; Tue, 13 Mar 2018 13:13:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELtQ1b8Irrbl38scNQNW6x0EXPerBxzSa2/S2XGswTlVu95qHY8cSIrl7L8apMfL2dboHXnU X-Received: by 2002:a17:902:848e:: with SMTP id c14-v6mr1680329plo.139.1520972021720; Tue, 13 Mar 2018 13:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520972021; cv=none; d=google.com; s=arc-20160816; b=sDhX4vrk0xwCOREmDGZorwDtI5Si4sfAyDyOREkSairjzvWKsx5N19syd4RNpzW6cm iJNVW8u298LwIAAf8dkZUW/z8+sopGoS6QZFk2JfAV6eH7A85HIblEiAyinoo+ZYB0t2 zF4dJSv96G72M700ch9AhgsDHXKW54ngeyLwHxYSSrn4SRSTumXf+fHPg/3m/bHkRa0j KAlXXsYTBUSdRMUsEmUXLL3fzldLvqZ1K0spN/2XkjVot1kpg+ihtw0AOZHZ9o/jWJ7g k2pTcuQR+Dnsg4sSxzJKh0AfvWAY0OErMYMkrSZd5qUpVexERwTVlBb8SEfW6b0W1+7P kJRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Nx6FhAPsVQXzQr5oz9lu0b3cGnLh8vv1ITitogbX70Y=; b=GA8XvEcKraXZhoSNY0Xg/I/IRBcy8JMuBeUHrMXqjDVUrZgkONb7zFeBjwDuQJNjxS gnRD2KOB3f9kWvvC1I5o2gyXeEaZpFPNFZbWeY+9EJJyPVGaebyD64x8MaTQtr4rJHX/ KoU56LZ3zoSf/SUB/anifqrJPyG1rIIf9yAQKTDJB8Z7cX/UlpZBDULX0ZvBOIlnuatB Y3DikJ2LeuzkIhPIWi4UDU8fhZENvWbOwOMauldmfzSYuFdJEzEMRladsdux7oDOuaz0 WAPx0XnvA9wv7lLYKGU6ucsu46JwwdGYDSbBfggmokIiXTJGHIXQsDl9n3HFRiRFbzcc 09gA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y4si612739pgr.152.2018.03.13.13.13.27; Tue, 13 Mar 2018 13:13:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932756AbeCMUMA (ORCPT + 99 others); Tue, 13 Mar 2018 16:12:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54146 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932303AbeCMUL6 (ORCPT ); Tue, 13 Mar 2018 16:11:58 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.71]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6D8B4EDA; Tue, 13 Mar 2018 20:11:57 +0000 (UTC) Date: Tue, 13 Mar 2018 13:11:56 -0700 From: Andrew Morton To: Pavel Tatashin Cc: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, m.mizuma@jp.fujitsu.com, mhocko@suse.com, catalin.marinas@arm.com, takahiro.akashi@linaro.org, gi-oh.kim@profitbricks.com, heiko.carstens@de.ibm.com, baiyaowei@cmss.chinamobile.com, richard.weiyang@gmail.com, paul.burton@mips.com, miles.chen@mediatek.com, vbabka@suse.cz, mgorman@suse.de, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [v5 1/2] mm: disable interrupts while initializing deferred pages Message-Id: <20180313131156.f156abe1822a79ec01c4800a@linux-foundation.org> In-Reply-To: <20180313194546.k62tni4g4gnds2nx@xakep.localdomain> References: <20180309220807.24961-1-pasha.tatashin@oracle.com> <20180309220807.24961-2-pasha.tatashin@oracle.com> <20180312130410.e2fce8e5e38bc2086c7fd924@linux-foundation.org> <20180313160430.hbjnyiazadt3jwa6@xakep.localdomain> <20180313115549.7badec1c6b85eb5a1cf21eb6@linux-foundation.org> <20180313194546.k62tni4g4gnds2nx@xakep.localdomain> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 13 Mar 2018 15:45:46 -0400 Pavel Tatashin wrote: > > > > > > We must remove cond_resched() because we can't sleep anymore. They were > > > added to fight NMI timeouts, so I will replace them with > > > touch_nmi_watchdog() in a follow-up fix. > > > > This makes no sense. Any code section where we can add cond_resched() > > was never subject to NMI timeouts because that code cannot be running with > > disabled interrupts. > > > > Hi Andrew, > > I was talking about this patch: > > 9b6e63cbf85b89b2dbffa4955dbf2df8250e5375 > mm, page_alloc: add scheduling point to memmap_init_zone > > Which adds cond_resched() to memmap_init_zone() to avoid NMI timeouts. > > memmap_init_zone() is used both, early in boot, when non-deferred struct > pages are initialized, but also may be used later, during memory hotplug. > > As I understand, the later case could cause the timeout on non-preemptible > kernels. > > My understanding, is that the same logic was used here when cond_resched()s > were added. > > Please correct me if I am wrong. Yes, the message is a bit confusing and the terminology is perhaps vague. And it's been a while since I played with this stuff, so from (dated) memory: Soft lockup: kernel has run for too long without rescheduling Hard lockup: kernel has run for too long with interrupts disabled Both of these are detected by the NMI watchdog handler. 9b6e63cbf85b89b2d fixes a soft lockup by adding a manual rescheduling point. Replacing that with touch_nmi_watchdog() won't work (I think). Presumably calling touch_softlockup_watchdog() will "work", in that it suppresses the warning. But it won't fix the thing which the warning is actually warning about: starvation of the CPU scheduler. That's what the cond_resched() does. I'm not sure what to suggest, really. Your changelog isn't the best: "Vlastimil Babka reported about a window issue during which when deferred pages are initialized, and the current version of on-demand initialization is finished, allocations may fail". Well... where is ths mysterious window? Without such detail it's hard for others to suggest alternative approaches.