From patchwork Mon Jun 26 17:14:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13293230 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 21F61EB64DA for ; Mon, 26 Jun 2023 17:14:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 941E88D0006; Mon, 26 Jun 2023 13:14:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CBDF8D0001; Mon, 26 Jun 2023 13:14:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E1068D0006; Mon, 26 Jun 2023 13:14:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 701EF8D0001 for ; Mon, 26 Jun 2023 13:14:47 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F17A0140216 for ; Mon, 26 Jun 2023 17:14:46 +0000 (UTC) X-FDA: 80945548572.16.F0BB77D Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf17.hostedemail.com (Postfix) with ESMTP id 13E9540033 for ; Mon, 26 Jun 2023 17:14:44 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; spf=pass (imf17.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=1687799685; 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=zeQagWoBaXA3rXEOQANZ4Snh6DOQHHPxdX/QvLLvgp4=; b=bOVeSl3zRdRz7bRwdK4fhIkc2O3ImpAUG9iiomPXJqLk29PKASBRaPi441Jsjsn8/DE6IF AaHP+aOqILrakEfXOx1LXil2HuqvkcAG/KkqErbqRtmKeNPMafh9y34D4+14I7MfmpEqp+ UjylVEWQZpPOkTkGbj9U5evncyAS3Uw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687799685; a=rsa-sha256; cv=none; b=O3ES0rUk9/n2MXFoyVg0SUkrwUMHAU0gc4N/ACbD/r5BCVUoavXNauHCZxw7EFoq8BCs2r byECT5jlVgXOYxeysbb5Y6ySao23Wom2g6EV94vE432D/ZMMwrTLklYU8lzZQ823dHZ0F9 /+0rPc9QNPBy6SOGHT4l4/soJm4PE4c= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; spf=pass (imf17.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 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 31D9613D5; Mon, 26 Jun 2023 10:15:28 -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 484F93F663; Mon, 26 Jun 2023 10:14:41 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-s390@vger.kernel.org Subject: [PATCH v1 01/10] mm: Expose clear_huge_page() unconditionally Date: Mon, 26 Jun 2023 18:14:21 +0100 Message-Id: <20230626171430.3167004-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626171430.3167004-1-ryan.roberts@arm.com> References: <20230626171430.3167004-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Stat-Signature: 34b57wjndd6zr4o9grxi14fss1oaeeoi X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 13E9540033 X-Rspam-User: X-HE-Tag: 1687799684-29020 X-HE-Meta: U2FsdGVkX18PNKv7V+75DVg3FwY9CvxnDzhmy6GbsBNRfafUZATgwKnoM+fVsQ6umeevj/FZ+qrPw02tOIfRDdrbUTaMdaSWNBDlgQVZSalBOKYwjW77RVkuoK2r9ipSqdA3UKUJVaYoxxWmeCKpkO9I1XVyB0iaPikxRHb2w5C2evEYnL/z5zJebR6XZWSedZ6aOUrvYhGZUr/XyVvthvZLCPj9X469g8LoP7TrTFQfcsfMObql6FJ3A7gng+xtaIm1Ql9CYFy1z9HEZrNIImtaPeMoJaJzB8vG07LcUqI9iSJ5g/cKMbqL69eO4/Ee06+zwIngfhLrrWKGHMhgn6EiOmSqaqPUopNPmkn7hLzmC4x+cedkRCTLROl2m7lRknPNAYhwf9Iq2n8xxLul3qK07syjHEZbhwV3tl1t8Xw+n86zkHOSCX6gQ9FDKc7FmHnQ+mtrbb/pU3A49CwTZ856ezKiEge5to9G6gkjvZ2fiEUCm5wlDxRKFKfCiRXGE2kC/a5Q92hSDojQR0DjptrSwrnpwFmovylZsjqpJYuf8UAjfltUIGdcMnrJWllFmaS6bwZA6eSLDtdiDN0a3Z6SWccqEFRJ3YD07DyA5yKTU9SvYgNg/9qxM3gPBE+uBqRg+CoT3F63cAJtSvZ4HTLJXcGRxzJFrFsm6hHq0yk7poxeFpSYmW1RhYlrmFuqYVDzF3/a1OkY3tqkhbREGrAZ4j/yT46w+cVMcWnq1Q7Tmz0/h15B8as/rzMZnSEoDCrWZjaWCSUlC+o/1uXaxt1cj7hu+WwMC8xiOo/WnkAof798kgqnNSZ4aMC75vD12QcqVOGoqTMltUhfwawvIGFR8hqr9poJ5fNhV3bgkgfrF49xX4mkMqBu3iURibBkK6sfnb7e7tPQM2ZOF1Gj25H2ulA8fmiXdgHUBVgleDQBoj5mwqKYshCi/9yQtnm01gloOYjr59XedXjK/9T KGxcDUla PnAmQgfb6pAQPQnwuNcnLPLMOGiERaBud3juNjbE+rN1MFl6mBine414rI5eERv5a8GCQ0swUebcmb+IrQAlA9dnfrBGkkycy+FtsadU65DmRHRoZ3hxgYiZDsFRisIz+0w7UXVXsJSW9u0YomIDvsRpfcEZYXyCA6lMccm6VjOocjNKiSJRSKcAbwOTngfnMBiMB29KKDMjTtPI= 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 in the generic implementation of vma_alloc_zeroed_movable_folio(). Signed-off-by: Ryan Roberts --- include/linux/mm.h | 3 ++- mm/memory.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 7f1741bd870a..7e3bf45e6491 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3684,10 +3684,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) int copy_user_large_folio(struct folio *dst, struct folio *src, unsigned long addr_hint, struct vm_area_struct *vma); diff --git a/mm/memory.c b/mm/memory.c index fb30f7523550..3d4ea668c4d1 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5741,7 +5741,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 @@ -5839,6 +5838,7 @@ 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 int copy_user_gigantic_page(struct folio *dst, struct folio *src, unsigned long addr, struct vm_area_struct *vma,