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: 113063 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7643713vqr; Mon, 26 Jun 2023 10:34:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6DzUrk+oTcdPjP2qwEE8n2533aVCl/vfygydtd8sCf9AP2Muljc5mlz11mL5M8/i59xTu0 X-Received: by 2002:a05:6870:c904:b0:19f:45a1:b59d with SMTP id hj4-20020a056870c90400b0019f45a1b59dmr25745047oab.12.1687800880195; Mon, 26 Jun 2023 10:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687800880; cv=none; d=google.com; s=arc-20160816; b=idsraFVZ3b4IZ9CVBM8qNwkiiRyLxgnhddzyICN4V/Jg2sTKNAqOj8cjF+cY33tVj+ PnbqD/dPqB4K/HKm5xWzNI6HV7GfOuUJxwh8s+dqwtdm+TcDcz02k21k5FeOktHcHmvu 7tekUI5cgZ5VmHWA6YH1Z5TYAaVvFp0vHA6oFmGg+oppO8VfgRaCBqzEJdUipU1SsKNZ CddkzV91IQLzqJ52AWvbm36PyAhpL/sICBud810DNMeg0nRzdZaKBeK/f6HVTFV+9KDq KRvhH3drd+YcHO3pm4b6Xx9dYmtJ+/Z4yljSdupJidcb220Ka1Ku//nsRqLaxuYLuZNB v0hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zeQagWoBaXA3rXEOQANZ4Snh6DOQHHPxdX/QvLLvgp4=; fh=H2MVjBlipHVEN6kEAh1RDhnPLB9jpPNjGExTmo1/EvA=; b=kdFRphgOkwHXdKLWnjhOAJiAICb28Pn7qye/mIobVIwHwQKbuLB4W7ZH2Ot8m8lPX5 o/izWAYrxULm9EovDeIX2Yr5afam94PZ+TZs19qt9AKTL07bf9m9iA+dh+vIeuEUS00A WqD5TeDGhVE1e0+C8+mtWqyjfqZnYmRd5obtjdxKH1h2Uu8GCajVn2RwdTMkoCSNXyxu G5FGOfR9LJjAGnkXb/1fOfh5HngaUkZMJV5bLHHF4F4nmE50BKBsjf78S5laYF8l6Afn 6TxVMSYUBUK6VfGLHWleX0oDCaJUcht3SseOiF2MC1twPUQeHf2wRacCmqmyPeNI9+LV ZJMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j23-20020a632317000000b005574480a875si5508202pgj.898.2023.06.26.10.34.26; Mon, 26 Jun 2023 10:34:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230493AbjFZRPG (ORCPT + 99 others); Mon, 26 Jun 2023 13:15:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230517AbjFZROu (ORCPT ); Mon, 26 Jun 2023 13:14:50 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 64DB81703; Mon, 26 Jun 2023 10:14:44 -0700 (PDT) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769787496119987734?= X-GMAIL-MSGID: =?utf-8?q?1769787496119987734?= 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,