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 EF8A2C433DB for ; Tue, 16 Feb 2021 04:36:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B105D64DC3 for ; Tue, 16 Feb 2021 04:36:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbhBPEgG (ORCPT ); Mon, 15 Feb 2021 23:36:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229703AbhBPEgF (ORCPT ); Mon, 15 Feb 2021 23:36:05 -0500 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF1EFC061756 for ; Mon, 15 Feb 2021 20:35:18 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id x136so5418040pfc.2 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=nWrs2cNvueuoCMHgX9wLZ/lpe8WyuBCI73CgbKl01fNj/aegbVNjYT8pa0Hf6f3Hlc RtgUxcpN+zWKhRPj9sHRpQrwKd72G3npIn3kQO3vN4SZs5YfdIgeWGqXABjXDoFTERCJ he+S3honzkTcu02bMOsKTdazY+Jx+kitJhxWaP8grNVgBKW/j8QBuBamdpCaoN4W2qLd FtR+10ji4IhQ9LvzoDT2PjsTFlJVVGvy9qtgvQarGmEuyCqK0XnEhPsvUTtYDNyzcOTs zQstvWsm30cwOe9PoYw2P2OlDgqtHmb69UBIu3xn24iSlSa1x+nBFK2tEPlYz7LwVr/g pwFg== X-Gm-Message-State: AOAM532i2YV5b7MmoFw5cNebhKTNpykGcGzUKhy9IXspOhVO+QdUfWnY YMZ3zsgrRd8ChFDzMugrKT0anhP6HQ3u2rQdKpc+Fg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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