From patchwork Tue Jul 23 15:34:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13740173 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 1F9BAC3DA49 for ; Tue, 23 Jul 2024 15:35:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B4196B0089; Tue, 23 Jul 2024 11:35:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 463476B00B9; Tue, 23 Jul 2024 11:35:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 303D06B00BB; Tue, 23 Jul 2024 11:35:13 -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 12DFA6B0089 for ; Tue, 23 Jul 2024 11:35:13 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B3DB81C0607 for ; Tue, 23 Jul 2024 15:35:12 +0000 (UTC) X-FDA: 82371416064.29.DCAEA43 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf09.hostedemail.com (Postfix) with ESMTP id 0C25B14000D for ; Tue, 23 Jul 2024 15:35:10 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=iyiRhel8; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721748849; 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=AVLzwYo6U16iN8amn1SMV4UMGf6UW3JZ6MhTrIe4UCQ=; b=uZovjn9TAWfpFOTw3hYDhQ/v3/2McrPAXc44nWoepOhfaeBpeIrmk/xBKwkyjhor5baGDG Cq3TlaS9gN/V0+zXkr7Mb3jXlyk4WIOv4/A3n0epiVTOQqSjfS4aEf8hTA+6E7N6lPV+26 kJKdSPVY6azF00uHLyq2kjb5akzAPrM= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=iyiRhel8; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721748849; a=rsa-sha256; cv=none; b=TlXSq8dxyowleyJ+hlMauhA0Ofqwa87VF6Q4dVRykFG31dhEEPgf4LNgxdUs3kMg2y9pl6 3oi/Mdcijo1VbPZHoIqM3dJIsQvQoJqPeSiGjkIZsJj7adp5KtNVxIFYfasHxJBtzxzlJz +vIAsXAfdYtaR0zbB8oYgJVgmDkKr2E= 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=AVLzwYo6U16iN8amn1SMV4UMGf6UW3JZ6MhTrIe4UCQ=; b=iyiRhel8jhXe+c9/Uaqh5MGhbc Nirm2UuxnewdYuChGADETrPCr9t/Bhl6uel0KJOyz3ko16JsM8gAyIhMarRqdIRgbmQNeBnasyxAe IQw7NO8VHdZ89fC4Wji5krrzD9VyncK0HXQKETEyb5YpwTJL2bHfk/7+B0Mj1h5Pa4TRKVSh89dad MTHQ0Cv6hZIEGHUjgyPOV2LoPdAVmQwj0T3PoAPiI/jwfiUYewkQgq6ty+TozemTSbZoT2BDRHAjk m6zyPuGmnTJCnWCpL2fONQ6OZeiixNYJrnynyIDchfmlOgclW2djqMaW0k38WkTIJY+l5YAp56TmE 3PoG2BXQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sWHXd-000000070LI-0dvy; Tue, 23 Jul 2024 15:35:05 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 2/6] mm: Constify page_address_in_vma() Date: Tue, 23 Jul 2024 16:34:57 +0100 Message-ID: <20240723153503.1669586-3-willy@infradead.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240723153503.1669586-1-willy@infradead.org> References: <20240723153503.1669586-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0C25B14000D X-Stat-Signature: zeabnwsr4ze8uz9eg3a7dnqbk4u8xe9x X-Rspam-User: X-HE-Tag: 1721748910-518874 X-HE-Meta: U2FsdGVkX19ChUh0337Ikqd3+FDjolCwz2MqZxyohNKFWDsjBTUQPujm+smy4+z2jB2MhEA/55L56Dxu7/HQB3ZkW9cybQ9bKUbTiZcXus8Lcy9rHCvbUo+NcAhZMsQVxhtGRf+OAdNpI/iliSJXVimwsQEAQ5jL+3dNmW27vGV5okYBasRqFnB3NzBI8AZQIz8zuGxCMWZhSWrAdmLK4y58YyN/avRPHph3iWPxdykHQmJJaRu4gY2PiWVyhbuGwPkHqStHkH82AchzO1RFsgQTMUdUBgoeU8PJpq2jtXgNhflfGxtwPB/bM6/kRhOffqspHkl6dL4KV/kQFUhJyYtJNm76IDDSyFgnmRIycelZPQDpSp2o51LGPkl72HuOUzgPhQHeb1XKY8ySd5VnAkEafkDaZ1Si4AQSJ2+Ohr73LLR7KK6nKXGzkfklTqMLo5WoyEYkyVZG4rp95PXn7xULfGJEoL+0bmkTSFGAy2zB20fHhEdaPnOnr6Ff02mTlnGSvc2wCzblunClHo297xESHbfXFHjeDSPuP7ITxlEuyAcnbbzhxROdBxkwYhD62eGaLtzEXMFfrUk6TU5exNeTiqn0KvwPhNC2RtqbcnSIjKLWK7txDGa45VU6x/XU68ZxtR1cTBA9JNZhFHt1bvVTSA1kU18G/NIW1PM30o1YnTfk/JF6gZ5p2xYj9e4953Hk28JCV1fqrSwzIy17Q66MYPARDZ3UewdHP5RVAyUgDTAGrtOoJd8sb9kqheqKCDXCo3CwR4xy/c9WHt6L2ZfWzQQTDmSVI0oBCv2kWZukYly0uexhzWuaQ7bEDDYLV0bOWXyKjWMERreUvlK7B8Um5TdbC2WKLZdNRXXf0ct9yt0jw0RhdtpbH8nEgg+h+L4u7+Kh+0ggIBGBinhzJfwUnwFsrndXCwAJFgklNYkXZWW7G4Qq5x1dAmbWhfAw9iTRmQjA4OstFZIfpEG zq1Vjxlz +CyUXjb4kA9U/O3zunKrAQmGEftOfT7eJxr3LYMUnvc3v2mSoeIRqxAtYhtQ3xtxTUcgwD9NB1s9K2dNLXoiydG9CaPAyjoLRTaUKUAa0LcYIj+RnnNffvgne46H1Wz/iZiyKhoZ5C2DiPkIA/i21tC9D3B8v2OTWL1XqbKeIzaxW/LyulMq/gPjwRYxDlDGtV7ETthI9qukGH+OuuaFX0vQCUCSmowBaKC9le/4IdEYbKlZVqcJngiDtsIcjvV5l4qvFb4hoZLm9Y6s= 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: If we also mark the struct folio argument to folio_anon_vma(), we can make page_address_in_vma() take a const struct page pointer. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/rmap.h | 2 +- mm/internal.h | 2 +- mm/rmap.c | 5 +++-- mm/util.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 0978c64f49d8..d1fca5b76039 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -732,7 +732,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw); /* * Used by swapoff to help locate where page is expected in vma. */ -unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); +unsigned long page_address_in_vma(const struct page *, struct vm_area_struct *); /* * Cleans the PTEs of shared mappings. diff --git a/mm/internal.h b/mm/internal.h index b4d86436565b..e511708b2be0 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -810,7 +810,7 @@ static inline bool is_data_mapping(vm_flags_t flags) } /* mm/util.c */ -struct anon_vma *folio_anon_vma(struct folio *folio); +struct anon_vma *folio_anon_vma(const struct folio *folio); #ifdef CONFIG_MMU void unmap_mapping_folio(struct folio *folio); diff --git a/mm/rmap.c b/mm/rmap.c index 8616308610b9..886bf67ba382 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -771,9 +771,10 @@ static bool should_defer_flush(struct mm_struct *mm, enum ttu_flags flags) * At what user virtual address is page expected in vma? * Caller should check the page is actually part of the vma. */ -unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma) +unsigned long page_address_in_vma(const struct page *page, + struct vm_area_struct *vma) { - struct folio *folio = page_folio(page); + const struct folio *folio = page_folio(page); pgoff_t pgoff; if (folio_test_anon(folio)) { diff --git a/mm/util.c b/mm/util.c index bc488f0121a7..8afe3b90d650 100644 --- a/mm/util.c +++ b/mm/util.c @@ -780,7 +780,7 @@ void *vcalloc_noprof(size_t n, size_t size) } EXPORT_SYMBOL(vcalloc_noprof); -struct anon_vma *folio_anon_vma(struct folio *folio) +struct anon_vma *folio_anon_vma(const struct folio *folio) { unsigned long mapping = (unsigned long)folio->mapping;