From patchwork Tue Mar 26 17:10:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13604743 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 1ED47CD11DF for ; Tue, 26 Mar 2024 17:11:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4C646B009E; Tue, 26 Mar 2024 13:10:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FC676B00A1; Tue, 26 Mar 2024 13:10:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A18C6B009E; Tue, 26 Mar 2024 13:10:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0B1A96B00A0 for ; Tue, 26 Mar 2024 13:10:54 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id CBDDC140D15 for ; Tue, 26 Mar 2024 17:10:53 +0000 (UTC) X-FDA: 81939829986.06.FBDD9F7 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id 2D37920019 for ; Tue, 26 Mar 2024 17:10:51 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=DlxXV5hE; dmarc=none; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711473052; 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:dkim-signature; bh=tq8Kbf2LVfQ4EQcIhLM3s4gNREM5wXn60iV7YjjnHsY=; b=IvXZSVunS74sZJpcpNc5dIilqmITLvjK4V3qna0+E+kHNX4GuiuLP6wPerBT1QLeUoS9di CFr+aUSyJEH0SOw6WmOYNA5NK/LyuEKHSPZncRr4fL9rjvsep6KtwerwSagSQ5HeQTZFVn PQB0j8+CReqwLSgzOlyaGHNhmdOIkc0= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=DlxXV5hE; dmarc=none; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711473052; a=rsa-sha256; cv=none; b=BUzbv6kt8eshYsTjinbWzNjJkH5dQ+ePl5ySwwfTpbsFhIFwGOvxlok5bCnziEuNQwrIue 0C0izcB2xr8bhbdp9xyeFJbBCwWBtU4/eFQk8BNfVmoFnC939qYyQWJmgZVM0xLZAKygUg /6zFbh4l/l4xjLFrGM1t5KKW3eScUBo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=tq8Kbf2LVfQ4EQcIhLM3s4gNREM5wXn60iV7YjjnHsY=; b=DlxXV5hEJBuW+sG4JENs2HKDu9 S/uWdvU4KYWJ2RufJO7o8FzyJ/hRUqs10hMaFf1qG57lmYiLhDYlwYrIKHsq5pRrl1smJDxAeKzdL 43fhgRgtpsMdLGQqV9lfXyyUQ+5tGDMiaFdC6Z7yZn9CZT78DOUnv9bhFVaPSa34b8U7XpyW+ZCvB I5NxbDpvdeh9Civ93FnHpCxXMyiAjBlsdGKf19KLCN6Csxr2KVRxj4oYStb4GpysRSFMn7IbtML8E 4iUpGIjNwKdVsQxUhE1/uQgUNLl3rQUn5xPirAxHSwyNeowpjJm/kCsdkNCA1twc30WoEwVK6qH+J yhgmV13A==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpAK0-00000001isS-1gdj; Tue, 26 Mar 2024 17:10:48 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 07/10] mm: Convert arch_clear_hugepage_flags to take a folio Date: Tue, 26 Mar 2024 17:10:29 +0000 Message-ID: <20240326171045.410737-8-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240326171045.410737-1-willy@infradead.org> References: <20240326171045.410737-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: wwpx9xg3hsx38y1fajpmm5p95j64t518 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2D37920019 X-HE-Tag: 1711473051-769864 X-HE-Meta: U2FsdGVkX1+eagcMstsesFmKeoS5KEhP2wDA+fdWU7homukfqbtdJE0KaBtBwsbUIK+2S0HkbEdYHE6Ca+JabN4udT23CyaQ5CG0dJkwWwVEIJVtaFQ1219Pbgct3ovd3Cn0i09mqWIxxEv0v3tG7lwgBbJl4ouMEeW/AzniCkEJwbIjTrF3zPMDHmCeibuUDecW2JCEdKUs9yWJHG53f1ov1EwVf6+meqsLq5hBewFymE/oLun67FoSCoy4L1x9laQcPwF/tmE9JZIOadyoY3eHsbaYgAQPXdQ56IlQKQpYXBLJSkXa3VQ7esnnGC0M05k6YO6R5Q/0x3ZhHLKnsyp+OvMihO4uyHg/8aiJaB4Wccdd3E6gosIZ1MsB9QXZpc5ktOiQBsfaAltPKqMmJQnS49rbRduH8ii3XZXl32BfPb1x85kjlYM4EFPmsq3myhHm1rpq90Z7DIhI0oaigflk3JYPq6M9av/cQbSvHujL8suACpmW0P3JdSGcoBGJRHV3BuwSOud5RngPv/X8/+qcBRkFRp4VET779THbgREcecv45kKbMxdClSUV5rOdmm/9/RmyR+xvYsEZHoOPuUxB1DqF9JnIKPGd+WXLvmXle2zS4pg02KoRCzsSj4DpSlrJWho8OzQw+b7W9ojQcieGygGK+Jmnq/AirfekFqsPhprV07efw/whU5NfHcxzBlW5PAcK/4egwVlata7AMsO2Y8cW5vy0paSIpoIF4z+Z34RlZuXngA1ILNrCbeVsn6G20Cee7SWe1GqSg+8zoqFmS36HSQMKsqTaHZWW+PpWlMBtcWVb4CQAewkAxHSfhnKp9QZfxUt6sx9sVA1Uncj9VbgTWqChcHsdgukzvsmUAlgpiA+yPOMJ/gCXMiQw04qy9yKnfD/Y7UnpybGKCY2krlakRIqoWBuPp1FusdoGEo7OB0s9vRERsa59dwbMeO1HalZHDzJwCijo6at BS/un7Bx YZ6BHdLXD7H+ROlA5iszAedPdgibwogVS1htVgSfCx6Frizc22aScZ70Pe1Q4R7W7wr9+aNNlsR2Se6RyAizuGtJ+nhFs0VeP6Y3hUDj135JzhhWQfpgJPm0cTpw1NT7ON9MFCZxiQK44h9XiLXf7n6BPcZh5F+DzrPY/ZER3PSPX23FlhJkOlK+LMhftJ/LB/SVEh86+cEp9W6UmDbxcpCiRehv4Ui6uh8sUWWgZj++h1C/NPIKmocbMrL1M0Ky1lMGsl4X7ECiv8a8= 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: List-Subscribe: List-Unsubscribe: All implementations that aren't no-ops just set a bit in the flags, and we want to use the folio flags rather than the page flags for that. Rename it to arch_clear_hugetlb_flags() while we're touching it so nobody thinks it's used for THP. Signed-off-by: Matthew Wilcox (Oracle) --- arch/arm/include/asm/hugetlb.h | 6 +++--- arch/arm64/include/asm/hugetlb.h | 6 +++--- arch/riscv/include/asm/hugetlb.h | 6 +++--- arch/s390/include/asm/hugetlb.h | 6 +++--- arch/sh/include/asm/hugetlb.h | 6 +++--- include/linux/hugetlb.h | 4 ++-- mm/hugetlb.c | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/arch/arm/include/asm/hugetlb.h b/arch/arm/include/asm/hugetlb.h index a3a82b7158d4..b766c4b373f6 100644 --- a/arch/arm/include/asm/hugetlb.h +++ b/arch/arm/include/asm/hugetlb.h @@ -15,10 +15,10 @@ #include #include -static inline void arch_clear_hugepage_flags(struct page *page) +static inline void arch_clear_hugetlb_flags(struct folio *folio) { - clear_bit(PG_dcache_clean, &page->flags); + clear_bit(PG_dcache_clean, &folio->flags); } -#define arch_clear_hugepage_flags arch_clear_hugepage_flags +#define arch_clear_hugetlb_flags arch_clear_hugetlb_flags #endif /* _ASM_ARM_HUGETLB_H */ diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index 2ddc33d93b13..3954cbd2ff56 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -18,11 +18,11 @@ extern bool arch_hugetlb_migration_supported(struct hstate *h); #endif -static inline void arch_clear_hugepage_flags(struct page *page) +static inline void arch_clear_hugetlb_flags(struct folio *folio) { - clear_bit(PG_dcache_clean, &page->flags); + clear_bit(PG_dcache_clean, &folio->flags); } -#define arch_clear_hugepage_flags arch_clear_hugepage_flags +#define arch_clear_hugetlb_flags arch_clear_hugetlb_flags pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags); #define arch_make_huge_pte arch_make_huge_pte diff --git a/arch/riscv/include/asm/hugetlb.h b/arch/riscv/include/asm/hugetlb.h index 22deb7a2a6ec..b1ce97a9dbfc 100644 --- a/arch/riscv/include/asm/hugetlb.h +++ b/arch/riscv/include/asm/hugetlb.h @@ -5,11 +5,11 @@ #include #include -static inline void arch_clear_hugepage_flags(struct page *page) +static inline void arch_clear_hugetlb_flags(struct folio *folio) { - clear_bit(PG_dcache_clean, &page->flags); + clear_bit(PG_dcache_clean, &folio->flags); } -#define arch_clear_hugepage_flags arch_clear_hugepage_flags +#define arch_clear_hugetlb_flags arch_clear_hugetlb_flags #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION bool arch_hugetlb_migration_supported(struct hstate *h); diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h index deb198a61039..ce5f4fe8be4d 100644 --- a/arch/s390/include/asm/hugetlb.h +++ b/arch/s390/include/asm/hugetlb.h @@ -39,11 +39,11 @@ static inline int prepare_hugepage_range(struct file *file, return 0; } -static inline void arch_clear_hugepage_flags(struct page *page) +static inline void arch_clear_hugetlb_flags(struct folio *folio) { - clear_bit(PG_arch_1, &page->flags); + clear_bit(PG_arch_1, &folio->flags); } -#define arch_clear_hugepage_flags arch_clear_hugepage_flags +#define arch_clear_hugetlb_flags arch_clear_hugetlb_flags static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep, unsigned long sz) diff --git a/arch/sh/include/asm/hugetlb.h b/arch/sh/include/asm/hugetlb.h index 4d3ba39e681c..75028bd568ba 100644 --- a/arch/sh/include/asm/hugetlb.h +++ b/arch/sh/include/asm/hugetlb.h @@ -27,11 +27,11 @@ static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma, return *ptep; } -static inline void arch_clear_hugepage_flags(struct page *page) +static inline void arch_clear_hugetlb_flags(struct folio *folio) { - clear_bit(PG_dcache_clean, &page->flags); + clear_bit(PG_dcache_clean, &folio->flags); } -#define arch_clear_hugepage_flags arch_clear_hugepage_flags +#define arch_clear_hugetlb_flags arch_clear_hugetlb_flags #include diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index d748628efc5e..cc420c42a773 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -837,8 +837,8 @@ static inline int is_hugepage_only_range(struct mm_struct *mm, #endif #ifndef arch_clear_hugepage_flags -static inline void arch_clear_hugepage_flags(struct page *page) { } -#define arch_clear_hugepage_flags arch_clear_hugepage_flags +static inline void arch_clear_hugetlb_flags(struct folio *folio) { } +#define arch_clear_hugetlb_flags arch_clear_hugetlb_flags #endif #ifndef arch_make_huge_pte diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f9640a81226e..0fdbd1f6c575 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1726,7 +1726,7 @@ static void add_hugetlb_folio(struct hstate *h, struct folio *folio, */ return; - arch_clear_hugepage_flags(&folio->page); + arch_clear_hugetlb_flags(folio); enqueue_hugetlb_folio(h, folio); } @@ -2024,7 +2024,7 @@ void free_huge_folio(struct folio *folio) spin_unlock_irqrestore(&hugetlb_lock, flags); update_and_free_hugetlb_folio(h, folio, true); } else { - arch_clear_hugepage_flags(&folio->page); + arch_clear_hugetlb_flags(folio); enqueue_hugetlb_folio(h, folio); spin_unlock_irqrestore(&hugetlb_lock, flags); }