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 9D796C433E6 for ; Mon, 15 Feb 2021 17:50:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 711BD60C3D for ; Mon, 15 Feb 2021 17:50:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231435AbhBORuP (ORCPT ); Mon, 15 Feb 2021 12:50:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231518AbhBORts (ORCPT ); Mon, 15 Feb 2021 12:49:48 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 776AAC0613D6 for ; Mon, 15 Feb 2021 09:49:06 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id t11so4615942pgu.8 for ; Mon, 15 Feb 2021 09:49:06 -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; bh=0raigWBsW5BmlJVVshcrNYwzQYWZPvQmzq/5zwebTXY=; b=fl6FixGKWjTID3qTSaKuX0EgetRR8QBn7aRcT3Xl+UP8cqOr6p3G+iD1eTTf0hu3ak +liuII/Gu+qlMZYn4CTSKBRild3fq4iiKeEGL+8b/HMEyTkfR0lxpp1aIyP5MOkOnLHu n7mDgFs4eE/SMAqzxJNbxWCbSUC+xHlWEWLG3qrIScMk/bjvOR57kk7nFY7rVn/9UiH9 g2pOpALQHu/15aB71vd8qzQeiPvr76pUiiibWLdgNXzIRdH3e7uN2WCmTp8lGk/ksYR7 ZIRk0VV4pwRJE21aYuWDbkXc3kOpnbN0CK8+C727b5npEWm2JsCj1LaBgWNXZrMEv6// 4r6Q== 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; bh=0raigWBsW5BmlJVVshcrNYwzQYWZPvQmzq/5zwebTXY=; b=IGVhxxPIK14qqR27Bh2nPXJBEo7xIKHL0uh7BcdLEje3wWu2VkLUPUzhwMriUqjwE0 v8TRsfS2b1sabkzGv6nzv7TmZxtm7Z8MF1LFXaw+PF+M/CeUIgXPdVaduHXLB71G1kUw DLzfzUhofDfZW8WAkYTm3WI6YJVaU+BJyO7TUWf7EebCADGnm7LwxND19zLaddDrZCS9 qqMeulfyYWIIvs0TN0LHsCPsCdrwA/28daBa6ZrOSq9jgPk8vhUcz+f9I+5u8fWIFNDw mKJTc4YLQEGtWUYjerVnWLr9WrYFTThxSD04lb3Vqzwx7dlsSbRNyC+9GATWn0vBSp1D iM6g== X-Gm-Message-State: AOAM53182ucX0hfeQLxXQ7BIojG9DxL9sNMiP1x63tbFvjEA52kAcDx4 ev9wVkWFKvIZgRNu0Hyw4QK18K9+VAu4AA6NQbpayQ== X-Google-Smtp-Source: ABdhPJz4LqZsDGklbkN4FqRjRy8OxHw8u+JlsWDcM1+xjYoqctmuuXLbOUqvMlpcK78wa9N3DIsalYaZRJP0O/OTh7o= X-Received: by 2002:a63:480f:: with SMTP id v15mr15739656pga.341.1613411345880; Mon, 15 Feb 2021 09:49:05 -0800 (PST) MIME-Version: 1.0 References: <20210208085013.89436-5-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Tue, 16 Feb 2021 01:48:29 +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" Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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 within the > > > hugetlb lock and therefore requiring a non-sleeping semantic. All 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) 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. > -- > Michal Hocko > SUSE Labs