Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3480099pxb; Mon, 4 Apr 2022 18:18:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylGzDVgls7Q2yf76ycN4iAZyrkb0GCG2WKyscsqkA5zU6u6x/oGS92SNDgkzcLMLwcYpB0 X-Received: by 2002:a63:334c:0:b0:386:291f:3435 with SMTP id z73-20020a63334c000000b00386291f3435mr775859pgz.264.1649121525549; Mon, 04 Apr 2022 18:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649121525; cv=none; d=google.com; s=arc-20160816; b=V5zE3Hwvz67ysORxPJsULxGCbscSmDweExou3kjdzTZpcEfC3RTWmC11gURpn6p0Dr hjXuaFaaGJLJzpuBHzX0ta76AZKdpebxLt7zLoslAAf1ecKa+XREbi8x/DBIB7W0bYV+ QI4kL5NYF6rYNn0sCKD1YmaGWOAZ5E64YsHx79Q8E9Rx8/ShQIpCdJkP8aqBfS669doT hBM8ee5qOCUNukLZ1XZwdOtVso0CXW7HMuPCqFO3/+ukvlUXHU+v6avQ1ETR05IwsctZ BYubyPzlC666hD2A3nDF8xrzv96DEC0sOTlq66k9HNbZg/4QFOFMWUFpsfy4M+q1sQ0/ VHRg== 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=qiD2DiGzP9w26sYqe+Qe9/hDnbh5oNwQt5iQwmO4JSw=; b=aW9ZPVHvJcmS9JOnvlakoVynP/TjvXsywfbdbMtQmA2OOpKS9+EDiigzZl9dfZ2MeB p5IUIgN5FuwK58AvaJ1kawXoi0+Wb84j0tUJdFnqlFHtYztenJ5lPyNCPv5hSJfDqSDG VgTU/I2PM4rYt/lnoj8MJbfwvOw1LemPKY94XSK2b6BLdN2FEglF4JAVdP6XaAbgKiO0 GmGm6UvPJ20kuslJV0C18RRlHmf9OhrUJWxXTVlIUK6c1IblF7wa69htYcRmglX6b6pA EW0jseSImG133KbzXJfZ4PRAOscTvjDVfJynYK3KTzoZOcVxYjARtXnLtTztAF392mr+ BxxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="f0Q/WVKI"; 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=bytedance.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id nu11-20020a17090b1b0b00b001bd14e01fc0si502332pjb.174.2022.04.04.18.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:18:45 -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; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="f0Q/WVKI"; 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=bytedance.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D4EEF1C8AA9; Mon, 4 Apr 2022 17:21:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234707AbiDDMD4 (ORCPT + 99 others); Mon, 4 Apr 2022 08:03:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234569AbiDDMDy (ORCPT ); Mon, 4 Apr 2022 08:03:54 -0400 Received: from mail-yw1-x112d.google.com (mail-yw1-x112d.google.com [IPv6:2607:f8b0:4864:20::112d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A67D93526B for ; Mon, 4 Apr 2022 05:01:58 -0700 (PDT) Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-2eb3db5b172so50099777b3.6 for ; Mon, 04 Apr 2022 05:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qiD2DiGzP9w26sYqe+Qe9/hDnbh5oNwQt5iQwmO4JSw=; b=f0Q/WVKIXSIDfrftxANHLkiSt8cLGcIxC2CKNOOHR1qG5zVRc6lm6AKe9sz79acMOl o2eMNhB+4khUHjghxea1XC3y2YB/ZKAHo4/aJv2HQQ9m83CByvZyEP3G64oxzlG0vO8F 8/8Ni0EIF6svCJYvrABjqP3Mq8lJdQZyK7M9voCo8A2QF5/wy7cXX6n689kSTuEHQdsy uWkaq+Px33gmCtC/pZB7GE7Qf+EoxpvqsZfCo1fEZiBVFvFKk/CQ76EHwjgohkYr2HIs df/HzJZ3KqkcSOVJP+cMXxOA9vRoUvH+IybMVW0g+ol8aymnpDd2O6/4MFMaaEG5q/rP gSSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qiD2DiGzP9w26sYqe+Qe9/hDnbh5oNwQt5iQwmO4JSw=; b=cUVnXdbfuzes5MAT9iYwmj8+qecxX5FAdgjov+EW/cb4yD1RjXX1X3cyuXN/ADl6BJ i42T720l+kmO6pJ3vTT0Nq/ScryT2fEPs6Ru8sftziMizzpxhj4OLzileIT6rKyGl1pv JOhHjyDOJn43JoYjFzXNbtWp2BHApf2Cwe8MxzXdzg0FTK2+AxVdO752t9SdvBS6xMJz nn3fS9jozcRVclsxVqkZ/KBt0Pw7WqYROtdlEyjcuh9x9rYeIht7ZdFtuy6bSz4RNXPx dOsIbue/v0+brierku/z3Xm8nMg4LnRLm+46qTris9Z1KlyedCCCKR4hoDKDQ8BfdbXU EE7w== X-Gm-Message-State: AOAM532dN8TnW+a8IcMzQ2J5VqsevUwlJrnxRUdHQOoqQZ1jCeJK0FuX EVmr+GxeL0u3Q3HRkqI+tDAVujbLwgkJ2dHfWiQghw== X-Received: by 2002:a81:1196:0:b0:2eb:897a:7b5 with SMTP id 144-20020a811196000000b002eb897a07b5mr868948ywr.31.1649073716376; Mon, 04 Apr 2022 05:01:56 -0700 (PDT) MIME-Version: 1.0 References: <20220331065640.5777-1-songmuchun@bytedance.com> <20220331065640.5777-2-songmuchun@bytedance.com> In-Reply-To: From: Muchun Song Date: Mon, 4 Apr 2022 20:01:20 +0800 Message-ID: Subject: Re: [PATCH v4 2/2] arm64: mm: hugetlb: Enable HUGETLB_PAGE_FREE_VMEMMAP for arm64 To: Anshuman Khandual 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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 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. Thanks.