From patchwork Fri Nov 1 16:38:41 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: 13859595 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 6427DE6F06E for ; Fri, 1 Nov 2024 16:44:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F06CF6B0095; Fri, 1 Nov 2024 12:44:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC11D6B0093; Fri, 1 Nov 2024 12:44:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D31286B0095; Fri, 1 Nov 2024 12:44:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B26526B008C for ; Fri, 1 Nov 2024 12:44:02 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 22E09409F9 for ; Fri, 1 Nov 2024 16:44:02 +0000 (UTC) X-FDA: 82738097736.16.BBC1B5A Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by imf19.hostedemail.com (Postfix) with ESMTP id F1C701A0003 for ; Fri, 1 Nov 2024 16:43:24 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=LGADidNV; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf19.hostedemail.com: domain of mcanal@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=mcanal@igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730479277; a=rsa-sha256; cv=none; b=shN4uIjwwrzNwScwaERq/hBgf2Odprmms1+bdZNVnbu/i/kWuyZMqT9dGDpTOdnl3n43xT jNzyZv8SltqrvkNU6SdFwoZpDCwawGm2MEjYV5g+8b11jrZL5QlNqBSYHIf6YYWSzZYNwI dbaXuQcVxX8nBMtIQEaupK2NAZvm6VM= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=LGADidNV; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf19.hostedemail.com: domain of mcanal@igalia.com designates 178.60.130.6 as permitted sender) smtp.mailfrom=mcanal@igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730479277; 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=IgTr55Xoec7l8zHhjo5z1BNhwtjJf/dOrOaf4emgx7c=; b=Yb7K8LqElF1olMGlfHkn+LV5BnLHDwnHwIW0g2WumtH0U31du9verZatdbTELcSWUG4Lzp wpNyKuGvckJgj4AmbD026/dzXAfhSiwyCNbnl8YF1Va0KpC2xUf7KPZWqGmoZ5B9IMNBe7 Zj3FPn5B8GG4lKEeN+C5GcU+iOKi97g= 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=IgTr55Xoec7l8zHhjo5z1BNhwtjJf/dOrOaf4emgx7c=; b=LGADidNV1if7DgUh/ZSuC06BqG 616TqhMaQ3WUHklId5DX8gfWHxjLeRvHafL4Hhjrl+6zG3rNLW6wwgNvm621J/+vEhpn4wEcv4hwM n8P8qYpNvFfzcccjwHnxeJGp1KtDjrIpkY490E7hqqyJLUt4aKsQ/jwge06qzV1QCg87KCHBMlSCb gBX+Xdub4JUYBaZF+mn+IJ2jMxwhQ90PAshV58SwcB5CofjIC6qiXd0eBxJ2pBEPEH3gcAiqxJtID TcXhyCK6SVaYhYHMTHDsjioGf9xukzVYHQUusfI9x7l83JT3W+NcR3dWFKXXTOis+VMJifUn1IDWa trvR6VzA==; 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 1t6ukY-000V38-4e; Fri, 01 Nov 2024 17:43:50 +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 v4 0/5] mm: add more kernel parameters to control mTHP Date: Fri, 1 Nov 2024 13:38:41 -0300 Message-ID: <20241101164313.1073238-2-mcanal@igalia.com> X-Mailer: git-send-email 2.46.2 MIME-Version: 1.0 X-Stat-Signature: dpohxs7pdus7ca9k8qf5ed1zxm1u977q X-Rspamd-Queue-Id: F1C701A0003 X-Rspamd-Server: rspam08 X-Rspam-User: X-HE-Tag: 1730479404-441471 X-HE-Meta: U2FsdGVkX1/dQPFeE3/0WIsOB1NpL5+0Re747TgMVFRU9GmnAoifr6iFAd46GMEB4hymxYtjD7cl2jgQbTZO++ry84MQZLc7PCY9KmPGlsQfvyv8iUYuFDTIM5/5TkX2Y+WmVa6Bips1y4nBlXgdh7kQThHIqODOIU2fJa5tjHP3aMarZS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a16JSlR1pailH67o/6MQMcUUsm9xwMsTYOYRMjCZ3ozPaZ8M+/XIrXOo598Kzkxju1wEz8RfqMul++MouTivYXy0lmo= 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) 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(-)