Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp307686pxb; Thu, 30 Sep 2021 06:33:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+CvzYXmrEYPl/QJRIztmY48Pj5bxmiuoUZLMpRaUsTYPuvwzWO6c83qROCJEE/E2rVmbt X-Received: by 2002:ac2:51cf:: with SMTP id u15mr5484920lfm.195.1633008817059; Thu, 30 Sep 2021 06:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633008817; cv=none; d=google.com; s=arc-20160816; b=FSMhFeKHsUB8PqaoG9jXcsMnYPhWA0gO1WumgQcmcvmVNNhs5axbqTNwGIkWAlaQyG otkXtrQky7Wkcvoqc0aPcGTVJjd4LTuFnntGCBzGPXi+jaK5i4zP376Gb8kvBqluzbgH 7/HkwiBKGES0GJe1IUmU7ZDKznDf/Wv+FyPjbYMoX9oNclT/IUWo6wiYUNBDInoepttC +8AqimkWjNb7qgDME/++GFhI7jcCfnQf6vlX0D3GWbOQa5etqNzLMZCYTQXmiW7tPznw OJ5EGi8z7IWcn9ATtYpNSBy97xK3dV0ptAJ9KFp4SrGMulMurnjoWyGbxxQyqP65yV7D qO4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=wZv7l8Yj7eNVgmG5QYsyeWS3wzELp5S4do4Vgd3D9xs=; b=z1y6m6mlVH56wWvYXIspvcVBQzyH0Mnuk1l3fp+SKdq7IdbvU5GcKhjthtnheXDmoT Pm7tck+ihWDICWffKFfIcXwkSIk4HLtRTF3YxkC5wSCYknKsOPeh5KOnjjUlzL8yLYU4 Pp/jm6TbaI1ETh2+4gSKQEHNe4wTWNI9h64R3itCtlfw45FBWpf+Y6shpNhO7WEUQXFV +qP2KYaFUmccLUBY7I5Jx53B8nN/1b4x7P92DHXngw5/axz1YrsvgYZtuLmcGruEqdQO YRNX/0xTh6Wy7h518JzxF+PPczExIIv+l84sn6CqPKgz8z5GJbX8L1uUXb38yeyaUr0w C9Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U0epm2Ec; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f4si3544468ejl.218.2021.09.30.06.32.43; Thu, 30 Sep 2021 06:33:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U0epm2Ec; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350758AbhI3NVH (ORCPT + 99 others); Thu, 30 Sep 2021 09:21:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37372 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349722AbhI3NVG (ORCPT ); Thu, 30 Sep 2021 09:21:06 -0400 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-465-54IvbTFuPASv5j_W_K5_wA-1; Thu, 30 Sep 2021 09:19:22 -0400 X-MC-Unique: 54IvbTFuPASv5j_W_K5_wA-1 Received: by mail-wm1-f71.google.com with SMTP id n3-20020a7bcbc3000000b0030b68c4de38so1959013wmi.8 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=YpPw3tvoyaELjt4aJzl2ZX8lMxWraZsF29UEBtF+wYy9+N+iPO1HycU6CmzFaDr3fV Sdkca/4RfmaOoeO5ey/Mrz9iluhoSJoNjrY3sJOVScYJt2qucwnej6I2DbUFAsPq+Frq smqMNP+uR0+i4Z0Pb8G5hzAVvRdGl94UMwAITY+ab2FSef3IYgTlJWa1o/FrgyXK+wnw iyMUFOkTKYx5EhPQKJAJlh9+Gm4epPECJBXyUYO5dNHLu+cWHFeLHffCFWvFisBG8HTw WUGvvUNVx4+p2SywgsnVa/nBrffYv7WzbwGwsQCvK5x5cXBCy5pKswF8oSk031z1F4f/ X/Zg== X-Gm-Message-State: AOAM532PrnbzKP24+XHbUnMuTYplZUz0uRa2OGRL3nmwFLovqsKCl9aO XIBA2Lk0976fMrR/RfG2dF794OybZ0v3Hwkr9fowMvxHVKx6uzqMb9QC7ue1FMjdjpjB0A0BVFQ ZraWeexL4HbCjWLXVIY+rlUJMQhCf9wSLsPJ9Qx/6JMqWL8AsgOiKN0vSU1patwzu22zb4sng X-Received: by 2002:a7b:c390:: with SMTP id s16mr5561199wmj.132.1633007960900; Thu, 30 Sep 2021 06:19:20 -0700 (PDT) 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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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