Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1570302pxb; Thu, 28 Jan 2021 22:19:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzEm/ieIDkgvglA4cEh4kIIwv033oORTkHgU6DkERyT89gc0JahFPiMj6+YKcfbZyiZ2C6Y X-Received: by 2002:a50:d987:: with SMTP id w7mr3568385edj.356.1611901188904; Thu, 28 Jan 2021 22:19:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611901188; cv=none; d=google.com; s=arc-20160816; b=DQqyKVe/0T9armrx4dqvUh8S2Zwgmg3m3/KcQgMwGJIAIF+sx7xC+26bZn5IVD6BYI nOsQt/u730bYPtffQmCaRl2DCxMijIFL0iQpnpJFkUYXcQbpRqgHjKbWho8Zc6nR4wLy uE7mwsYZjY6c5lDje+txuVeREv6qvsbnjEl4M6e7eqEBbR+5JuImXPemMSuU2vD+TVZk /Q9znRxSqM7wPEPguOuhAGD+CAYeU/KkIK0oZ9ZtU3bRPvzZURq62T6Z3dbplRu2fzuQ P4t/YZg16Qeuv+R8Uy6Sj7w8m2WAfCigmW9ZHxn/Y7DmFlTOK7/Py+6xo9OdrydHFTPT iVng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=IVLhRnuvVbWMIlCeZcR36K8LU3Zj15Td3oSsxTVm3dw=; b=TQpMITxGPILe50fRVqPVQtyaR5SOZFXw8GAKOuSCYkDuMaq7Y0h7kbQVxZz5t/MN7+ MbB5vlehvz9AwHYdtBKPfDmxKe6jbEUzLP2GHRIbo24xQWuauppSnbddbs6Fic8d8IXS dKQHwivp3z8w/wdbw1iznlcdivM1PHw1vPI+5/Zdw8X7y8OfcEDh0BiwbXyxR2q/3beO W4WHKmjWZ6np2kneaKlO8xN4HY/f4GTRMrvZ+aMJ5bKMv1D/pBfPJku/9RcUtY1w/87n IBY/OFvruUWIid4x0XJ6hASKebWNIczJDjdVU1PXY84d3hjoZhyv2ZdL2xG/4loYBGAB r0LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=Si4B7X6K; 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 ca6si4550270edb.409.2021.01.28.22.19.22; Thu, 28 Jan 2021 22:19:48 -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=Si4B7X6K; 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 S231977AbhA2GSC (ORCPT + 99 others); Fri, 29 Jan 2021 01:18:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232036AbhA2GRq (ORCPT ); Fri, 29 Jan 2021 01:17:46 -0500 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C23CCC06174A for ; Thu, 28 Jan 2021 22:16:57 -0800 (PST) Received: by mail-pl1-x62c.google.com with SMTP id u15so4698056plf.1 for ; Thu, 28 Jan 2021 22:16:57 -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=IVLhRnuvVbWMIlCeZcR36K8LU3Zj15Td3oSsxTVm3dw=; b=Si4B7X6KLGW5Z89xZzVDHl7Skoe89UmiKGduLwtiFh0G2ErduZLcoyhzxfb8G5ThI4 syF50PNuDAMILs8Gbg3zVHAZgxzjYwu3Uw/rNASkDR2t4GqLp1BCz97iLqdk77dYA4c3 2CkKQdm+NEK6TlvP3w9vWyB3cGnovx1bDqRVEFI1RGuFthcCxJwnq2yoH7dGXiwhK+NG r0P2bc3WoSPjpzim4kOkGEgTHCPAxXV8ZbURzJNwTJ2lhdkX9bfbopWe/xjDpIAL3prB c/pTLgzzEXjCsYV5TlheMKOfuCAisunpmi0HckFP+fJtJ5ubMdQc7AsA3gMnJSt8Jmkw oBPA== 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=IVLhRnuvVbWMIlCeZcR36K8LU3Zj15Td3oSsxTVm3dw=; b=Vv54f5aBEHhZOVdlb/4MOr1uCpA8FRTgkVGhTdxbSbabzSOoULsWTeu1I1LBaXorjG BA+Sg1ua4R313SY8z1eglh++/SKX03fb22CSX8Ohg4D8FpEPIwTLgSygeDXNcZIzWobL nWn1sH+UhkAdBGSTz+5I/IzfFEZpzG20xujX8UcL5FjEKeUMkpswzCfwnAG8VlzJGb/u aXa0xXPrmrKYnoIE2w0rl6IEjrNpK2qomv4ZihBUge4Jo7dNNbHWEtSk1Z+ztKnGxWMI pFb2RsbhedA40lpzhOlv1I3gV92T4ebW2qTUgdFwXgNUszX74ZnSRNoDy4ypzUeGfbSI mDHw== X-Gm-Message-State: AOAM531Escg+nbT4QXYeXIkJlGK8EbmLrSxSOEESidBKO/AJu0ZFr1uf 9ljzJX4koIaQ3KVzdZ+Hq88+sWFFT8xpqlp0wchJcw== X-Received: by 2002:a17:902:8503:b029:dc:44f:62d8 with SMTP id bj3-20020a1709028503b02900dc044f62d8mr2746955plb.34.1611901017151; Thu, 28 Jan 2021 22:16:57 -0800 (PST) MIME-Version: 1.0 References: <20210117151053.24600-1-songmuchun@bytedance.com> <20210117151053.24600-6-songmuchun@bytedance.com> <20210126092942.GA10602@linux> <6fe52a7e-ebd8-f5ce-1fcd-5ed6896d3797@redhat.com> <20210126145819.GB16870@linux> <259b9669-0515-01a2-d714-617011f87194@redhat.com> <20210126153448.GA17455@linux> <9475b139-1b33-76c7-ef5c-d43d2ea1dba5@redhat.com> <20210128222906.GA3826@localhost.localdomain> In-Reply-To: <20210128222906.GA3826@localhost.localdomain> From: Muchun Song Date: Fri, 29 Jan 2021 14:16:19 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v13 05/12] mm: hugetlb: allocate the vmemmap pages associated with each HugeTLB page To: Oscar Salvador Cc: David Hildenbrand , 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 , Michal Hocko , "Song Bao Hua (Barry Song)" , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , 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-kernel@vger.kernel.org On Fri, Jan 29, 2021 at 6:29 AM Oscar Salvador wrote: > > On Wed, Jan 27, 2021 at 11:36:15AM +0100, David Hildenbrand wrote: > > Extending on that, I just discovered that only x86-64, ppc64, and arm64 > > really support hugepage migration. > > > > Maybe one approach with the "magic switch" really would be to disable > > hugepage migration completely in hugepage_migration_supported(), and > > consequently making hugepage_movable_supported() always return false. > > Ok, so migration would not fork for these pages, and since them would > lay in !ZONE_MOVABLE there is no guarantee we can unplug the memory. > Well, we really cannot unplug it unless the hugepage is not used > (it can be dissolved at least). > > Now to the allocation-when-freeing. > Current implementation uses GFP_ATOMIC(or wants to use) + forever loop. > One of the problems I see with GFP_ATOMIC is that gives you access > to memory reserves, but there are more users using those reserves. > Then, worst-scenario case we need to allocate 16MB order-0 pages > to free up 1GB hugepage, so the question would be whether reserves > really scale to 16MB + more users accessing reserves. > > As I said, if anything I would go for an optimistic allocation-try > , if we fail just refuse to shrink the pool. > User can always try to shrink it later again via /sys interface. Yeah. It seems that this is the easy way to move on. Thanks. > > Since hugepages would not be longer in ZONE_MOVABLE/CMA and are not > expected to be migratable, is that ok? > > Using the hugepage for the vmemmap array was brought up several times, > but that would imply fragmenting memory over time. > > All in all seems to be overly complicated (I might be wrong). > > > > Huge pages would never get placed onto ZONE_MOVABLE/CMA and cannot be > > migrated. The problem I describe would apply (careful with using > > ZONE_MOVABLE), but well, it can at least be documented. > > I am not a page allocator expert but cannot the allocation fallback > to ZONE_MOVABLE under memory shortage on other zones? > > > -- > Oscar Salvador > SUSE L3