From patchwork Thu Sep 30 02:14:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Peng X-Patchwork-Id: 12527141 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 44EB6C433F5 for ; Thu, 30 Sep 2021 02:14:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E240F610E6 for ; Thu, 30 Sep 2021 02:14:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E240F610E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 89D4994007B; Wed, 29 Sep 2021 22:14:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84D1794003A; Wed, 29 Sep 2021 22:14:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73C3094007B; Wed, 29 Sep 2021 22:14:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0215.hostedemail.com [216.40.44.215]) by kanga.kvack.org (Postfix) with ESMTP id 63A9E94003A for ; Wed, 29 Sep 2021 22:14:46 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1DE4E183EE7AB for ; Thu, 30 Sep 2021 02:14:46 +0000 (UTC) X-FDA: 78642621372.26.F87C4CC Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com [209.85.222.43]) by imf05.hostedemail.com (Postfix) with ESMTP id CEB2750697CE for ; Thu, 30 Sep 2021 02:14:45 +0000 (UTC) Received: by mail-ua1-f43.google.com with SMTP id r8so3093779uap.0 for ; Wed, 29 Sep 2021 19:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=PpCU8izzOsX7jh4ESnlskYhNOAn/mAiGICctelPlKUY=; b=QngmCQiWOxuHi2o/yq99khW2xyx30dtpLsIo3MyI1O6hIH1ouq+8eJfO/JQRiHf6qp 9foZRZVqzjfHVh2VcKLc0ooCiRbrWeo88I+Ab94SEpU5gn2calyGAfK5o6SAacg4CnM6 sxapphHKAD1iflRfNoJOPK1BdjySpqA0YMGJP/ZiTq53QmLI8sPKRTL8mP5aRgwHqqSe 7Qozq5PB8Pf/vufX0HDyT9nkxwTszyi3mqZQFp9bRtHW9yR3YGLFbJU/Wl4j+Jf54Kfj cuPt3jj4wMgaOwr24jdtbzFHPBvKbvtpkrtogy8W4xCG4uaa/HLPCdU24D5a22pP8cXJ uz8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=PpCU8izzOsX7jh4ESnlskYhNOAn/mAiGICctelPlKUY=; b=3ygP5GK1JeVPkwmOALZaiUt2pIAjG/v0/jkTa4iQn9Zb/E598JjPonO8ByGK3LmvbE LgT0NFA79YlDUBfWJOWcWsiTgLz0ATxdoGDhNNNvv8Mu//YPKYjnso+tux6yKjFagOsp mDEonFj0qHsrAnxKg9gUp7OxtahOH2L34mBTjcPWqpIC7a9inTYhIcbXROgMw733W01q zrsLBEmvt09T7q4ijgG4TZ9zJ0zATgMvxVgXeC4hHEy48sn/E3wU24f2ZL14VG8GS+Jf Nh0HH2GEMGhH4YSbEb5LprgPfrdopCScQqnTGpuXl0JLlM3Mzm/BTGhC8HaW62A/vqng 3ktg== X-Gm-Message-State: AOAM530GuuQIT/sDDgKE5mayUwCo6DjDuuePhG2u+p4RinlukfzXDoFe 7LyMm9UUKXITVc8y0LKCJuw6kAeXeeSALb2iwrQBAiN3MA8PuA== X-Google-Smtp-Source: ABdhPJzddT7HF6KtkIoWqk3VJ0VJAJ1VdGdgGVZ88SLG+HOS5f7g7QsJA/SpfsAj2GbTgJDJ8Oa0QRbmPJ6f1F80he8= X-Received: by 2002:ab0:5bdb:: with SMTP id z27mr3571640uae.67.1632968085165; Wed, 29 Sep 2021 19:14:45 -0700 (PDT) MIME-Version: 1.0 From: Hao Peng Date: Thu, 30 Sep 2021 10:14:15 +0800 Message-ID: Subject: [PATCH] mm/huge_memory: disable thp if thp page size is too large To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: CEB2750697CE X-Stat-Signature: qn5h8pjffyrxd9ihzam7ankw864yk4yo Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=QngmCQiW; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of flyingpenghao@gmail.com designates 209.85.222.43 as permitted sender) smtp.mailfrom=flyingpenghao@gmail.com X-HE-Tag: 1632968085-567086 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000358, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Peng Hao After seting the page size to 64k on ARM64, the supported huge page 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(-) -- 2.27.0 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; }