Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3557016pxb; Mon, 4 Apr 2022 21:11:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXLIPY31SGotF+zJ/fBCWDSv0S4Bj5fekXPxcY0gKtWTZJ1ETcEouiDDcLbPPmx1zvZPxf X-Received: by 2002:a17:902:9309:b0:156:983d:2193 with SMTP id bc9-20020a170902930900b00156983d2193mr1410229plb.158.1649131896616; Mon, 04 Apr 2022 21:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649131896; cv=none; d=google.com; s=arc-20160816; b=M8giG7UOdMp926wO6dUsn6CZAy7/n1AATtqpaYHV/Ya7sq/nl+Bzf2TJY6F/oPYYlX 84mW2BYqud5L5LWJEVm3dUrpu6EWxd5C+cHyCnO/qeKvbjUB43dSQd0SxwUoqv3vxy0q pkFt5HeOdp4ffdpAXC28cnmT8byaKep0vLqSC/AhD+sjWpHFBSKouAUHz7sEjpM/GgPV ZhYxrgeUhSyhWU6y6OQ7779CowVeNb/F8aYxIobf12hQTovNBZS3PLLVv+fB4NlK736X meJfa6fmRhNzlDQvqKsHPZ/017dnZIHCMyeeOkGFB2PdnCGRQqGfO3VUp6DvWihwCBc6 DffQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=+xcBz4s32u8mASAvROK4FRRxR5/VlIy+UFADAh6c+a8=; b=dFVqFfE8mP4F652IzSU3iVxbn6XS94o46JFEkM8PPN5umkng4azdIIBrV/Pgn4pTnY Mb/QTzN1m7HB6pEEXVbh6pnydc3aGrTBhUj8Aj97cgpyMGXf7znI3e/jZoed0TkfJzxX zTpFw5F/Ar1JmlmuZlINwei2KJg7f5iSVgJF9aiLbOcUYZgp+sYtvmjD2rxG3ye+9UFe 7hwmF9wSvIk6wqahnoFiyCajBszJWuPlViD4cnisGiRn39ZZz+gcI0bba9c6BIlOhNwI vD8cGLT4SCOTFk4B9of+G5UNss6vMYx8Hl4K1rgTI5O3je0FAIKKz0vkSBwoYqMD1MZ/ 3K4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u2-20020a056a00158200b004fa3a8e000csi12838083pfk.195.2022.04.04.21.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 21:11:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3F3CDB87E; Mon, 4 Apr 2022 20:34:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbiDEDgf (ORCPT + 99 others); Mon, 4 Apr 2022 23:36:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbiDEDgd (ORCPT ); Mon, 4 Apr 2022 23:36:33 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B874A1CE for ; Mon, 4 Apr 2022 20:34:32 -0700 (PDT) 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-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.