From patchwork Fri Jul 26 08:28:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 13742485 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 77169C3DA49 for ; Fri, 26 Jul 2024 08:28:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F38F6B008A; Fri, 26 Jul 2024 04:28:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 07CE26B008C; Fri, 26 Jul 2024 04:28:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5FEE6B0092; Fri, 26 Jul 2024 04:28:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C32206B008A for ; Fri, 26 Jul 2024 04:28:39 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6D50EA1686 for ; Fri, 26 Jul 2024 08:28:39 +0000 (UTC) X-FDA: 82381227558.02.D1F7292 Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) by imf26.hostedemail.com (Postfix) with ESMTP id B0F4E14000E for ; Fri, 26 Jul 2024 08:28:37 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=jWAibEm8; spf=pass (imf26.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.167.172 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721982451; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=abtGZkU53IEdf9pF5Mn1gYdLv8LhNeitOgKX0L25K3M=; b=kKmncHzpVo615YtNHyRY9+um+ir0TvOhs+4D27znQbAtjLKbGYvSBLiXWmW7WYUIgO34cV ARbu51uUMZbAh3zCeQT+4FCw820LK4ndcY0d5B6tmduhr13gsHjHg5CNu4/he9mVPXQ00B uWFR/IjecNTBv0AezoPPgk4SF49E1Yg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=jWAibEm8; spf=pass (imf26.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.167.172 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721982451; a=rsa-sha256; cv=none; b=B96TfRB1uZCpJmVuJVokg3pxs2Y1bI5OPMPICYDQ35eeO9l+02kp4pOnCyccW3LAX9QEpa mr5tSSUasSuyM7df3Oxrc9hYgBS8BRm+/lUO9K2+57zEiRt4WUjGyRDB3ELH42g31MdCp/ Yj5iieOY7rhNEXM4Q5DJwrdHYImcKlI= Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3db130a872fso492562b6e.2 for ; Fri, 26 Jul 2024 01:28:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721982516; x=1722587316; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=abtGZkU53IEdf9pF5Mn1gYdLv8LhNeitOgKX0L25K3M=; b=jWAibEm8e7gbK3aBPdq8x3+QLXCmqZKRT7wUS3ap+PyZaIW/Q+soaYQHuIBdDgvIOL VToMXXVNaWT371zrVYkgISPH4oAMptVFjxxh42jRgA+mRdUSn2o5Zl3E/qghCQ9DK9PU FPo/yIVCdvsBmya8RjRV3XKptRylBWzwT6pACL1wKiRICw1jxCDGu4mDYwo3SN6pEBSp V45EIlt1cVO8cMccZ42JarKPNPFACd0NGBpz8KeX1/Pq8T9dKvdA2CGEd94dsLbAqoWH 1rLp9EaV8lAJpbx+V1eIHCMPuBdqzRzbMxS90288zTRVrY8q+K2gqiXQ1JsvA25pZMse SQDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721982516; x=1722587316; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=abtGZkU53IEdf9pF5Mn1gYdLv8LhNeitOgKX0L25K3M=; b=c6lnvRxmzQBUMpk/zmKDO/vnm3ttJ08wkzz2qRiP8WY/1kBeEv3hIBxQ2EsW+FGF8B m0Bl+LusyKcUrNvW8FVW3mPcLL7X78Z2lMthcUVei/sXQJRykaVEjsImcYJzJo7mwFBn kA60AAv2DcWgY12YlbneyBQ7TUHCAD6+XDDglIjeT5kXPWrBF6iDxsI16v3MyaOnjOMo 8iySHk8KdnUZyqpmf0TgucnlPjoXJHpzGmTsD8wcSsQDMdjH6AQYaUgmnwylv7YY1YPy 88fGXAnMNZSo7+soeo2qrbkIKu+aKeXBMlARo41zkypWmgbF0Omla6ugPJra5oKK5Jb4 sx1Q== X-Forwarded-Encrypted: i=1; AJvYcCWtBroMnOx2Rekw4JLYg6SdeVMpmS90scdAtezisbO0t3BsvN4L099ufZXVJPGhlTssjE+bwuzZCHkt/znmPk+/QoU= X-Gm-Message-State: AOJu0YzDp0ni4j7TjvSyBdfvgOqQRbwgwuGgAaCSGEtQs+MdsFGWqslw zhbdHR633s3jAfxQoAPFLYkAZA1YbF3YIIPv7NvOxnlumuPPxmt4 X-Google-Smtp-Source: AGHT+IGHTxRzIHgio3LdytqhLaYwJofMHIuIKI4DkXJ6UrX1JJ/LJvzCqOQylMu0Zs/IRU1TNcjo1g== X-Received: by 2002:aca:1111:0:b0:3da:a6ce:f017 with SMTP id 5614622812f47-3db1420843bmr4908125b6e.46.1721982516459; Fri, 26 Jul 2024 01:28:36 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7a9f7c71b15sm1968238a12.18.2024.07.26.01.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 01:28:35 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Barry Song , Lance Yang , Ryan Roberts , Baolin Wang , David Hildenbrand , Yang Shi , Zi Yan Subject: [PATCH] mm: huge_memory: don't start_stop_khugepaged for non-PMD THP Date: Fri, 26 Jul 2024 20:28:18 +1200 Message-Id: <20240726082818.260008-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B0F4E14000E X-Stat-Signature: 7nwhywdtnpa56gj4s9c5ukankp4mnhpg X-Rspam-User: X-HE-Tag: 1721982517-795557 X-HE-Meta: U2FsdGVkX1/rvCNyu9abRPFESTJGhDNLMzq9Rg4GIpq2rDOaFe+kekRa55gU0tRz85ywCtcbNtLsJTryV1+MZCQbF6Mfcj35HwpWfNkhKkVyNAAhXfSYKDWOeMzTeQ8v9nxFhjn5l3EDFJAhfouscosSAhEGuTyaY18DK6Ln2Msg6VKjkbImgpoPRicuyN4Re0RALRguy7PVnbfATSnQlARCJ0wef6owz2GxOZsD7mpNIcLeV6hRofEwK/aJijbHSIo6DCSWt5R4UclxejFIc3ACApVM/0CWPEsY7nk6Wyy4whYhuHZpKdTmLLypSIN0AJawCKfy0uPqHAjBDO0WWPLSfSxxBn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0yLqdAGJsWjXzU9tGF6IAiRLSAxGYgi6/ReVrVvMHjRAHr/A1zfBiZkf6Zt6S/JFWzS9p5TH59UlJAyjzihZJMmdHWcY6Mye27SidoQDL5Z6MHPD/fWNeDn7vyyBT9WjtDCojOjI7I5bnwCyv8QnReRt5VIEqu3XqA== 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: From: Barry Song khugepaged will be automatically started when PMD-sized THP is enabled (either of the per-size anon control or the top-level control are set to "always" or "madvise"), and it'll be automatically shutdown when PMD-sized THP is disabled (when both the per-size anon control and the top-level control are "never"). It seems unnecessary to call start_stop_khugepaged() for non-PMD THP, as it would only waste CPU time. Cc: Lance Yang Cc: Ryan Roberts Cc: Baolin Wang Cc: David Hildenbrand Cc: Yang Shi Cc: Zi Yan Signed-off-by: Barry Song --- 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 41460847988c..bd365e35acf7 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -514,7 +514,7 @@ static ssize_t thpsize_enabled_store(struct kobject *kobj, } else ret = -EINVAL; - if (ret > 0) { + if (ret > 0 && order == HPAGE_PMD_ORDER) { int err; err = start_stop_khugepaged();