From nobody Wed Oct 8 00:39:51 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C1E72FD875 for ; Fri, 4 Jul 2025 10:26:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751624808; cv=none; b=N6jkNGIgmIZUBekhPN1aaCbaLPCkXGskeY+qZo0MqCTXlqmSX18C0r9b0ZADHveGaVJeQnWGQW8952B+V5dWc9xLP0nvPE2nXK4XvejHNkpW62vI1VwUIUn/JcYPSz5GlMrDk2os0h61S4OHizq6b2YkH1D3XLAE6zDpfK/8+lk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751624808; c=relaxed/simple; bh=vLPZe/AETOSx+MqNKvXX8AgfD+g/9x5PZ18a44XXkJQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YpEDmXAMp2EE1UdswsVMAG0eEdENq1MOXB9VcBSiJAEYa7p7wpVHjBLON5sgrF8VOs4WsEDemFbKeC760K0WLCOYEIoj1B36TdNhYrherHMK9Heo7z/Hk7dk+lO5YMg/ihbNcMzVjEZi99Q7EHtx8Xq4aEPzL0GctP7HlIxcHuU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=EMi/HW9/; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EMi/HW9/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751624805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WbsxMz4pnUtjte7Dwwcfz26G/fUwTmSxga2gzR0g2S8=; b=EMi/HW9/MjVS20D6rtQwx2vp3VctFTNvDSdYrHz5KTYa0Ye5AjfsWn/C9YY0442rjnQ5hI OhDILQriBijMaZSvekV3EzkY1hFPttFdeVDdzuH+l51P+jQauqYnZAflaD0hUnAxdQWkOm 83QzkKzIvQ+2FQ9FfwW2Yk1Gk1jDy60= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-184-2bP78L_6M1aOYB3q4zLTww-1; Fri, 04 Jul 2025 06:26:44 -0400 X-MC-Unique: 2bP78L_6M1aOYB3q4zLTww-1 X-Mimecast-MFC-AGG-ID: 2bP78L_6M1aOYB3q4zLTww_1751624803 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-451ecc3be97so3903225e9.0 for ; Fri, 04 Jul 2025 03:26:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751624803; x=1752229603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WbsxMz4pnUtjte7Dwwcfz26G/fUwTmSxga2gzR0g2S8=; b=YOAoJawJOBjOVayLp71ADpoL9a7BuhapGLHKOxYCCucF2JIdAP2w5cwh0J8skb2QiS ct4RxL1Og6xJffHO6caI3E9VaP0RtuAm3Rf/Ld5h0/aXxet71g5/Y81xFxaRKL/rnsIl jvCTLh99RZqlSnMGfuP8CcX/pTcDXoTtLczjC2TF0mM6YGU5mrT0ZICuax8+01xiXxi3 re0J9vsap1hvtzptnSrb5l1aM+p0jFjn4SniVE4woHgehopPUrFSrKEzRFVxTymCPh6c c1zbuJMexnp7vLWKUx2l1kEU2Yuo5Q4M6o42PVHogU5cPaBqX07RreYhRTkEY/WvQUPT PEag== X-Gm-Message-State: AOJu0YxUILzFCoVUKePzAxt8hNT8K++BNVzucVGTfR3iBmrP5M4sG3WU RLQaWUQjdCnBAm5fgOcouwUAAep+lDEgK0ZQZwoF7OoTTRne6OH9vG/sJzaUodqKhrMH801aT5a kdJQvtkWpZfhEj16NGnntRFsQnzajUtpeJyInwfzM28J7rOUHV5fxKk4hJAV4AVQlDC1cOGnrIk HB//TsTmEYfk7CmC8gXWTHkXT0O/edtgsyQSczttWV2JstJA== X-Gm-Gg: ASbGncs2ESaiItPXu1G6e4+1g6HdJ8Z+odTduz/n0UInr8bgakosCOLBbR0D0OiREuT wv7IiMxRepUv8cJv6lTwEl6YrrB3p++i0QVuZ4jhLfhHXIQlecg5jtL4pbnqj9BmI4MYIrxh03b SQroQmuIyg5yWoS/NwXyql69+uObBdulJLe5pBQtzVDDEZZX8VTO7olLQ39/txP5tjD99VKFXMj yZiIFvjcGGSJVOq+WFnAsr/UOXk18ZK2YBhqBuMZKMn1DHz2xl1NI1RaypnVh/yMpMp83RH1CMc gpe7HQSBWAFQQXU97XVjsT1a+3B1AE+H/sqMTS8dN/4Xzkaq+bKSsKh+XK3L9Rkq67dJgiOlev1 lc5TsVg== X-Received: by 2002:a05:6000:18a3:b0:3a3:7753:20ff with SMTP id ffacd0b85a97d-3b4965fa2e1mr1774338f8f.35.1751624802744; Fri, 04 Jul 2025 03:26:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsSNFCdzwlfszOvmyvFL++7oCCWdECVfxUvS2Goz3Q6PQO8mU3XMxflzhs2qhG7E3kmUYu5Q== X-Received: by 2002:a05:6000:18a3:b0:3a3:7753:20ff with SMTP id ffacd0b85a97d-3b4965fa2e1mr1774243f8f.35.1751624801975; Fri, 04 Jul 2025 03:26:41 -0700 (PDT) Received: from localhost (p200300d82f2c5500098823f9faa07232.dip0.t-ipconnect.de. [2003:d8:2f2c:5500:988:23f9:faa0:7232]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-454b1628fcdsm22862115e9.16.2025.07.04.03.26.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Jul 2025 03:26:41 -0700 (PDT) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux.dev, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , Jonathan Corbet , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Jerrin Shaji George , Arnd Bergmann , Greg Kroah-Hartman , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?UTF-8?q?Eugenio=20P=C3=A9rez?= , Alexander Viro , Christian Brauner , Jan Kara , Zi Yan , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , "Matthew Wilcox (Oracle)" , Minchan Kim , Sergey Senozhatsky , Brendan Jackman , Johannes Weiner , Jason Gunthorpe , John Hubbard , Peter Xu , Xu Xin , Chengming Zhou , Miaohe Lin , Naoya Horiguchi , Oscar Salvador , Rik van Riel , Harry Yoo , Qi Zheng , Shakeel Butt Subject: [PATCH v2 26/29] mm: rename PAGE_MAPPING_* to FOLIO_MAPPING_* Date: Fri, 4 Jul 2025 12:25:20 +0200 Message-ID: <20250704102524.326966-27-david@redhat.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250704102524.326966-1-david@redhat.com> References: <20250704102524.326966-1-david@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that the mapping flags are only used for folios, let's rename the defines. Reviewed-by: Zi Yan Reviewed-by: Lorenzo Stoakes Reviewed-by: Harry Yoo Signed-off-by: David Hildenbrand --- fs/proc/page.c | 4 ++-- include/linux/fs.h | 2 +- include/linux/mm_types.h | 1 - include/linux/page-flags.h | 20 ++++++++++---------- include/linux/pagemap.h | 2 +- mm/gup.c | 4 ++-- mm/internal.h | 2 +- mm/ksm.c | 4 ++-- mm/rmap.c | 16 ++++++++-------- mm/util.c | 6 +++--- 10 files changed, 30 insertions(+), 31 deletions(-) diff --git a/fs/proc/page.c b/fs/proc/page.c index 999af26c72985..0cdc78c0d23fa 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -149,7 +149,7 @@ u64 stable_page_flags(const struct page *page) =20 k =3D folio->flags; mapping =3D (unsigned long)folio->mapping; - is_anon =3D mapping & PAGE_MAPPING_ANON; + is_anon =3D mapping & FOLIO_MAPPING_ANON; =20 /* * pseudo flags for the well known (anonymous) memory mapped pages @@ -158,7 +158,7 @@ u64 stable_page_flags(const struct page *page) u |=3D 1 << KPF_MMAP; if (is_anon) { u |=3D 1 << KPF_ANON; - if (mapping & PAGE_MAPPING_KSM) + if (mapping & FOLIO_MAPPING_KSM) u |=3D 1 << KPF_KSM; } =20 diff --git a/include/linux/fs.h b/include/linux/fs.h index c68c9a07cda33..9b0de18746815 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -526,7 +526,7 @@ struct address_space { /* * On most architectures that alignment is already the case; but * must be enforced here for CRIS, to let the least significant bit - * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. + * of struct folio's "mapping" pointer be used for FOLIO_MAPPING_ANON. */ =20 /* XArray tags, for tagging dirty and writeback pages in the pagecache. */ diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 804d269a4f5e8..1ec273b066915 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -105,7 +105,6 @@ struct page { unsigned int order; }; }; - /* See page-flags.h for PAGE_MAPPING_FLAGS */ struct address_space *mapping; union { pgoff_t __folio_index; /* Our offset within mapping. */ diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index e575ecf880e59..970600d79daca 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -695,10 +695,10 @@ PAGEFLAG_FALSE(VmemmapSelfHosted, vmemmap_self_hosted) /* * On an anonymous folio mapped into a user virtual memory area, * folio->mapping points to its anon_vma, not to a struct address_space; - * with the PAGE_MAPPING_ANON bit set to distinguish it. See rmap.h. + * with the FOLIO_MAPPING_ANON bit set to distinguish it. See rmap.h. * * On an anonymous folio in a VM_MERGEABLE area, if CONFIG_KSM is enabled, - * the PAGE_MAPPING_ANON_KSM bit may be set along with the PAGE_MAPPING_AN= ON + * the FOLIO_MAPPING_ANON_KSM bit may be set along with the FOLIO_MAPPING_= ANON * bit; and then folio->mapping points, not to an anon_vma, but to a priva= te * structure which KSM associates with that merged folio. See ksm.h. * @@ -713,21 +713,21 @@ PAGEFLAG_FALSE(VmemmapSelfHosted, vmemmap_self_hosted) * false before calling the following functions (e.g., folio_test_anon). * See mm/slab.h. */ -#define PAGE_MAPPING_ANON 0x1 -#define PAGE_MAPPING_ANON_KSM 0x2 -#define PAGE_MAPPING_KSM (PAGE_MAPPING_ANON | PAGE_MAPPING_ANON_KSM) -#define PAGE_MAPPING_FLAGS (PAGE_MAPPING_ANON | PAGE_MAPPING_ANON_KSM) +#define FOLIO_MAPPING_ANON 0x1 +#define FOLIO_MAPPING_ANON_KSM 0x2 +#define FOLIO_MAPPING_KSM (FOLIO_MAPPING_ANON | FOLIO_MAPPING_ANON_KSM) +#define FOLIO_MAPPING_FLAGS (FOLIO_MAPPING_ANON | FOLIO_MAPPING_ANON_KSM) =20 static __always_inline bool folio_test_anon(const struct folio *folio) { - return ((unsigned long)folio->mapping & PAGE_MAPPING_ANON) !=3D 0; + return ((unsigned long)folio->mapping & FOLIO_MAPPING_ANON) !=3D 0; } =20 static __always_inline bool PageAnonNotKsm(const struct page *page) { unsigned long flags =3D (unsigned long)page_folio(page)->mapping; =20 - return (flags & PAGE_MAPPING_FLAGS) =3D=3D PAGE_MAPPING_ANON; + return (flags & FOLIO_MAPPING_FLAGS) =3D=3D FOLIO_MAPPING_ANON; } =20 static __always_inline bool PageAnon(const struct page *page) @@ -743,8 +743,8 @@ static __always_inline bool PageAnon(const struct page = *page) */ static __always_inline bool folio_test_ksm(const struct folio *folio) { - return ((unsigned long)folio->mapping & PAGE_MAPPING_FLAGS) =3D=3D - PAGE_MAPPING_KSM; + return ((unsigned long)folio->mapping & FOLIO_MAPPING_FLAGS) =3D=3D + FOLIO_MAPPING_KSM; } #else FOLIO_TEST_FLAG_FALSE(ksm) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index e63fbfbd5b0f3..10a222e68b851 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -502,7 +502,7 @@ static inline pgoff_t mapping_align_index(struct addres= s_space *mapping, static inline bool mapping_large_folio_support(struct address_space *mappi= ng) { /* AS_FOLIO_ORDER is only reasonable for pagecache folios */ - VM_WARN_ONCE((unsigned long)mapping & PAGE_MAPPING_ANON, + VM_WARN_ONCE((unsigned long)mapping & FOLIO_MAPPING_ANON, "Anonymous mapping always supports large folio"); =20 return mapping_max_folio_order(mapping) > 0; diff --git a/mm/gup.c b/mm/gup.c index 30d320719fa23..adffe663594dc 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2804,9 +2804,9 @@ static bool gup_fast_folio_allowed(struct folio *foli= o, unsigned int flags) return false; =20 /* Anonymous folios pose no problem. */ - mapping_flags =3D (unsigned long)mapping & PAGE_MAPPING_FLAGS; + mapping_flags =3D (unsigned long)mapping & FOLIO_MAPPING_FLAGS; if (mapping_flags) - return mapping_flags & PAGE_MAPPING_ANON; + return mapping_flags & FOLIO_MAPPING_ANON; =20 /* * At this point, we know the mapping is non-null and points to an diff --git a/mm/internal.h b/mm/internal.h index b7131bd3d1ad1..5b0f71e5434b2 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -149,7 +149,7 @@ static inline void *folio_raw_mapping(const struct foli= o *folio) { unsigned long mapping =3D (unsigned long)folio->mapping; =20 - return (void *)(mapping & ~PAGE_MAPPING_FLAGS); + return (void *)(mapping & ~FOLIO_MAPPING_FLAGS); } =20 /* diff --git a/mm/ksm.c b/mm/ksm.c index ef73b25fd65a6..2b0210d41c553 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -893,7 +893,7 @@ static struct folio *ksm_get_folio(struct ksm_stable_no= de *stable_node, unsigned long kpfn; =20 expected_mapping =3D (void *)((unsigned long)stable_node | - PAGE_MAPPING_KSM); + FOLIO_MAPPING_KSM); again: kpfn =3D READ_ONCE(stable_node->kpfn); /* Address dependency. */ folio =3D pfn_folio(kpfn); @@ -1070,7 +1070,7 @@ static inline void folio_set_stable_node(struct folio= *folio, struct ksm_stable_node *stable_node) { VM_WARN_ON_FOLIO(folio_test_anon(folio) && PageAnonExclusive(&folio->page= ), folio); - folio->mapping =3D (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM= ); + folio->mapping =3D (void *)((unsigned long)stable_node | FOLIO_MAPPING_KS= M); } =20 #ifdef CONFIG_SYSFS diff --git a/mm/rmap.c b/mm/rmap.c index a15939453c41a..f93ce27132abc 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -503,12 +503,12 @@ struct anon_vma *folio_get_anon_vma(const struct foli= o *folio) =20 rcu_read_lock(); anon_mapping =3D (unsigned long)READ_ONCE(folio->mapping); - if ((anon_mapping & PAGE_MAPPING_FLAGS) !=3D PAGE_MAPPING_ANON) + if ((anon_mapping & FOLIO_MAPPING_FLAGS) !=3D FOLIO_MAPPING_ANON) goto out; if (!folio_mapped(folio)) goto out; =20 - anon_vma =3D (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON); + anon_vma =3D (struct anon_vma *) (anon_mapping - FOLIO_MAPPING_ANON); if (!atomic_inc_not_zero(&anon_vma->refcount)) { anon_vma =3D NULL; goto out; @@ -550,12 +550,12 @@ struct anon_vma *folio_lock_anon_vma_read(const struc= t folio *folio, retry: rcu_read_lock(); anon_mapping =3D (unsigned long)READ_ONCE(folio->mapping); - if ((anon_mapping & PAGE_MAPPING_FLAGS) !=3D PAGE_MAPPING_ANON) + if ((anon_mapping & FOLIO_MAPPING_FLAGS) !=3D FOLIO_MAPPING_ANON) goto out; if (!folio_mapped(folio)) goto out; =20 - anon_vma =3D (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON); + anon_vma =3D (struct anon_vma *) (anon_mapping - FOLIO_MAPPING_ANON); root_anon_vma =3D READ_ONCE(anon_vma->root); if (down_read_trylock(&root_anon_vma->rwsem)) { /* @@ -1334,9 +1334,9 @@ void folio_move_anon_rmap(struct folio *folio, struct= vm_area_struct *vma) VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); VM_BUG_ON_VMA(!anon_vma, vma); =20 - anon_vma +=3D PAGE_MAPPING_ANON; + anon_vma +=3D FOLIO_MAPPING_ANON; /* - * Ensure that anon_vma and the PAGE_MAPPING_ANON bit are written + * Ensure that anon_vma and the FOLIO_MAPPING_ANON bit are written * simultaneously, so a concurrent reader (eg folio_referenced()'s * folio_test_anon()) will not see one without the other. */ @@ -1367,10 +1367,10 @@ static void __folio_set_anon(struct folio *folio, s= truct vm_area_struct *vma, /* * page_idle does a lockless/optimistic rmap scan on folio->mapping. * Make sure the compiler doesn't split the stores of anon_vma and - * the PAGE_MAPPING_ANON type identifier, otherwise the rmap code + * the FOLIO_MAPPING_ANON type identifier, otherwise the rmap code * could mistake the mapping for a struct address_space and crash. */ - anon_vma =3D (void *) anon_vma + PAGE_MAPPING_ANON; + anon_vma =3D (void *) anon_vma + FOLIO_MAPPING_ANON; WRITE_ONCE(folio->mapping, (struct address_space *) anon_vma); folio->index =3D linear_page_index(vma, address); } diff --git a/mm/util.c b/mm/util.c index ce826ca82a11d..68ea833ba25f1 100644 --- a/mm/util.c +++ b/mm/util.c @@ -670,9 +670,9 @@ struct anon_vma *folio_anon_vma(const struct folio *fol= io) { unsigned long mapping =3D (unsigned long)folio->mapping; =20 - if ((mapping & PAGE_MAPPING_FLAGS) !=3D PAGE_MAPPING_ANON) + if ((mapping & FOLIO_MAPPING_FLAGS) !=3D FOLIO_MAPPING_ANON) return NULL; - return (void *)(mapping - PAGE_MAPPING_ANON); + return (void *)(mapping - FOLIO_MAPPING_ANON); } =20 /** @@ -699,7 +699,7 @@ struct address_space *folio_mapping(struct folio *folio) return swap_address_space(folio->swap); =20 mapping =3D folio->mapping; - if ((unsigned long)mapping & PAGE_MAPPING_FLAGS) + if ((unsigned long)mapping & FOLIO_MAPPING_FLAGS) return NULL; =20 return mapping; --=20 2.49.0