From patchwork Fri Nov 1 16:54:04 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: 13859614 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 147B1E6F070 for ; Fri, 1 Nov 2024 16:57:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 742886B0095; Fri, 1 Nov 2024 12:57:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CBA36B0096; Fri, 1 Nov 2024 12:57:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 56D326B0098; Fri, 1 Nov 2024 12:57:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 307746B0095 for ; Fri, 1 Nov 2024 12:57:58 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E01371C6CA2 for ; Fri, 1 Nov 2024 16:57:57 +0000 (UTC) X-FDA: 82738132554.23.B8A7890 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf25.hostedemail.com (Postfix) with ESMTP id 94320A0005 for ; Fri, 1 Nov 2024 16:57:35 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=d1cXjxzK; spf=pass (imf25.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=1730480194; 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=QmeuZbhj6lC4GdqAZ3mOlOVzHqfnX+iXpQ+XjcOOq+Y=; b=nt0SfBt8n0qjjpBkxO5k0s2L60xW43Tzjt9XHTan0AZc9zTmIEqckd18PRJimLz6fZpQMX RaMUP+zFD4BmxccmCmfCXWThebqjnCDEmkWy82SksLF75uLMxSRBvzW63bMhHqrdVcl4oj 5FRykLtHd9cJlf8EJR46M8kVVNDXV0U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730480194; a=rsa-sha256; cv=none; b=JATlaUjEluw7NCCP0jE6N3AODvC2C2II41cPDXtjxusSKYDHJSPsnmJWThDajuHu0qMniP UWlIxJKPptM20q/9ALL62ddS0KdXwgIpUV1YZm4PseJmricU1UojfabbSzqPS7Wv4VOdcJ t5X8CZTXslIWrqOTaSAYnIB2YF8ZJ30= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=d1cXjxzK; spf=pass (imf25.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 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=QmeuZbhj6lC4GdqAZ3mOlOVzHqfnX+iXpQ+XjcOOq+Y=; b=d1cXjxzKKBdnY22DrVcOvY8alL sfpQ/8NTFP3a9dpohbtQlkQduFk/c5sUqOAFfYz7W4eUbeI7ouLgHGz9g6si1DWS6tAhtFJFCL6jo J1C0qHwUnL3Hkni5JJyaXBG8i4V1lCLEvoUQ3BpfZK+wAfYHdxBEb4pr1mF8cm7c7g324FkNWSgDu WFXi7i85RR7lGkqsH3KxSwJkNQBmhGRCbqYWPA9ju5P3c6hElOGH42E7KpFxxqVdUAuCcEKMXM7V8 eifJbrDoDUGye4XBp00gzzdtGJuBgLFpJXYpaLIDll8PpILDZ02WJ0c8fCuPK5WVH/e3YZ5VzAvBi 9A5YDWsQ==; 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 1t6uxz-000VPu-9o; Fri, 01 Nov 2024 17:57:44 +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, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, =?utf-8?q?Ma=C3=ADra_Canal?= Subject: [PATCH v5 0/5] mm: add more kernel parameters to control mTHP Date: Fri, 1 Nov 2024 13:54:04 -0300 Message-ID: <20241101165719.1074234-2-mcanal@igalia.com> X-Mailer: git-send-email 2.46.2 MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Stat-Signature: s7kdnahiqg7dufx4pd7gaq3osjroa5nj X-Rspamd-Queue-Id: 94320A0005 X-Rspam-User: X-HE-Tag: 1730480255-880446 X-HE-Meta: U2FsdGVkX184wuW/QklElSsNZX/RVnuzcRoY3UUxqrJcaAjyawdn2Oxp81KxU/Ct8OAMg4Jqok3HJvKxUuLM64DVY0fo0loJCjdgOidSn0oG9EHUt+WLsgNQLPkYHmwDsrfnZ5TShLEPsAOtepicGom+EwvrPBZkx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+0hONzdjqF4Us0KIayNSNW0QEe3aNqIgzfgv9c/fmEw48fYmBimusqKey1+BsTwmw8P9NbQx7yNJQ+id6F37DtHkp4A7mW4hVjeBU+BAHAGceS+9V1FXPHc= 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 four patches related to the kernel parameters controlling mTHP and a fifth 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, third, and fourth 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 moves a piece of code to a shared header to ease the implementation of the fourth patch. Finally, the fourth 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()" v3 -> v4: https://lore.kernel.org/linux-mm/20241030130308.1066299-1-mcanal@igalia.com/T/ * [2/5] Improve commit message by including details about the use of the kernel parameter (Andrew Morton) * [2/5] Add Baolin's R-b to PATCH 2/5 (Baolin Wang) * [2/5] Add David's R-b to PATCH 2/5 (David Hildenbrand) * [3/5] New PATCH: "mm: move ``get_order_from_str()`` to internal.h" (Barry Song & David Hildenbrand) * [4/5] Improve commit message by including details about the use of the kernel parameter (Andrew Morton) * [5/5] Add Lance's R-b to PATCH 5/5 (Lance Yang) v4 -> v5: https://lore.kernel.org/linux-mm/20241101164313.1073238-2-mcanal@igalia.com/T/ * [3/5] Don't use personal e-mail address (Maíra Canal) Best Regards, - Maíra Maíra Canal (5): mm: fix docs for the kernel parameter ``thp_anon=`` mm: shmem: control THP support through the kernel command line mm: move ``get_order_from_str()`` to internal.h 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 | 42 ++--- mm/internal.h | 22 +++ mm/shmem.c | 177 +++++++++++++++--- 5 files changed, 234 insertions(+), 51 deletions(-)