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 7CBDBC3DA7F for ; Mon, 12 Aug 2024 09:05:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EAD326B008A; Mon, 12 Aug 2024 05:05:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5C456B008C; Mon, 12 Aug 2024 05:05:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD5A86B0092; Mon, 12 Aug 2024 05:05:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AC3726B008A for ; Mon, 12 Aug 2024 05:05:09 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 4F3651C1E15 for ; Mon, 12 Aug 2024 09:05:09 +0000 (UTC) X-FDA: 82443009138.04.6FC039F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf17.hostedemail.com (Postfix) with ESMTP id 040E540027 for ; Mon, 12 Aug 2024 09:05:06 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=R20tPfPn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf17.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723453429; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FQmic4rrhKdKv6gFEUKIhBWO7nEe9F0WUcgCzCN1ejI=; b=Uuytyxzgdgv9y5WNT7KitwUoG8rlQIL17Ty3TFH4v0D4iMf7oyWzZhAyKxMEiK8wjcgzpS ipsgokkopArdui77ZCiC3wzyi8oZgLKNxRuZwSoW6MQRuUDQrvECWahrrBgdIzxcUsv0l0 ldCchc9sr1A/KD9tKdwDdBNRaohpfOo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723453429; a=rsa-sha256; cv=none; b=axMjsKeA6qDp1vr+cLMUpsE9b+Py/DpQ4VRM6KsnqzApheO/QneXtEMNV831LvhMQmyXV+ kDu80ygkOyrYLARW4VIbz2QMGv/75VVtHH7AHXKfEYAst81PKqsGuVvhTiPWSqsdvd+Ggf QA2vHhaLft3QBslMYM0Ee6+X8jxNink= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=R20tPfPn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf17.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723453506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=FQmic4rrhKdKv6gFEUKIhBWO7nEe9F0WUcgCzCN1ejI=; b=R20tPfPnvPbZ9yBPFFbpv1PSWswZ7y5M+SQMe+vNGmzxr1KICfPeBbfr5Y2u3bXUGfcHXH oocimPgBTOdd3OofjTI9SpK1JCRieNuvn7y9FukAaWDkctCZFblvnV86SF7sy9TPS3wBUm ojgM7OsZ2r++1mi49xG21ft+M09EZ6Q= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-352-dI-VbuFPNDCIW3cEcGVo5A-1; Mon, 12 Aug 2024 05:05:04 -0400 X-MC-Unique: dI-VbuFPNDCIW3cEcGVo5A-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-428fc34f41bso32215455e9.3 for ; Mon, 12 Aug 2024 02:05:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723453503; x=1724058303; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=FQmic4rrhKdKv6gFEUKIhBWO7nEe9F0WUcgCzCN1ejI=; b=JQkCjFeNfMlJuNl1PGvFV6rsuzMHdim4TbCFPsvzM+mwzMN6R4jRDBYvxLNAGWrrE0 L7xF127CsAU5t+LKSwZ7nKeAQkGoSlGt18hDlFGzRV1h0/ytohzujIJhNmo+5e4E70lN M2fOur2W0p2CBzujxwhuZ5Bl+y+84Qnqw/+aTHqRwefyoaIs2XaKfeW2RKXVAc/dHAKI Guo7z+pdu5ZD2lGdO5MGuSGTmmCcH1bj3j0oUIwtp3bd7d52sPjAeMciNO1aRMzTrmxb so++QKGmdmr7wcXmUYs3OmbyeWveA0ufq5F+tanm6WbivXqkswmfXH4k8D2uJrXne/oc O/DQ== X-Forwarded-Encrypted: i=1; AJvYcCVJvkthQN2dXmDUQ53WFrTZcU3gBwGY/AbqAvMObeXWtDVMkY9/LTEv+oKGbGVFnog8fsJCR8Y1aJ9Tgpu0kSh3Dm0= X-Gm-Message-State: AOJu0YxVxODyolS805Ex/k44YXG9H9u4yE94OX6NtNIG5epjYtihnelX 5CDo0mn3EUDq3NhVcAofsFZxdD12NaVrUEWZ6t0CA8bZhPLNDq1Lua0h8uouf73wDenIAE3gRAV MQiCXbBYVTi31/pqUFMvTPI4JMxNZQ+wEZDn0LymnQBMq5CW/ X-Received: by 2002:a05:600c:63cf:b0:426:6551:3174 with SMTP id 5b1f17b1804b1-429c3a51ed8mr63863265e9.29.1723453503544; Mon, 12 Aug 2024 02:05:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHA7AT4kmOP0pv0NUPTzBt8K9FOVasnWaWdE9V/oQUeFkCKxn4YS7cFmRzPtW7ouIV9SyzpCA== X-Received: by 2002:a05:600c:63cf:b0:426:6551:3174 with SMTP id 5b1f17b1804b1-429c3a51ed8mr63862995e9.29.1723453502913; Mon, 12 Aug 2024 02:05:02 -0700 (PDT) Received: from ?IPV6:2003:d8:2f09:3f00:d228:bd67:7baa:d604? (p200300d82f093f00d228bd677baad604.dip0.t-ipconnect.de. [2003:d8:2f09:3f00:d228:bd67:7baa:d604]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429c7755caasm94489835e9.39.2024.08.12.02.05.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Aug 2024 02:05:02 -0700 (PDT) Message-ID: <3d1abf37-6eb0-4390-9508-6270040823a5@redhat.com> Date: Mon, 12 Aug 2024 11:05:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] mm: Override mTHP "enabled" defaults at kernel cmdline To: Barry Song <21cnbao@gmail.com> Cc: akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, corbet@lwn.net, ioworker0@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, ryan.roberts@arm.com References: <8258bf4c-ecec-4e06-ada0-da9fb99b1219@redhat.com> <20240812053636.97700-1-21cnbao@gmail.com> <08390990-b47a-4663-8eae-ee51aac55b45@redhat.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOi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gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3 AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 040E540027 X-Stat-Signature: mreo9if4d18f8hrzxddoed61wwey31nq X-Rspam-User: X-HE-Tag: 1723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y0KDJuczflo51kj5Iu9Tw5e5xrt964WWzrOn9LAbnWi5//ac4vYvlcgf60oONkmCGp+geALQpebNo+ehAL5uroySY9l8wSxg+uCM5DLjBoacbhmvBrCoX7bH27z9HGkUkyXMNNu92YiEoPJfoG2YUFhPbCqkUkaSqmEoaEzMaWxCObR4Mjp/dVLfoIsgkHvWEC0NTCHlsQP4v4Ng0SpZGinnHOcYUtKvtTgkK6OEyqV59eFOXPpELRPosLjtBTGxXuh3COk3TLfzgqQnPxC0qJozqDSZeqZOXZvJSRzfCxY4+Sd/I+1iuBX4n73hf8qMzuyu2RIS24qlBUvhgIqDVAPB+kWO1odM7SKepXGPF8msuH/+0+8DucQkChZuw+5s+W3amU2g/A/cutkCWv1OqWE6VyM/g3QM/ib/x7t0ZA== 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: List-Subscribe: List-Unsubscribe: On 12.08.24 10:36, Barry Song wrote: > On Mon, Aug 12, 2024 at 8:20 PM David Hildenbrand wrote: >> >> On 12.08.24 07:36, Barry Song wrote: >>> On Sat, Aug 10, 2024 at 1:15 AM David Hildenbrand wrote: >>>> >>>>>>>>> -You can change the sysfs boot time defaults of Transparent Hugepage >>>>>>>>> -Support by passing the parameter ``transparent_hugepage=always`` or >>>>>>>>> -``transparent_hugepage=madvise`` or ``transparent_hugepage=never`` >>>>>>>>> -to the kernel command line. >>>>>>>>> +You can change the sysfs boot time default for the top-level "enabled" >>>>>>>>> +control by passing the parameter ``transparent_hugepage=always`` or >>>>>>>>> +``transparent_hugepage=madvise`` or ``transparent_hugepage=never`` to the >>>>>>>>> +kernel command line. >>>>>>>>> + >>>>>>>>> +Alternatively, each supported anonymous THP size can be controlled by >>>>>>>>> +passing ``thp_anon=[KMG]:``, where ```` is the THP size >>>>>>>>> +and ```` is one of ``always``, ``madvise``, ``never`` or >>>>>>>>> +``inherit``. >>>>>>>>> + >>>>>>>>> +For example, the following will set 64K THP to ``always``:: >>>>>>>>> + >>>>>>>>> + thp_anon=64K:always >>>>>>>>> + >>>>>>>>> +``thp_anon=`` may be specified multiple times to configure all THP sizes as >>>>>>>>> +required. If ``thp_anon=`` is specified at least once, any anon THP sizes >>>>>>>>> +not explicitly configured on the command line are implicitly set to >>>>>>>>> +``never``. >>>>>>>> >>>>>>>> I suggest documenting that "thp_anon=" will not effect the value of >>>>>>>> "transparent_hugepage=", or any configured default. >>>>> >>>>> Did you see the previous conversation with Barry about whether or not to honour >>>>> configured defaults when any thp_anon= is provided [1]? Sounds like you also >>>>> think we should honour the PMD "inherit" default if not explicitly provided on >>>>> the command line? (see link for justification for the approach I'm currently >>>>> taking). >>>> >>>> I primarily think that we should document it :) >>>> >>>> What if someone passes "transparent_hugepage=always" and "thp_anon=..."? >>>> I would assume that transparent_hugepage would only affect the global >>>> toggle then? >>>> >>>>> >>>>> [1] >>>>> https://lore.kernel.org/linux-mm/CAGsJ_4x8ruPspuk_FQVggJMWcXLbRuZFq44gg-Dt7Ewt3ExqTw@mail.gmail.com/ >>>>> >>>>>>>> >>>>>>>> Wondering if a syntax like >>>>>>>> >>>>>>>> thp_anon=16K,32K,64K:always;1048K,2048K:madvise >>>>> >>>>> Are there examples of that syntax already or have you just made it up? I found >>>>> examples with the colon (:) but nothing this fancy. I guess that's not a reason >>>>> not to do it though (other than the risk of screwing up the parser in a subtle way). >>>> >>>> I made it up -- mostly ;) I think we are quite flexible on what we can >>>> do. As always, maybe we can keep it bit consistent with existing stuff. >>>> >>>> For hugetlb_cma we have things like >>>> ":nn[KMGTPE|[,:nn[KMGTPE]] >>>> >>>> "memmap=" options are more ... advanced, including memory ranges. There >>>> are a bunch more documented in kernel-parameters.txt that have more >>>> elaborate formats. >>>> >>>> Ranges would probably be the most valuable addition. So maybe we should >>>> start with: >>>> >>>> thp_anon=16K-64K:always,1048K-2048K:madvise >>>> >>>> So to enable all THPs it would simply be >>>> >>>> thp_anon=16K-2M:always >>>> >>>> Interesting question what would happen if someone passes: >>>> >>>> thp_anon=8K-2M:always >>>> >>>> Likely we simply would apply it to any size in the range, even if >>>> start/end is not a THP size. >>>> >>>> But we would want to complain to the user if someone only specifies a >>>> single one (or a range does not even select a single one) that does not >>>> exist: >>>> >>>> thp_anon=8K:always >>> >>> How about rejecting settings with any illegal size or policy? >>> >>> I found there are too many corner cases to say "yes" or "no". It seems >>> the code could be much cleaner if we simply reject illegal settings. >>> On the other hand, we should rely on smart users to provide correct >>> settings, shouldn’t we? While working one the code, I felt that >>> extracting partial correct settings from incorrect ones and supporting >>> them might be a bit of over-design. >> >> No strong opinion on failing configs. Ignoring non-existing sizes might >> lead to more portable cmdlines between kernel versions. > > Well, I realized that the code I posted has actually applied the correct > parts because it modifies the global variable huge_anon_orders_xxx. > Unless I use temporary variables and then copy the results to > global ones, the code has been this issue to some extent. > > maybe I should remove the below "goto err", instead, ignore the > incorrect strings and go to the next strings to parse. I'll have to look at the full patch to be able to have an opinion :) >>> >>> I have tested the below code by >>> >>> "thp_anon=16K-64K:always;128K,512K:inherit;256K:madvise;1M-2M:never" >> >> There are some parameters that separate individual options by ";" >> already (config_acs). Most parameters use ",". No idea what's better >> here, and which separator to use for sizes instead when using "," for >> options. No strong opinion. > > But we have used "," for the purpose "128K,512K:inherit". so here > we have to use ";" for "16K-64K:always;128K,512K:inherit" I know -- I proposed that format -- but I wonder if there is an alternative that would let use use "," in-between options. Staring at various formats in Documentation/admin-guide/kernel-parameters.txt, I'm not able to come up with something "obviously better". -- Cheers, David / dhildenb