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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 E2040C433DB for ; Tue, 16 Feb 2021 04:35:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4248F64DC3 for ; Tue, 16 Feb 2021 04:35:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4248F64DC3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8574B8D0150; Mon, 15 Feb 2021 23:35:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 806D48D0140; Mon, 15 Feb 2021 23:35:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F4958D0150; Mon, 15 Feb 2021 23:35:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id 564548D0140 for ; Mon, 15 Feb 2021 23:35:23 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 16C2A180991E0 for ; Tue, 16 Feb 2021 04:35:23 +0000 (UTC) X-FDA: 77822866926.01.C91535A Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf13.hostedemail.com (Postfix) with ESMTP id 7330AE0011C3 for ; Tue, 16 Feb 2021 04:35:20 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id w18so5395916pfu.9 for ; Mon, 15 Feb 2021 20:35:19 -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=XZY+5xnfXtmJGBrgJbAYQCkNdzfsW73Vs63paLmLf8VG3Nb0kwZ1UKfEO/S3MNq3Yg EcIJhDYIhawDGoapM3Ut9BWDZED+632WMOQTyhBL39twamoCJ9K37R0SzVCHCEfrhHzO QITBfPq0zIf7zIlLbQ3FnzTi/OdyPNJcZO+TNLI7gCX3cpZM1/i4NYxWgpfjhCj3gGoO /VKVmbQ85NLPS3F+WXfJ+bwQ34O3pbrpt3wj7KBsSnDH/QioD9c+pn+qeo+GTR6Xvjzb faSbYiRtTEBSjgQNDYXmC0Kof3ZA+UKKYbYX89UzaY+LiKNrI6OKflMY5tECI1F8yC/w ko5A== X-Gm-Message-State: AOAM532UyHhpalMpWQszMPXbP9pSxTuvqRDXgZdg+ZmMJc2W3xWLuumm BCUidZk3y0nB929/cPXH6oXMsPw0SLbIMNWhSQl3NA== X-Google-Smtp-Source: ABdhPJyB3UwBSZXHSGLaF+VNg2XoceXdDzYRGQ0L/sN5CBcGW7SIylXtDTVsVAw7KDXOkN4b5CRNgsDavYCnxsTAZ18= 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 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 7330AE0011C3 X-Stat-Signature: qckrw65gpaz97xer1in3dp837qozs1ts Received-SPF: none (bytedance.com>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=mail-pf1-f170.google.com; client-ip=209.85.210.170 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1613450120-245774 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 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