Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5135053pxb; Mon, 15 Feb 2021 10:21:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxn/IgEdd35X19tUuaw51tcMtbhQnbF9BX3VEYwxkgbkkBjpSHdCBZPk4hOQbEP3C9jQyEo X-Received: by 2002:a05:6402:204b:: with SMTP id bc11mr6810008edb.241.1613413296883; Mon, 15 Feb 2021 10:21:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613413296; cv=none; d=google.com; s=arc-20160816; b=exlEPd0BNpLx8vU7o+QN9hlPFADnf8v/C+X8584Il3P1bO30HELYHSS6QA7TOFeAYn qu9WNI18hqZCQA4m73RCmY8ABRni6DJGeS1Eb8LpvOtBBQUuQ3X6wIgOAHZctXksiayy UnD5NVBT1qMAgLzpcHoYI9mE8pAkxw2bXMCNeJpFXEO4rTS1bSTL+isSyb3wOZKXZ6Zj y8Q+Bmfqiuq5n37U+SXmwXEfjqJf1fWXYrnLoylEDGGbXOKzT0c+1+/Xx5TSaYOfbQbi c70cEP6DBRTxS0KuNEm3jAOf35AMhpNOa69FBJ5pmd9E6VWjHa/6g9zoWKkwKm4TzCwv uriA== 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=USwR3sUAh3X/IQIe8yfKo61p7LMNkKqO4NUHOz8c8WU=; b=NbRREDEJ0CtoJi92/4wOrZrVEqnw7E2ZUlYJnRxqyzTC2T8sJheD98Kb8lK4zkHQDM CAVxuuBXG5Vo3sXK8hzRcZoguJVsjckAPxx9R9eShlCy+4UJVUsoosmnp0+TXZfEKUx5 hfIn+UO/fsULlhIknkMX3LD2riXYPPvW+hUD33LqnxZ/VbzUH4nhhswxp9IXKHTD0tsL JxZ/hvdVFEAmmlBOp7jdVZkpgXHyJTXhVkgPmYkwOIErZzCbm5CW/9QOmDPxqv/BnOfD JBQy3fNAurQ+j7HbqLSFXEb4am9xvWiwYyHtX1Mb804VtsiPcr51k35RVdlu3WahXpdW yV4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=jyMGqHpG; 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 j16si12965382edv.27.2021.02.15.10.21.13; Mon, 15 Feb 2021 10:21:36 -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=jyMGqHpG; 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 S230225AbhBOSUm (ORCPT + 99 others); Mon, 15 Feb 2021 13:20:42 -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-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