From patchwork Wed Oct 30 12:58:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13856487 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 158F3D5CCAA for ; Wed, 30 Oct 2024 13:03:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 891166B00BD; Wed, 30 Oct 2024 09:03:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 841446B00BF; Wed, 30 Oct 2024 09:03:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7303A6B00C1; Wed, 30 Oct 2024 09:03:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 528956B00BD for ; Wed, 30 Oct 2024 09:03:54 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CCCC080389 for ; Wed, 30 Oct 2024 13:03:53 +0000 (UTC) X-FDA: 82730285442.18.D9BAD8E Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf22.hostedemail.com (Postfix) with ESMTP id DD79AC001D for ; Wed, 30 Oct 2024 13:03:19 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b="MjApR5/R"; spf=pass (imf22.hostedemail.com: domain of mcanal@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=mcanal@igalia.com; dmarc=pass (policy=none) header.from=igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730293377; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=JzDmzOGqmP2VU6V0H6Y8GpYlaNtoAgTzprRQuVfXuqc=; b=20s5qxDJYzFRcl3pYmZu/Gy/kwLQSW8eTdkPInCk5CEOtGzz/vpWRFZ7UH/o120kRQ6kzI ECz1ZnsXWtugVC6/9J8mcg3Vt4dXnoATUn5TyO76oO7PbK0HeXEQxYVQlvK4uPeKen603H kYJlyDh7e0DUdD8bS8dvn0s1AIfbb3A= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b="MjApR5/R"; spf=pass (imf22.hostedemail.com: domain of mcanal@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=mcanal@igalia.com; dmarc=pass (policy=none) header.from=igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730293377; a=rsa-sha256; cv=none; b=Ucq3jFhPnsHDyAm1kHfXiewxG0bAFWpmzjZS6p7HRAbRkTkCkQJFxt61dHPdx8lgb+oFYI LHFtGge+F8OyzTgJ/TrdcbmxWWWoFtcMMDuXmIL+b6hAQXHDGrGRQkv9bvgBeInzJ56YoG BDzo2+2Q+HkqWm7FICG2wpEZIV3+e1U= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=JzDmzOGqmP2VU6V0H6Y8GpYlaNtoAgTzprRQuVfXuqc=; b=MjApR5/RVHg5aIEtDNvquzCRxB vsqqCKiJhg1CAV23sasMNzlGuaEj355fZ+VHNY0B4fZd3ti2+iYEFVaA99C7mIK74BUz23SJEQoAR 0mNuwk1agbJ8nPBRxRKNk7z+e33vhx+ONpHqH8Wl/1Z8q3QDBBJtuwpAjD4Z9kYjU+xdtcpcJQnfX w0obD7vVvhrEZK8rFor8tPUoWjmuEm63Y8avfDOa1A3qKGA4bVwTQymYGH6G085TXqxxT9yb6x8/T O7h8f2cxlnBfk2TlyQ7NrJHi9l6/9b3rlT2/zp0okv+eBFERSlI3gb/C5Y614mFwlDx/397opTTit m/9/fvDg==; Received: from [187.36.213.55] (helo=morissey..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1t68MD-00H5h8-9J; Wed, 30 Oct 2024 14:03:29 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: Jonathan Corbet , Andrew Morton , Hugh Dickins , Barry Song , David Hildenbrand , Ryan Roberts , Baolin Wang , Lance Yang Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, =?utf-8?q?Ma=C3=ADra_C?= =?utf-8?q?anal?= Subject: [PATCH v3 0/4] mm: add more kernel parameters to control mTHP Date: Wed, 30 Oct 2024 09:58:54 -0300 Message-ID: <20241030130308.1066299-1-mcanal@igalia.com> X-Mailer: git-send-email 2.46.2 MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 96ejf456stn1fwtcsxh7t7jusnx71ty5 X-Rspamd-Queue-Id: DD79AC001D X-Rspamd-Server: rspam11 X-HE-Tag: 1730293399-452394 X-HE-Meta: U2FsdGVkX1/3afpNii+m2DOxwOJZ3jR1o1t87YY5sj+ew1A9z+klugEWCn/XNk1BONzTE9nXOi0VAPkXzc+AYtRyfOmUQ//oPVYHQtvCyf3S6ngOtGDL64DAkomlIUVRvHTXL3EnIOHVnkoAvgfHNwePYLFcWP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OjVc8VeoqpLNsrEqf5Bi9rbumU6PwWKp2C3E0RRhWSog1ouztPyB7HtONOSsVQZi8n0MBWef/O0mR4+P+JmDJDO5tLeLzOh8TgTVGpBctpgM= 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: This series introduces three patches related to the kernel parameters controlling mTHP and a fourth patch replacing `strcpy()` for `strscpy()` in the file `mm/huge_memory.c`. The first patch is a straightforward documentation update, correcting the format of the kernel parameter ``thp_anon=``. The second and third patches focus on controlling THP support for shmem via the kernel command line. The second patch introduces a parameter to control the global default huge page allocation policy for the internal shmem mount. The third patch implements a parameter similar to ``thp_anon=``, but for shmem. The goal of these changes is to simplify the configuration of systems that rely on mTHP support for shmem. For instance, a platform with a GPU that benefits from huge pages may want to enable huge pages for shmem. Having these kernel parameters streamlines the configuration process and ensures consistency across setups. Let me know your thoughts. v1 -> v2: https://lore.kernel.org/linux-mm/20241027175743.1056710-1-mcanal@igalia.com/T/ * [1/3] s/fix the format/fix the doc in the commit's subject (Barry Song & David Hildenbrand) * [1/3] Add Barry's A-b to PATCH 1/3 (Barry Song) * [1/3] s/64KB/64K (David Hildenbrand) * [1/3] Add David's A-b to PATCH 1/3 (David Hildenbrand) * [2/3] Create the function `shmem_valid_huge()` to reduce code-duplication (Baolin Wang) * [3/4] New PATCH: generalize the function `setup_thp_anon()` and add it to common file * [4/4] Fix typo in the documentation: s/shmem_anon/thp_shmem (Barry Song) * [4/4] Reduce code-duplication (Barry Song) v2 -> v3: https://lore.kernel.org/linux-mm/20241029002324.1062723-1-mcanal@igalia.com/T/ * [2/4] Apply Wang's suggestion (Baolin Wang) * [3/4] Delete PATCH 3/4 from v2 and implement ``thp_shmem=`` just like in v1 (Barry Song) * [4/4] New PATCH: "mm: huge_memory: Use strscpy() instead of strcpy()" Best Regards, - Maíra Maíra Canal (4): mm: fix docs for the kernel parameter ``thp_anon=`` mm: shmem: control THP support through the kernel command line mm: shmem: override mTHP shmem default with a kernel parameter mm: huge_memory: Use strscpy() instead of strcpy() .../admin-guide/kernel-parameters.txt | 19 +- Documentation/admin-guide/mm/transhuge.rst | 25 ++- mm/huge_memory.c | 4 +- mm/shmem.c | 181 +++++++++++++++--- 4 files changed, 201 insertions(+), 28 deletions(-)