Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5429813pxb; Mon, 15 Feb 2021 20:37:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpX8ck7riKg/N+Cbm7UHB65TjqKnkWPNrcQOQt8CWNsLdceLGNenzD16HUSLA/z4GkwFT/ X-Received: by 2002:a17:906:54c7:: with SMTP id c7mr5497190ejp.161.1613450264338; Mon, 15 Feb 2021 20:37:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613450264; cv=none; d=google.com; s=arc-20160816; b=leNEmlZtthdId3waWDCCr3/qBMIXpK5Eep1XXiPAVZZvXGiKxmnaJm5rXX4Ir0l9XX 0vLMdicI8cq11RFYsRKwX5icLSSIqUFY442X1lD/SBozI9EAxqegHd5C8poxr3CE/DtP /UC4PMtiaDUjegCcBStGFLlxfQH0i9LrMwaFkpCOoeUR4txoI4OV/HKzobiJ7RYqADBN IYAUW3VieISraPEaYiD5DlrfUyUZOtCSIqY5JN7w6YWn3l+zd6f9jPckre8Z/mMDkcre lQRPjHQHSU33eQhUSaiXDrZdxrK9F5jqSiOnmmBLpwfeWDSFvQ0hhg/TJhNK46HZSPYa /Zfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=g7qpTlou0UffAXpPfgR9N8/GL392LZ2opI0sf/G4JIg=; b=AminlukEhb+u9pcMKtvuIH/TGVDo6AqZDmMNcgjTSEqptp0i/cKvxCnSX4rTaPqQ2S Fv8xnvtDet3dE9gals7BUSk+9EyTLTdv7VVdFHRzSU9PVZG24CcFoQ0jRtHGP8nInNAu dwwf+/TzYPO3lkFHP8GaRGc2qSbjaQMs6l42uIMa5QMRjrDHfE31BktzJeXcF67M5G+Q VIToT6JPe0tzNsvy7OHiHKQP7BXE8e4goDEWrREphleXh+KYNKKuyK/wpkNgBegNmdOO fmBR80P8WgonCCNylCrDnb91q58ANtSMJKedK4pIoW0cfubPWsKIXFocjokON4x48vxp UKYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=m8rbbnrY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p20si5400515edu.558.2021.02.15.20.37.21; Mon, 15 Feb 2021 20:37:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=m8rbbnrY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229896AbhBPEgA (ORCPT + 99 others); Mon, 15 Feb 2021 23:36:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbhBPEf7 (ORCPT ); Mon, 15 Feb 2021 23:35:59 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5DCAC061574 for ; Mon, 15 Feb 2021 20:35:18 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id z68so5492029pgz.0 for ; Mon, 15 Feb 2021 20:35:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=g7qpTlou0UffAXpPfgR9N8/GL392LZ2opI0sf/G4JIg=; b=m8rbbnrYMey0qJejmsTRkf4tpyM6s4gLo10+3401Taw8ixlTuFm9wGsQuodGaPIkhI 2it0YGED3YR1mtZ7+jemAxpGgCkS5g2r8cbJ/Yxcv5r6sk+n7RcLZ+QpwT217So12cg4 Vhd0WrY2xJiIkJHhcKMkVIIIbke+iRZ16ScH1foXA9t42pWF4xEs5AyGPK+bV4HGJPBT 2im+gXmV5iurHyTWev/JsRw3MgYIcsthrLT9IE3G/Hrs9qa3jNwz9So7i3rmuYlpl0+8 UoMjbLWQ6EA9GCADl/4iWcbrHnPkggOITGn8DxWjKlJpC3+K8Xb86KhkALjP4WqIwRAe PkCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=g7qpTlou0UffAXpPfgR9N8/GL392LZ2opI0sf/G4JIg=; b=Rmk9o9DQTG++dNnLoD4G343YLChZ6sF5DBCqCgekdHo9UwfxO32ZMz2OjVAvIuYnZR 51+KzAmAOQo2S4w86wJFG8kdNR1xWyt1BxQd6JLZNQ3FGiu1QOYyTAfjN1xZ8b6rpYBr cjH0a3uINNOOItEG5IFaQ46VIiHtPJVhGiA6Cno34R3eH7Dw+oYs0640Xx2PSzgTunpz 0t2TdYIWgixe1VOcdbUWv8jNlrjlHZxpK2cqwRmgPT/IFNMKdip4mQ1S6ZEufQK0Bg3R dU98na6XMbccNJlkOpQoE333CgnQ1F15GsAxsLZTowT89qywx9mi4XhQ5N5Wj4B6SQGo VbxA== X-Gm-Message-State: AOAM531g/7Zqq9Dn8OMuzW93xygQyPy4wWIwGv+EtCAHN/jPoglGFSS5 l/O+wv1PBlioN1TfmqaT2lp9RY9OLA/2Rtuh/M4Tew== X-Received: by 2002:aa7:9790:0:b029:1d8:263e:cc9b with SMTP id o16-20020aa797900000b02901d8263ecc9bmr18547269pfp.2.1613450118006; Mon, 15 Feb 2021 20:35:18 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Muchun Song Date: Tue, 16 Feb 2021 12:34:41 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v15 4/8] mm: hugetlb: alloc the vmemmap pages associated with each HugeTLB page To: Michal Hocko Cc: Jonathan Corbet , Mike Kravetz , Thomas Gleixner , mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , viro@zeniv.linux.org.uk, Andrew Morton , paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, Randy Dunlap , oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, Mina Almasry , David Rientjes , Matthew Wilcox , Oscar Salvador , "Song Bao Hua (Barry Song)" , David Hildenbrand , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Joao Martins , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 16, 2021 at 3:39 AM Michal Hocko wrote: > > On Tue 16-02-21 02:19:20, Muchun Song wrote: > > On Tue, Feb 16, 2021 at 1:48 AM Muchun Song = wrote: > > > > > > On Tue, Feb 16, 2021 at 12:28 AM Michal Hocko wrote= : > > > > > > > > On Mon 15-02-21 23:36:49, Muchun Song wrote: > > > > [...] > > > > > > There shouldn't be any real reason why the memory allocation fo= r > > > > > > vmemmaps, or handling vmemmap in general, has to be done from w= ithin the > > > > > > hugetlb lock and therefore requiring a non-sleeping semantic. A= ll that > > > > > > can be deferred to a more relaxed context. If you want to make = a > > > > > > > > > > Yeah, you are right. We can put the freeing hugetlb routine to a > > > > > workqueue. Just like I do in the previous version (before v13) pa= tch. > > > > > I will pick up these patches. > > > > > > > > I haven't seen your v13 and I will unlikely have time to revisit th= at > > > > version. I just wanted to point out that the actual allocation does= n't > > > > have to happen from under the spinlock. There are multiple ways to = go > > > > around that. Dropping the lock would be one of them. Preallocation > > > > before the spin lock is taken is another. WQ is certainly an option= but > > > > I would take it as the last resort when other paths are not feasibl= e. > > > > > > > > > > "Dropping the lock" and "Preallocation before the spin lock" can limi= t > > > the context of put_page to non-atomic context. I am not sure if there > > > is a page puted somewhere under an atomic context. e.g. compaction. > > > I am not an expert on this. > > > > Using GFP_KERNEL will also use the current task cpuset to allocate > > memory. Do we have an interface to ignore current task cpuset=EF=BC=9FI= f not, > > WQ may be the only option and it also will not limit the context of > > put_page. Right? > > Well, GFP_KERNEL is constrained to the task cpuset only if the said > cpuset is hardwalled IIRC. But I do not see why this is a problem. I mean that if there are more than one node in the system, but the current task cpuset only allows one node. If current node has no memory and other nodes have enough memory. We can fail to allocate vmemmap pages. But actually it is suitable to allocate vmemmap pages from other nodes. Right? Thanks. > -- > Michal Hocko > SUSE Labs