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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1B9FC433F5 for ; Tue, 5 Apr 2022 03:34:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F19C16B0071; Mon, 4 Apr 2022 23:34:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC7476B0073; Mon, 4 Apr 2022 23:34:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8F536B0074; Mon, 4 Apr 2022 23:34:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id C99AF6B0071 for ; Mon, 4 Apr 2022 23:34:43 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8E2C320B72 for ; Tue, 5 Apr 2022 03:34:33 +0000 (UTC) X-FDA: 79321408026.10.07BD86B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf04.hostedemail.com (Postfix) with ESMTP id D973940002 for ; Tue, 5 Apr 2022 03:34:32 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C3ECED6E; Mon, 4 Apr 2022 20:34:31 -0700 (PDT) Received: from [192.168.0.146] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CBFD83F718; Mon, 4 Apr 2022 20:34:25 -0700 (PDT) Message-ID: Date: Tue, 5 Apr 2022 09:04:53 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v4 2/2] arm64: mm: hugetlb: Enable HUGETLB_PAGE_FREE_VMEMMAP for arm64 Content-Language: en-US To: Muchun Song Cc: Will Deacon , Andrew Morton , David Hildenbrand , "Bodeddula, Balasubramaniam" , Oscar Salvador , Mike Kravetz , David Rientjes , Mark Rutland , Catalin Marinas , james.morse@arm.com, Barry Song <21cnbao@gmail.com>, LAK , LKML , Linux Memory Management List , Xiongchun duan , Fam Zheng , Muchun Song References: <20220331065640.5777-1-songmuchun@bytedance.com> <20220331065640.5777-2-songmuchun@bytedance.com> From: Anshuman Khandual In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: xnek9dopyoxknzcjsx1d6hkk37hd54je Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf04.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-Rspamd-Queue-Id: D973940002 X-HE-Tag: 1649129672-148484 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 4/4/22 17:31, Muchun Song wrote: > On Mon, Apr 4, 2022 at 5:25 PM Anshuman Khandual > wrote: >> >> Hello Muchun, >> >> On 3/31/22 12:26, Muchun Song wrote: >>> The feature of minimizing overhead of struct page associated with each >>> HugeTLB page aims to free its vmemmap pages (used as struct page) to >>> save memory, where is ~14GB/16GB per 1TB HugeTLB pages (2MB/1GB type). >> >> Enabling this feature saves us around 1.4/1.6 % memory but looking from >> other way around, unavailability of vmemmap backing pages (~1.4GB) when >> freeing up a corresponding HugeTLB page, could prevent ~1TB memory from >> being used as normal page form (requiring their own struct pages), thus >> forcing the HugeTLB page to remain as such ? Is not this problematic ? >> >> These additional 1TB memory in normal pages, from a HugeTLB dissolution >> could have eased the system's memory pressure without this feature being >> enabled. > > You are right. If the system is already under heavy memory pressure, it could > prevent the user from freeing HugeTLB pages to the buddy allocator. If the > HugeTLB page are allocated from non-movable zone, this scenario may be > not problematic since once a HugeTLB page is freed, then the system will But how can even the first HugeTLB page be freed without vmemmmap which is throttled due to lack of sufficient memory ? > have memory to be allocated to be used as vmemmap pages, subsequent > freeing of HugeTLB pages may be getting easier. However, if the HUgeTLB > pages are allocated from the movable zone, then the thing becomes terrible, > which is documented in Documentation/admin-guide/mm/memory-hotplug.rst. > > So there is a cmdline "hugetlb_free_vmemmap" to control if enabling this > feature. The user should enable/disable this depending on their workload. Should there also be a sysfs interface for this knob as well ? Perhaps the system usage might change on the way, without requiring a reboot.