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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65A85C433EF for ; Thu, 30 Sep 2021 13:19:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F196E6187A for ; Thu, 30 Sep 2021 13:19:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F196E6187A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 34A4A94009F; Thu, 30 Sep 2021 09:19:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A22794003A; Thu, 30 Sep 2021 09:19:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 429A694009F; Thu, 30 Sep 2021 09:19:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id F3B7B94003A for ; Thu, 30 Sep 2021 09:19:24 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 80DC9181C9B9F for ; Thu, 30 Sep 2021 13:19:24 +0000 (UTC) X-FDA: 78644296248.36.1D335B6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 24B91B00081F for ; Thu, 30 Sep 2021 13:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633007963; 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; bh=wZv7l8Yj7eNVgmG5QYsyeWS3wzELp5S4do4Vgd3D9xs=; b=U0epm2Ecs6dejpYGATzuv21VbX4ThWsWtrisT4uk4SKJOjQeMx7YSnqSG6PvQ79iUL1BqY 8baab0uSViqzWyOb+dt+GlueS0QCt8au37sulsLkOfnrtvc7avK+y+PpiLgyNDdot/ksd/ CqlDJnl1e/QgEdxnlWJj1PvOnVOQNbg= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-291-q_GuO75PNTSosVjxbAgNXA-1; Thu, 30 Sep 2021 09:19:22 -0400 X-MC-Unique: q_GuO75PNTSosVjxbAgNXA-1 Received: by mail-wm1-f71.google.com with SMTP id 129-20020a1c1987000000b0030cd1616fbfso4323375wmz.3 for ; Thu, 30 Sep 2021 06:19:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wZv7l8Yj7eNVgmG5QYsyeWS3wzELp5S4do4Vgd3D9xs=; b=ouYzWJ/ep/Ygoee/ERdaTDdNp/NYcqgbMK/O4lqt7moavRVvEw9HWTJYupVSVuePSL MMzEYtpeeHEkD8EKodd0BhmMqQvjd7kMBM2Oy2DJSew2JLmCCr5vkQOQvFK01wG4Jgvm ooMZoyotYphlS05fGdy4EkIP+6BYjfF8N7f/MeWEg0pV31tubsuXop1Mr3CsRDcq44/Y S6LtaxJnuIs+n6E8TBKikns34o2+xdK0dvyUp7j9MYwn0br2zIzOAOaWmVbYrvw0y5hk d+4nuPv8kWHSaqY+AeB1UglVh5nDAGoVQt1FcavuIbT5wK2DtY02hQPMBqzwzn/yXu1D MiAw== X-Gm-Message-State: AOAM531gVIuK/THZO02j7/tdh3y9M0cQv31yJG8Uh+fVBZeWof/bo/Jr RWGjnga62SigEVLJ7Afe6Y/9EVuM61zDhhqji3kU7/ja8Z4ki0P9gc3sh1ntIL9Zz6fqIgY3XSx dnVQxhqolj+w= X-Received: by 2002:a7b:c390:: with SMTP id s16mr5561195wmj.132.1633007960867; Thu, 30 Sep 2021 06:19:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweMNF0ciSceHxW1rW4G/Bm5Qh/3jTzpjv5D10NKVFHLsnKvjJiTzkjXwSkUeby5zMoR5Y+7Q== X-Received: by 2002:a7b:c390:: with SMTP id s16mr5561161wmj.132.1633007960566; Thu, 30 Sep 2021 06:19:20 -0700 (PDT) Received: from [192.168.3.132] (p5b0c64bb.dip0.t-ipconnect.de. [91.12.100.187]) by smtp.gmail.com with ESMTPSA id s13sm4842678wmc.47.2021.09.30.06.19.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Sep 2021 06:19:20 -0700 (PDT) Subject: Re: [PATCH] mm/huge_memory: disable thp if thp page size is too large To: Hao Peng , akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: From: David Hildenbrand Organization: Red Hat Message-ID: <914a0b38-cb44-f4be-43aa-bc42bee1553b@redhat.com> Date: Thu, 30 Sep 2021 15:19:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 24B91B00081F X-Stat-Signature: z445n7dn5q7afa1kr11uce14qfqqbget Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=U0epm2Ec; spf=none (imf24.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1633007963-484295 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: On 30.09.21 04:14, Hao Peng wrote: > From: Peng Hao "disable thp if thp page size is too large" you disable thp if there is not sufficient memory installed in the system (and for that, you use THP size), something doesn't add up here. > > After seting the page size to 64k on ARM64, the supported huge page s/seting/setting/ Fortunately, most distributions already switched to 4k, because 512MB THP is pretty much useless, especially on any system that doesn't have memory in the range of hundreds of megabytes or terrabytes. > size is 512M and 1TB. Therefore, if the thp is enabled, the size > of the thp is 512M. In this case, min_free_kbytes will be too large. > > On an arm64 server with 64G memory, the page size is 64k, with thp > enabled. > cat /proc/sys/vm/min_free_kbytes > 3335104 > > Therefore, when judging whether to enable thp by default, consider > the size of thp. > > Signed-off-by: Peng Hao > --- > mm/huge_memory.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 5e9ef0fc261e..03c7f571b3ae 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -437,7 +437,7 @@ static int __init hugepage_init(void) > * where the extra memory used could hurt more than TLB overhead > * is likely to save. The admin can still enable it through /sys. > */ > - if (totalram_pages() < (512 << (20 - PAGE_SHIFT))) { > + if (totalram_pages() < (512 << (HPAGE_PMD_SHIFT - PAGE_SHIFT))) { > transparent_hugepage_flags = 0; > return 0; > } > -- > 2.27.0 > -- Thanks, David / dhildenb