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: 13859601 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6DD7FE6F06C for ; Fri, 1 Nov 2024 16:44:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C20E10E066; Fri, 1 Nov 2024 16:44:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="LGADidNV"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0AC8610E066 for ; Fri, 1 Nov 2024 16:44:01 +0000 (UTC) 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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(-)