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 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 07642C433E9 for ; Mon, 15 Feb 2021 18:21:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF07764E05 for ; Mon, 15 Feb 2021 18:21:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230394AbhBOSUs (ORCPT ); Mon, 15 Feb 2021 13:20:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbhBOSUh (ORCPT ); Mon, 15 Feb 2021 13:20:37 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00BA4C061786 for ; Mon, 15 Feb 2021 10:19:56 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id k22so4156770pll.6 for ; Mon, 15 Feb 2021 10:19:56 -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=USwR3sUAh3X/IQIe8yfKo61p7LMNkKqO4NUHOz8c8WU=; b=jyMGqHpGp1yPvi1APhdJZWbix/DfwuVSfSYSpVglMTqJ2ePgxDrDjxZantLX5K5tp9 n7ZUC8D5N4xr1g3Mb5W+idJIfbZdmDnv9HC/eFjwlzHzN9A5DSjix6uCPcNJv8PjrwG+ yLNqluW5wWq6fOIJFpBPFssdSRXJoD5bcidRkT2q8i6j7KrYu9pnJPo+T7oDX/zvATF6 UVoIf8f1xGPUIvjYjzmpTGKAOmFzixi8lNF8bPLGwc2TDGHOWxWo4Ye3+FGNHu/+aBDg n1o7CTOEuUyFRXrOoRTr7DO/yUEjrwekxD8doXyuN3Kn/zyO0EZZuc7xLoIriak3o6oj 2iIQ== 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=USwR3sUAh3X/IQIe8yfKo61p7LMNkKqO4NUHOz8c8WU=; b=jqo5LkyY4gcbQQB0VA8A5Fcdy8ozDecLDqunjD1VJIlyZ46LxhT9D99SAVo19H7uwI dh4Kh2A/AvcE18TeixplEx9iHUMg98xaB1XmKC8yvmPCCpSIQX4iEZGRR+NedY9FaZe4 bcEa5AvIC/9UWqwaERjiDIBWfj8vALgLiQUY6vF0gyQLl5ABRuZxyalKwJTJ3KxQA0Nj sxpYoEgMklxyf7h7+wm/pZscXlsxKPMFpPVwV/Lhim0zE54vDrybEPASQ0G3kv4YjFRp aCVGAbK0ZzGidiyers8g7d2T7m0bQ1xu8/p9s2NMepaWvTNmt24hT8vqVFrNiWmsd8ue iQdg== X-Gm-Message-State: AOAM532th0JgAQ6lw+ICZPLpu4ToQFo1lKabYWaKo2Fss6ekLVKAzdyp KBpiOJwYDOXMBNrV7BSyXjCH2bqmlGjtmrVfw4L05w== X-Google-Smtp-Source: ABdhPJy/NfIbAZY8/WKidLiAfmiqQ4UOgwQAs69wL7Uen0KC9xCwXgsZkScddOlYw0iSM1IFQFbdq/LfWOFFCVgTyfY= X-Received: by 2002:a17:90b:1096:: with SMTP id gj22mr109592pjb.229.1613413196531; Mon, 15 Feb 2021 10:19:56 -0800 (PST) MIME-Version: 1.0 References: <20210208085013.89436-5-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Tue, 16 Feb 2021 02:19:20 +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 1:48 AM Muchun Song wrot= e: > > 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 for > > > > vmemmaps, or handling vmemmap in general, has to be done from withi= n the > > > > hugetlb lock and therefore requiring a non-sleeping semantic. All t= hat > > > > 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) patch. > > > I will pick up these patches. > > > > I haven't seen your v13 and I will unlikely have time to revisit that > > version. I just wanted to point out that the actual allocation doesn'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 feasible. > > > > "Dropping the lock" and "Preallocation before the spin lock" can limit > 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=9FIf no= t, WQ may be the only option and it also will not limit the context of put_page. Right? > > > -- > > Michal Hocko > > SUSE Labs