Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1357207pxb; Thu, 28 Jan 2021 14:31:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2Rab1HoPb94mnHS1/Pik/2O4EBMw6wYb+WgkeuBmaKMNb+PZAVErtdqjzwTp+QYf2qV5u X-Received: by 2002:aa7:db49:: with SMTP id n9mr2043449edt.73.1611873069538; Thu, 28 Jan 2021 14:31:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611873069; cv=none; d=google.com; s=arc-20160816; b=kwh/Ch+fV9O2ViWvwynFqR96/idEUrLBfMd6zt8yS8tladSt+AqT60PlyauV4psb88 XobegJ4LTZ2xHVJLM9Roh53PCaSEIgIMzVhKE25UZYhUONrFhyEeEWOz6tHjPpUSyjKT C23bE0PH6/MSxY6DnH+SZwgGOKmYT8QQKL6pZkaZ+I81vV4wrJuHsw5ArktX47Y0gN5m /6bKkyQC1e5EH8famZQDHuZeAxUN3blIPvVZGoEVY2AQiBXYZ+BYZkeYr9zskIgE03id upDk5DDogr0ESgsGCdkmYL3H2y22mQa6Az1cxD/C6Qri5AowmxJYzNqkitXGY/h41AmA LLoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=v3077F44F3S+H3GILgnIfO8Tq12nLjMOzWxtHnjwqp4=; b=Hb9tc84TeaL+Ci0aX5fI/ZB/O2h6+wTULTPkXgoqxNEulUZEs2zQ6ksF53IF4uaV2W gSRju6fDRm3FllfMnZgJXxh67L2taFVmTYqo1atNKxHEGPM6b1xXZ9iOduNMgTq/xhqD 8w4LakOwRZGgKQyIqm4+pJit55hx9YX+ua5+KM4jpF+6TS4r4g3tv9pM2nXKyhs7uwbQ Ml1SycmovoJEEgt2Mh1RwBCfx/muV57GAn5vZPzptv4t4UwPv1WCFaIiC2fVTa3R337A Be2QoC6TeIggHhzbclQ9xWNoCHNLeIdyw7P9ydPQ1urVYNpbnazO62KUS5rA++2iIqNo G2QQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si3281280ejc.524.2021.01.28.14.30.44; Thu, 28 Jan 2021 14:31:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231388AbhA1W3x (ORCPT + 99 others); Thu, 28 Jan 2021 17:29:53 -0500 Received: from mx2.suse.de ([195.135.220.15]:52292 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231185AbhA1W3w (ORCPT ); Thu, 28 Jan 2021 17:29:52 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C239FAC60; Thu, 28 Jan 2021 22:29:10 +0000 (UTC) Date: Thu, 28 Jan 2021 23:29:06 +0100 From: Oscar Salvador To: David Hildenbrand Cc: Muchun Song , corbet@lwn.net, mike.kravetz@oracle.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, rdunlap@infradead.org, oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, almasrymina@google.com, rientjes@google.com, willy@infradead.org, mhocko@suse.com, song.bao.hua@hisilicon.com, naoya.horiguchi@nec.com, duanxiongchun@bytedance.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v13 05/12] mm: hugetlb: allocate the vmemmap pages associated with each HugeTLB page Message-ID: <20210128222906.GA3826@localhost.localdomain> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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