From patchwork Fri Apr 14 13:02:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13211452 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 25CDDC77B6E for ; Fri, 14 Apr 2023 13:03:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6E7C96B0072; Fri, 14 Apr 2023 09:03:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 671266B0075; Fri, 14 Apr 2023 09:03:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 512976B0078; Fri, 14 Apr 2023 09:03:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3DADB6B0072 for ; Fri, 14 Apr 2023 09:03:23 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 02D4EAB196 for ; Fri, 14 Apr 2023 13:03:22 +0000 (UTC) X-FDA: 80680012686.16.4DC924C Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf01.hostedemail.com (Postfix) with ESMTP id 5AF4340034 for ; Fri, 14 Apr 2023 13:03:21 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681477401; a=rsa-sha256; cv=none; b=QjUEuq1dYGDuW7EKkKjajxbvRjriH04O1lzMDMzF98slxFSj/GzbBzSofxjuKfLBfX9zxX 9rrzgmz2fSHO01BDIMblgCNcEGeNnNFGguMy4vjdj3/oZ/2vf9ObImryBSOXm9w5I9tvKd 9bulZdHiEMAaOnoiVt3NZxmYxcUUN+U= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681477401; 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:in-reply-to:references:references; bh=+ln19MuwFthPsjVfctwgB3ISLmY5ZZJ5oHYy8WbqKKQ=; b=Oa6NnB0FntLsOv3uQpEtTJJqSw1B4GFoTuHhDQtfvlUxIAcX9nbYrTZ/hjlR2eF6oh4Hbu 611/rP8GCRYxZ0Hr+qKCcrOIHXJBY88jbexe7b/ufhBjeBOv8n2KmsjUwR4Fa4KVeckbDJ UqOWEBS/27Zm3GxUuzIt0yZMdsIoJT4= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D119D4B3; Fri, 14 Apr 2023 06:04:04 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5881F3F6C4; Fri, 14 Apr 2023 06:03:19 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , "Matthew Wilcox (Oracle)" , Yu Zhao , "Yin, Fengwei" Cc: Ryan Roberts , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: [RFC v2 PATCH 01/17] mm: Expose clear_huge_page() unconditionally Date: Fri, 14 Apr 2023 14:02:47 +0100 Message-Id: <20230414130303.2345383-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230414130303.2345383-1-ryan.roberts@arm.com> References: <20230414130303.2345383-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 5AF4340034 X-Rspamd-Server: rspam01 X-Stat-Signature: yg3354635t9mfaap9d3bynw3hd8p6kn5 X-HE-Tag: 1681477401-493515 X-HE-Meta: U2FsdGVkX1+CfF5fVCjfrU4tAC+pY/oGqcVDYI/Or9ZVMbgQkpH/QpP+DUYbtxGGeKl2yBRampopOr/pgQU68oHUl/NJdE4DVZ3CQRGGGaxdpl329YiT5+yeqsZRGZJKuM0DrgUHzfr9P5oTaUdY2C/0g9Glyr9yP2uHApOv7SsGMRd6/9FzKk2bmyi3T084b81kDwydlcvDMV0G93afRLpQ7aB9g9oY+6mu15WKTzpfS0BSMR+G6903FpdsC63yJeyI+Z5sxlikU/VG+bbCVO1w3bETsbK0gq3+J4tggqwBE0Vz1hMa45gA/0A4mj8MATyKCVfFi4XywiDLlSppuVTHgYQ0yDSfRrWnxYd1XGA+fM6irm3tII1+Q22VZNpYgXZ70SRBGDZtZqlMpHQQhyU4HyGr96yp6dBHGnutEv4t0H1ZzdBoF/iSplj6KW2cCJzFo7JzUIIhzqe6ValDxs6brHdXFudhpYrbcqHEeS+Z8KwDiqhtArWTJmnIrCbfTstVQS14KUXpLvXMhtXzibtXJvOGQi4j1677+/n7se1fRFH25rYJzeENBlWB60c1RtYHAsYU7AvpRLOh0Slg7Bg+aD39mY4If4irEMQwZCgJC88ItrSZQZMGF12Szl91/3Sj+VAMZaipkdNEZ3v64wl31tQehiox2amKTlSNAjTGUMQowlNd15F+0pScWQsehF+swNxLrDR1Mm6v2gg/r8pqyMAe4MLUUiwAWjjTwc6FVIO2q55xt64KOnvhrpD7ktcdJ5KITtFQe3LiSwrRraPKhI2kfaXxDtntubLZ8zwPVTyi4MrksxguvJi9qbMiq7P5u6+kHp9MHoEJ9rlkA/W5uwj7Q9maYs1ZfedEjr9SOaQWwA9f5R1NhFbPspbsbFMbxe44e9qGkBvfeP9ROAD9hgzy3buJySbGt9i3A6YVoxO+SNtBwsUaEeLu11wSjHbzfxpmHLEm7PAUobp bz7XI6UL yVoCT4F6eiTFoYJsyph0nTPSBj2JsFXJXxNOp07bu+MLKyBLYrRwltRrUQs+N8PILKsrkCAGKB6mGgkCrAK6hg1jVHSKo4odgh43HywZx869FV9uRgIRRpdVRyP8jJxi3h1xICQXB3I20MAgJqwOA1yI8rNHu1bk3cyxxlW3jp2lpKQhemXN7NKNVp0w/yk6QHxg4oEmZIQV2MXkxnE/8ukXAcLZtsciCjWzM 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: In preparation for extending vma_alloc_zeroed_movable_folio() to allocate a arbitrary order folio, expose clear_huge_page() unconditionally, so that it can be used to zero the allocated folio. Signed-off-by: Ryan Roberts --- include/linux/mm.h | 3 ++- mm/memory.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/include/linux/mm.h b/include/linux/mm.h index 1f79667824eb..cdb8c6031d0f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3538,10 +3538,11 @@ enum mf_action_page_type { */ extern const struct attribute_group memory_failure_attr_group; -#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS) extern void clear_huge_page(struct page *page, unsigned long addr_hint, unsigned int pages_per_huge_page); + +#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS) extern void copy_user_huge_page(struct page *dst, struct page *src, unsigned long addr_hint, struct vm_area_struct *vma, diff --git a/mm/memory.c b/mm/memory.c index 01a23ad48a04..3e2eee8c66a7 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5642,7 +5642,6 @@ void __might_fault(const char *file, int line) EXPORT_SYMBOL(__might_fault); #endif -#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS) /* * Process all subpages of the specified huge page with the specified * operation. The target subpage will be processed last to keep its @@ -5730,6 +5729,8 @@ void clear_huge_page(struct page *page, process_huge_page(addr_hint, pages_per_huge_page, clear_subpage, page); } +#if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS) + static void copy_user_gigantic_page(struct page *dst, struct page *src, unsigned long addr, struct vm_area_struct *vma,