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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16906C433EF for ; Thu, 12 May 2022 14:00:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350403AbiELOAC (ORCPT ); Thu, 12 May 2022 10:00:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354888AbiELN75 (ORCPT ); Thu, 12 May 2022 09:59:57 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB77025B07C for ; Thu, 12 May 2022 06:59:50 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id a15-20020a17090ad80f00b001dc2e23ad84so7896151pjv.4 for ; Thu, 12 May 2022 06:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3kOJe+H/ERTxI6v7eeqIA23qR8YVOZADC2y1mDVL6Wc=; b=ITK30V0ZUC+q2vylMd4KbId4Ew0IpXXKdRnB/uGG7YT+A58FXfW/a49f3+jEpj8OLj ANtE9V9zqSriZ7nDoXMGOR+o1WOd1YCUZOZQ+0jXTCIh5d0w+wPfiu7D+E60dcEn1Bfj WpRdRmKZ0IypCClA3wBKR8kaS4XwaFIxUsawG8rFxliw05T5hJOQwDZ1UP1PTRTkKN6q JLOhsyUwF4CsADHQAFrXQu7nHj3FYLiVcxR2ZtYAolcM7YCSNK0Sh5lqTRm+Lxl2GgDA FwwiM0BzoiPCiV/y2qGsw7rRvvgD/i7s0jxPbGGmVVt+1nNsNvoiz1RDXgwb47nBaAvd RheA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3kOJe+H/ERTxI6v7eeqIA23qR8YVOZADC2y1mDVL6Wc=; b=QVwXGt7SZjiupwskrDoc10OKvY2sATLWKsUPaF5kLwGfzqCAwVbhyB4vx0/C8iJr3W dxMmjaXePkn5pG5snNxVD//d12c03HpQNcHz9TJga0MfWUaHtrtpYWSEaGhzxDsoR3kE roblbj6PemIBw51DQh4P8kfnjejQg74A30TCsvWvwoFXMtGirS2rBhhtR1dhyZV14bPK kbm2PrqKBEi12VyXc1WBRyYcpuQjAs3ETQM+9YDlMCLkxTJIWSFVQk+ZzHU2EOrQjp1u AAvFmHbibPgjqZFbUOoHXFYZcJV5dINgO3Bu6cbwJRqTG0b6gsq2cVKbfqrt/eQgWXdt ksrA== X-Gm-Message-State: AOAM532LtPa1Xqc0MdiAcbp/jwAdqta5xYxJ8MjKnUvekv9O9BoJmUnp 9eWfbHBWJIFeQPtc9QbpKSKilA== X-Google-Smtp-Source: ABdhPJx+vFO/jdauj2MQt/7gUdxpe2Sk1Zo72LFQJnNVksQfkJKJxnKxVLSTLyzoFNKL3X0NWLRj5A== X-Received: by 2002:a17:902:ccc2:b0:15f:4acc:f202 with SMTP id z2-20020a170902ccc200b0015f4accf202mr1778237ple.3.1652363990352; Thu, 12 May 2022 06:59:50 -0700 (PDT) Received: from localhost ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id a8-20020aa78e88000000b0050dc76281bfsm3748854pfr.153.2022.05.12.06.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 06:59:49 -0700 (PDT) Date: Thu, 12 May 2022 21:59:37 +0800 From: Muchun Song To: David Hildenbrand Cc: corbet@lwn.net, mike.kravetz@oracle.com, akpm@linux-foundation.org, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, osalvador@suse.de, masahiroy@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com Subject: Re: [PATCH v10 2/4] mm: memory_hotplug: override memmap_on_memory when hugetlb_free_vmemmap=on Message-ID: References: <20220509062703.64249-1-songmuchun@bytedance.com> <20220509062703.64249-3-songmuchun@bytedance.com> <284eec3f-a79d-c5f0-3cd6-53b8e64100cd@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <284eec3f-a79d-c5f0-3cd6-53b8e64100cd@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Thu, May 12, 2022 at 03:04:57PM +0200, David Hildenbrand wrote: > On 12.05.22 14:50, Muchun Song wrote: > > On Thu, May 12, 2022 at 09:36:15AM +0200, David Hildenbrand wrote: > >> On 09.05.22 08:27, Muchun Song wrote: > >>> Optimizing HugeTLB vmemmap pages is not compatible with allocating memmap on > >>> hot added memory. If "hugetlb_free_vmemmap=on" and > >>> memory_hotplug.memmap_on_memory" are both passed on the kernel command line, > >>> optimizing hugetlb pages takes precedence. > >> > >> Why? > >> > > > > Because both two features are not compatible since hugetlb_free_vmemmap cannot > > optimize the vmemmap pages allocated from alternative allocator (when > > memory_hotplug.memmap_on_memory=1). So when the feature of hugetlb_free_vmemmap > > is introduced, I made hugetlb_free_vmemmap take precedence. BTW, I have a plan > > to remove this restriction, I'll post it out ASAP. > > I was asking why vmemmap optimization should take precedence. > memmap_on_memory makes it more likely to succeed memory hotplug in > close-to-OOM situations -- which is IMHO more important than a vmemmap > optimization. > I thought the users who enable hugetlb_free_vmemmap value memory savings more, so I made a decision in commit 4bab4964a59f. Seems I made a bad decision from your description. > But anyhow, the proper approach should most probably be to simply not > mess with the vmemmap if we stumble over a vmemmap that's special due to > memmap_on_memory. I assume that's what you're talking about sending out. > I mean I want to have hugetlb_vmemmap.c do the check whether the section which the HugeTLB pages belong to can be optimized instead of making hugetlb_free_vmemmap take precedence. E.g. If the section's vmemmap pages are allocated from the added memory block itself, hugetlb_free_vmemmap will refuse to optimize the vmemmap, otherwise, do the optimization. Then both kernel parameters are compatible. I have done those patches, but haven't send them out. Thanks.