Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp958014iob; Fri, 13 May 2022 17:42:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1QAeF+McUxSE8un3NBsnq3NJ+oXjo+KkRJucdNwXQoU8W560NZLZKZ1+TrLS/zf7rqVRx X-Received: by 2002:adf:dd4f:0:b0:20a:ce22:909 with SMTP id u15-20020adfdd4f000000b0020ace220909mr5689843wrm.374.1652488949967; Fri, 13 May 2022 17:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652488949; cv=none; d=google.com; s=arc-20160816; b=zm0mDfXefI7ug1jq7BHdCKBJwbWfl2tbN3X/kvXwC0NeJ/eDj4KDmlsWz3C/Ug3R7N efm8hJePuKAyIcHe2MlVpSnT6/3Fk/AVPcTBr+VWOzukjUUY4056poTxuHzXBftCLJYE vjkjy4ZNVE6N8Wayi2DAE4VCxZjaNxKbO8YeebLXjrVnEa5ncjOUIgoAVfAsKV4VkuZq zBcT26LORYrc65IJSYlLn6M28HHWTqG+0O5DSbal2TSnGaJkkxePYQR/jkGsIOP1Rlq0 yXzdHJff562iTK08ALmj3j7dNFVbvE06dcekOQ7aDWkrlLbKpzbSvNBJWAv5TOkA1rA4 ypOg== 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:dkim-signature; bh=3kOJe+H/ERTxI6v7eeqIA23qR8YVOZADC2y1mDVL6Wc=; b=BcWXv6cM/geIq+djjC41jpfXCjL2t2LVwGnGUml4ljOte3mrTwLloLye2UwcJq+o8u ShsBvRCImulGM0w6+MTXTvqY11DmxCJoFCS2UZTlOa3rl1wOe2ov9N/uYCrUaSEcvRYp /N9rl6HWxukH/cgdvR+/8xPDTXReXkK18xT4zo1qBhI+XV9wT4WJDF9S3lmzEHzDnWf6 V0Vf62CHvf9SC3YRM0bL1c5YW/dJYLL44T5oH0FVNjtnDV2jt6jj4s8K6ovgWN0hYhda vtGvIZnnhQDZ0tjSWn29I+wwukni0kV8coHaCxSrGXFfaoygF+RdSkSZ9ofWlxw/J9uW e3/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ITK30V0Z; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id i2-20020a05600c354200b00394800c4c5bsi2265560wmq.178.2022.05.13.17.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 17:42:29 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ITK30V0Z; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 5642630E369; Fri, 13 May 2022 16:23:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354635AbiELOAC (ORCPT + 99 others); Thu, 12 May 2022 10:00:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354887AbiELN75 (ORCPT ); Thu, 12 May 2022 09:59:57 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBD5025B07D for ; Thu, 12 May 2022 06:59:50 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id q18so4929586pln.12 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=OuuNdfTdK2PKqLlJH5Ku6pZvxFyKueqhqZO/mOICdSshbgloJBwXhq4r1SI8DZDtHS RcE/AEKwlasZ7pjtqBVhII1D2GqTxBtLRY1wu8DGmu7kUBHodQ73Kn6FvY+JkG810HCF 6qRrqoFbD0JFCLUlcZbyCNEV/ZXkIc4IZeLFZ7/KLfrMLyHI5qEKLv5qbyjE0WrJYkAx 6pfcq0MH0oHmZNpBtcMlUcd+z4tUZOTwomC4v67jrAjss0Bphx+ZZsOMcsgJU0Ewmd1I XlCMKDnUWp5t5c5VBZGH4/SLj5O/jTGzqmCr/CifpKwbR5Qc2TNBqdgBizf0p55eTaKg 1Uxg== X-Gm-Message-State: AOAM530Gn6Sd6Rv/dSCp4IdIlv8u3l2DSTy88pQdbdYpiBRtEJ2E9gmO I2/uyqsgtfkP1Moc2Dp8wLJqzg== 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> 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 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.