From patchwork Fri Mar 17 10:57:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13178877 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 94199C6FD1D for ; Fri, 17 Mar 2023 10:58:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 09BCF6B0078; Fri, 17 Mar 2023 06:58:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F17516B007B; Fri, 17 Mar 2023 06:58:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DDF056B007E; Fri, 17 Mar 2023 06:58:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D02A56B0078 for ; Fri, 17 Mar 2023 06:58:24 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A05FD8183D for ; Fri, 17 Mar 2023 10:58:24 +0000 (UTC) X-FDA: 80578091328.19.8CAA74D Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 008EC16000A for ; Fri, 17 Mar 2023 10:58:22 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679050703; 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=rXVqB0ZsfllNiDoZhurNV3aR20+gMc/UXYF4nAJ7SiE=; b=PEKqeIr9B+eVTZWY5xZcsVH7N4YmHD5yoWrJ6yCa97m7FMtqYIP312lGGQEIhiatmYCGRe BZCZdGWxzfsoZ+qNvg7x8vNIY8tZm6R0EsC4GFOp7iz8ixrR5q23808E7Ea7cGbalscy6B jlyEC/3GnTojShh5iwpmSolLLllG4yg= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679050703; a=rsa-sha256; cv=none; b=dgJzY2wgHLldtg8v0VQsv87H2hh5XUOFqTvFfutIcDjQqaH1UvUG3RWFIyjshxcVZyAj4b 2O458EkWGqSTbbH0UB1b9oG0DLLFfHsJlM+grUHQBY33ElsFLzX4vZI8FHyyt+DJZk3gGH yeXksJa6NrhsYZob6B6PEuiKlxBXoNs= 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 D83851763; Fri, 17 Mar 2023 03:59:05 -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 1DD5F3F885; Fri, 17 Mar 2023 03:58:21 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , "Matthew Wilcox (Oracle)" , "Yin, Fengwei" , Yu Zhao Cc: Ryan Roberts , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 1/6] mm: Expose clear_huge_page() unconditionally Date: Fri, 17 Mar 2023 10:57:57 +0000 Message-Id: <20230317105802.2634004-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230317105802.2634004-1-ryan.roberts@arm.com> References: <20230317105802.2634004-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 008EC16000A X-Stat-Signature: bn7rgcf14i5qo5u9egpqiw96hebqwcds X-HE-Tag: 1679050702-861763 X-HE-Meta: U2FsdGVkX1/L6N8mcBm21EhvaFzSrLSX9qvX3ycJBOtoZlbZSy1fYAU3Qme4eEZfEKrFt7jsQFU4lkWNMRM8Lqzmpa8MeMevfcywwuCqC6SCfYLkwnovJoPGZ6TfH+EwAKBuA2xRuz3cAvWhui9hlCoRyldUcaPN+mgqTCv/ZIhFjw7qmhW8mG/jSWaYiYT+Zq+mmKOoZwZERYKvI44K0Bhf0XiePmAjNlk+Rt9/j0G9CZzFkxV06jyp5CIOOvuVwGAJN/GGVJ3Arkb3ZCEoGcwr8SSEh/3pWqztoUMdWosgsvNeUj1rJ8lOQOQYuBWoYk+IotJAurylQnEQaeTJ63LG7T0o5yaf4Avac1YpxKnHWq11dd8FjNf53VxrXKpchtYApwdm1FZYTrZPl/HioMaA3ewuPTPbayfOnKnyD8yL5Jhm/TeI45ibrjyfVqa/kSCgCf7XkPnBz+xj7AvBwYKnN/w69sMRbgHVCZuVp/i8ir+UtWzPioS1shoNYiKksdr6VNPexu4PqeKvbYHxkNRcPhK1Gf8z1b18no9y3QHVqLErVe34lt29nvMc2yN/TwnzZlJBqxN87jVL5wR6T2DotmXlf86IKJ4IMH6dsGnqa5bsfWZ+07m4ZIZO/HJvx4AQbSdsPlcsBGvrHLsjIqzzwtLLDO9iSrKW/sLqliPw6vdVU9u9r3p11CbfCTQ8AKnyHQkV6pCLESMs7EXQAkCV3cxYRz56fk56qROeu4184h0ZKhOYijEK8cgGxD0E+M1vQM7Trp8OYrsOlEq9hi+QhcTz7HB/atxHcI6ICDxlIjeHzyuqF5pr6uNO5ntmVIbyfMIKXGNJdGZC/KHOeQQFapGrI6jMuFNmsXLJFnnzBcZoNE71+EhfTJdO/xn6kz94Ha4z8DO7AIHBP3IVH0N6Y51HvCU9U+WF8SUYU7GPUOzbMyQfp2D1zVj+eXUu8XjTBrxY72HSVVOi0N1 6/C07l8A W2Hw2srgwiniNFDnO+yCxFXGycW9MCeQaDvgw7Yrxo4KgGHEd0ceJ1lSbC/4XlAh5R+oQjVYuRNbDDt6sZgSv1xz/SAWcjRq9o5Qfg5ULG5LEjhUknT6RQSR+hMA/D8GafuD4CZoz5MOGBDsM9EjrP6pLVeqVSbCPYCipNnAt2raDmJG6oDe70O5E5NljAuBT+B1s3akIvpPw30blSusse7+Fd/3yUSEP++6I 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 f456f3b5049c..c08645908ee2 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5628,7 +5628,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 @@ -5716,6 +5715,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,