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=-4.0 required=3.0 tests=MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no 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 10FE1C2BA12 for ; Thu, 2 Apr 2020 07:34:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D484B2064A for ; Thu, 2 Apr 2020 07:34:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D484B2064A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 505378E0008; Thu, 2 Apr 2020 03:34:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B5E48E0007; Thu, 2 Apr 2020 03:34:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37D9D8E0008; Thu, 2 Apr 2020 03:34:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id 207B78E0007 for ; Thu, 2 Apr 2020 03:34:14 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D4232181AEF09 for ; Thu, 2 Apr 2020 07:34:13 +0000 (UTC) X-FDA: 76662101586.15.pump36_7c38cc6b27c1f X-HE-Tag: pump36_7c38cc6b27c1f X-Filterd-Recvd-Size: 5149 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Apr 2020 07:34:13 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id a25so2968124wrd.0 for ; Thu, 02 Apr 2020 00:34:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=epdqCPxnoC+zcq08DlC7aOQBj0oB2B3DQy9u2NkQk+U=; b=srbWD7jat6gBHHfHdxbgnWrW4vVQGNnm1OW4LITDEbFeJPwbDckezIzHEKtKrO/IU3 XO7iSpCy5eE/3exo4OyRhbZyr4ZsMMhw4WKMOfXcctH2br+/JZjK43TOmxiO81oqib/F Ry9HK7zCe8sSbPP70xGtKd9UJTouceFwjrCF7zXsBDilcxTVbicBc1MVG3EE0KBrKRCC rJsBZsoI+odCbhMn+S7JcGWDl5P8v/2YplhuesB/zvEjP9iak8X46kLLAww8aBzxBiI6 SVfsy5uFLyenKU9G5oX9aBejGwiP4scEgjBa/hWKNFFx5dCvoyNGfNN4IXyzzGNfW6vN oFsA== X-Gm-Message-State: AGi0Pub17SbsXnvgjBwXWLM2oGHA8i8FUTg+Ozif+1pbmYhCH4zPzRtP WOaP0uR2MJxOKIbhM5TggEE= X-Google-Smtp-Source: APiQypK3ZFbdRdx2Cy++KiBT48fpK60xOXPMXBHmur7Ae9nQHnt4p5Qkh5mD5rZLlsdtoU+53/ipNQ== X-Received: by 2002:adf:8164:: with SMTP id 91mr2001835wrm.422.1585812852386; Thu, 02 Apr 2020 00:34:12 -0700 (PDT) Received: from localhost (ip-37-188-180-223.eurotel.cz. [37.188.180.223]) by smtp.gmail.com with ESMTPSA id 9sm5760238wmm.6.2020.04.02.00.34.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 00:34:11 -0700 (PDT) Date: Thu, 2 Apr 2020 09:34:10 +0200 From: Michal Hocko To: Pavel Tatashin Cc: LKML , Andrew Morton , linux-mm , Dan Williams , Shile Zhang , Daniel Jordan , Kirill Tkhai , David Hildenbrand , James Morris , Sasha Levin Subject: Re: [PATCH] mm: initialize deferred pages with interrupts enabled Message-ID: <20200402073410.GF22681@dhcp22.suse.cz> References: <20200401193238.22544-1-pasha.tatashin@soleen.com> <20200401195721.GZ22681@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed 01-04-20 16:27:33, Pavel Tatashin wrote: > On Wed, Apr 1, 2020 at 3:57 PM Michal Hocko wrote: > > > > On Wed 01-04-20 15:32:38, Pavel Tatashin wrote: > > > Initializing struct pages is a long task and keeping interrupts disabled > > > for the duration of this operation introduces a number of problems. > > > > > > 1. jiffies are not updated for long period of time, and thus incorrect time > > > is reported. See proposed solution and discussion here: > > > lkml/20200311123848.118638-1-shile.zhang@linux.alibaba.com > > > > http://lkml.kernel.org/r/20200311123848.118638-1-shile.zhang@linux.alibaba.com > > > > > 2. It prevents farther improving deferred page initialization by allowing > > > inter-node multi-threading. > > > > > > We are keeping interrupts disabled to solve a rather theoretical problem > > > that was never observed in real world (See 3a2d7fa8a3d5). > > > > > > Lets keep interrupts enabled. In case we ever encounter a scenario where > > > an interrupt thread wants to allocate large amount of memory this early in > > > boot we can deal with that by growing zone (see deferred_grow_zone()) by > > > the needed amount before starting deferred_init_memmap() threads. > > > > > > Before: > > > [ 1.232459] node 0 initialised, 12058412 pages in 1ms > > > > > > After: > > > [ 1.632580] node 0 initialised, 12051227 pages in 436ms > > > > > > > Fixes: 3a2d7fa8a3d5 ("mm: disable interrupts while initializing deferred pages") > > > Signed-off-by: Pavel Tatashin > > > > I would much rather see pgdat_resize_lock completely out of both the > > allocator and deferred init path altogether but this can be done in a > > separate patch. This one looks slightly safer for stable backports. > > This is what I wanted to do, but after studying deferred_grow_zone(), > I do not see a simple way to solve this. It is one thing to fail an > allocation, and it is another thing to have a corruption because of > race. Let's discuss deferred_grow_zone after this all settles down. I still have to study it because I wasn't aware that this is actually a page allocator path relying on the resize lock. My recollection was that the resize lock is only about memory hotplug. Your patches flew by and I didn't have time to review them back then. So I have to admit I have seen the resize lock too simple. -- Michal Hocko SUSE Labs