From patchwork Wed Nov 30 08:51:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ye.xingchen@zte.com.cn X-Patchwork-Id: 27693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp812067wrr; Wed, 30 Nov 2022 01:06:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf5DWWxUZJ/62PF7skpgEg42/F40oR5BFEt+c9eJaSW8kZTPStPiS6BBIUJNPsThCMPSoxfQ X-Received: by 2002:a17:90a:a381:b0:218:6dc3:55b8 with SMTP id x1-20020a17090aa38100b002186dc355b8mr63863897pjp.189.1669799181721; Wed, 30 Nov 2022 01:06:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669799181; cv=none; d=google.com; s=arc-20160816; b=Lw0qJXHYlchD74oeH+Y+8VFqN9/HuHVZyMFxUs4tvr4cm1tdfPcCZ0KDfqIm+LCQnz nh1Q+DDwRBzT3UBihGzkrSZE9O+W4G7767MlUgqpIsXrb7/REUQWCXeZAuvW5ujsLbOE 4cSPJdbsGH2OqyUST0SjOnY1axo6Kda7L+wLOtWAQJgmyp9Moo1pYSwx03w/Pgtmmj6t lzaQPUqEMOnbJ5dYmPzBSw95Wl4bXoZbErs30hBhrySsvUW+letpEm27MMpg932fLi4Y pLACFO5c+O2G2DIt6fq7qGkR/KaedXpk5UbJrG5TD+DcGHcFapr4xyvT84wscPwarZKN BZKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=JbVa1kdd5KXF06GR11c4r6n/ipR/si/DXCuBwcPORkY=; b=hSYyrCwVFHJB5cjdykDMQdtlHkQW12JfyRapCyV2ZmjOWz/LcYUIZfOWW7FhhWE9W/ cje83DD4R7vW8fZdVc+OyZaxo/97/zMapoESb+W3AcV9zxugVumXNGAYcDdjdXs92fuf DFCXOm4dJiZZUAP8olio5B033ZBiGLRq77AoFfDuDzqPqo0E3Nrn1fHpBLQRtXTpuuhT jFdcK0sHow0+O913NCHT+cPBSbZlphhNH0AO3nDwuVxEKgdL/98dbAdflZareVH7NUW8 8gk/+FsMLllapl/8goWJEzAqZP8/1UyvZjtdnaOSt9crVMwk79WaRhYVko03oyi8yMA9 r3oA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a056a00178500b00574a6ee885dsi1291466pfg.3.2022.11.30.01.05.55; Wed, 30 Nov 2022 01:06:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235493AbiK3IwM (ORCPT + 99 others); Wed, 30 Nov 2022 03:52:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235584AbiK3Iv6 (ORCPT ); Wed, 30 Nov 2022 03:51:58 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E022C2C12B for ; Wed, 30 Nov 2022 00:51:57 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NMXy34ZBbz8RV7J; Wed, 30 Nov 2022 16:51:55 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2AU8piTn089749; Wed, 30 Nov 2022 16:51:44 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Wed, 30 Nov 2022 16:51:46 +0800 (CST) Date: Wed, 30 Nov 2022 16:51:46 +0800 (CST) X-Zmail-TransId: 2af9638719a2ffffffffbbbdd223 X-Mailer: Zmail v1.0 Message-ID: <202211301651462590168@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , Subject: =?utf-8?q?=5BPATCH=5D_mm/huge=5Fmemory=3A_add_TRANSPARENT=5FHUGEPAG?= =?utf-8?q?E=5FNEVER_for_THP?= X-MAIL: mse-fl2.zte.com.cn 2AU8piTn089749 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 638719AB.001 by FangMail milter! X-FangMail-Envelope: 1669798315/4NMXy34ZBbz8RV7J/638719AB.001/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 638719AB.001/4NMXy34ZBbz8RV7J X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750911346486588146?= X-GMAIL-MSGID: =?utf-8?q?1750911346486588146?= From: ye xingchen Sometimes we may need the /sys/kernel/mm/transparent_hugepage/enabled to default as [never] at the first time. Signed-off-by: ye xingchen --- mm/Kconfig | 5 +++++ mm/huge_memory.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index ff7b209dec05..ded8c1da6267 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -797,6 +797,11 @@ choice madvise(MADV_HUGEPAGE) but it won't risk to increase the memory footprint of applications without a guaranteed benefit. + + config TRANSPARENT_HUGEPAGE_NEVER + bool "never" + help + Disabling Transparent Hugepage. endchoice config THP_SWAP diff --git a/mm/huge_memory.c b/mm/huge_memory.c index c0c57828110d..3571417aa70a 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -60,6 +60,8 @@ unsigned long transparent_hugepage_flags __read_mostly = #endif #ifdef CONFIG_TRANSPARENT_HUGEPAGE_MADVISE (1<