* [PATCH 00/10] Simplify the page flags a little
@ 2024-08-21 19:34 Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 01/10] mm: Remove PageActive Matthew Wilcox (Oracle)
` (9 more replies)
0 siblings, 10 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
In the course of our folio conversions, we have made many page flags
only used on folios, so we can now remove the page-based accessors.
This should cut down compile time a little, and prevent new users from
cropping up.
There is more that could be done in this area, but it would produce
merge conflicts, so I'll sit on those patches until next merge window.
We now have line of sight to removing PG_private_2 and PG_private.
Matthew Wilcox (Oracle) (10):
mm: Remove PageActive
mm: Remove PageSwapBacked
mm: Remove PageReadahead
mm: Remove PageSwapCache
mm: Remove PageUnevictable
mm: Remove PageMlocked
mm: Remove PageOwnerPriv1
mm: Remove page_has_private()
mm: Rename PG_mappedtodisk to PG_owner_2
x86: Remove PG_uncached
.../features/vm/PG_uncached/arch-support.txt | 30 ------
Documentation/mm/unevictable-lru.rst | 4 +-
arch/arm64/Kconfig | 3 +-
arch/x86/Kconfig | 5 +-
arch/x86/mm/pat/memtype.c | 8 +-
fs/proc/page.c | 10 +-
include/linux/kernel-page-flags.h | 3 +-
include/linux/mm_types.h | 2 +-
include/linux/page-flags.h | 99 +++++++++----------
include/trace/events/mmflags.h | 25 +++--
mm/Kconfig | 9 +-
mm/huge_memory.c | 20 ++--
mm/ksm.c | 19 ++--
mm/migrate.c | 3 +-
mm/shmem.c | 11 ++-
tools/mm/page-types.c | 13 ++-
16 files changed, 111 insertions(+), 153 deletions(-)
delete mode 100644 Documentation/features/vm/PG_uncached/arch-support.txt
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 01/10] mm: Remove PageActive
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
@ 2024-08-21 19:34 ` Matthew Wilcox (Oracle)
2024-08-22 13:22 ` kernel test robot
2024-08-22 15:47 ` kernel test robot
2024-08-21 19:34 ` [PATCH 02/10] mm: Remove PageSwapBacked Matthew Wilcox (Oracle)
` (8 subsequent siblings)
9 siblings, 2 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
This flag is now only used on folios, so we can remove all the page
accessors.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 0c738bda5d98..65171b8fd661 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -510,8 +510,9 @@ PAGEFLAG(Dirty, dirty, PF_HEAD) TESTSCFLAG(Dirty, dirty, PF_HEAD)
__CLEARPAGEFLAG(Dirty, dirty, PF_HEAD)
PAGEFLAG(LRU, lru, PF_HEAD) __CLEARPAGEFLAG(LRU, lru, PF_HEAD)
TESTCLEARFLAG(LRU, lru, PF_HEAD)
-PAGEFLAG(Active, active, PF_HEAD) __CLEARPAGEFLAG(Active, active, PF_HEAD)
- TESTCLEARFLAG(Active, active, PF_HEAD)
+FOLIO_FLAG(active, FOLIO_HEAD_PAGE)
+ __FOLIO_CLEAR_FLAG(active, FOLIO_HEAD_PAGE)
+ FOLIO_TEST_CLEAR_FLAG(active, FOLIO_HEAD_PAGE)
PAGEFLAG(Workingset, workingset, PF_HEAD)
TESTCLEARFLAG(Workingset, workingset, PF_HEAD)
PAGEFLAG(Checked, checked, PF_NO_COMPOUND) /* Used by some filesystems */
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 02/10] mm: Remove PageSwapBacked
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 01/10] mm: Remove PageActive Matthew Wilcox (Oracle)
@ 2024-08-21 19:34 ` Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 03/10] mm: Remove PageReadahead Matthew Wilcox (Oracle)
` (7 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
This flag is now only used on folios, so we can remove all the page
accessors.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 65171b8fd661..5558d35cdcc3 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -528,9 +528,9 @@ PAGEFLAG(XenRemapped, xen_remapped, PF_NO_COMPOUND)
PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
__CLEARPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
__SETPAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
-PAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL)
- __CLEARPAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL)
- __SETPAGEFLAG(SwapBacked, swapbacked, PF_NO_TAIL)
+FOLIO_FLAG(swapbacked, FOLIO_HEAD_PAGE)
+ __FOLIO_CLEAR_FLAG(swapbacked, FOLIO_HEAD_PAGE)
+ __FOLIO_SET_FLAG(swapbacked, FOLIO_HEAD_PAGE)
/*
* Private page markings that may be used by the filesystem that owns the page
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 03/10] mm: Remove PageReadahead
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 01/10] mm: Remove PageActive Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 02/10] mm: Remove PageSwapBacked Matthew Wilcox (Oracle)
@ 2024-08-21 19:34 ` Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 04/10] mm: Remove PageSwapCache Matthew Wilcox (Oracle)
` (6 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
This flag is now only used on folios, so we can remove all the page
accessors.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5558d35cdcc3..2c2e6106682c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -553,8 +553,8 @@ PAGEFLAG(MappedToDisk, mappedtodisk, PF_NO_TAIL)
/* PG_readahead is only used for reads; PG_reclaim is only for writes */
PAGEFLAG(Reclaim, reclaim, PF_NO_TAIL)
TESTCLEARFLAG(Reclaim, reclaim, PF_NO_TAIL)
-PAGEFLAG(Readahead, readahead, PF_NO_COMPOUND)
- TESTCLEARFLAG(Readahead, readahead, PF_NO_COMPOUND)
+FOLIO_FLAG(readahead, FOLIO_HEAD_PAGE)
+ FOLIO_TEST_CLEAR_FLAG(readahead, FOLIO_HEAD_PAGE)
#ifdef CONFIG_HIGHMEM
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 04/10] mm: Remove PageSwapCache
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
` (2 preceding siblings ...)
2024-08-21 19:34 ` [PATCH 03/10] mm: Remove PageReadahead Matthew Wilcox (Oracle)
@ 2024-08-21 19:34 ` Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 05/10] mm: Remove PageUnevictable Matthew Wilcox (Oracle)
` (5 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
This flag is now only used on folios, so we can remove all the page
accessors and reword the comments that refer to them.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/mm_types.h | 2 +-
include/linux/page-flags.h | 11 +++--------
mm/ksm.c | 19 ++++++++++---------
mm/migrate.c | 3 ++-
mm/shmem.c | 11 ++++++-----
5 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 2419e60c9a7f..6e3bdf8e38bc 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -109,7 +109,7 @@ struct page {
/**
* @private: Mapping-private opaque data.
* Usually used for buffer_heads if PagePrivate.
- * Used for swp_entry_t if PageSwapCache.
+ * Used for swp_entry_t if swapcache flag set.
* Indicates order in the buddy system if PageBuddy.
*/
unsigned long private;
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 2c2e6106682c..43a7996c53d4 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -574,15 +574,10 @@ static __always_inline bool folio_test_swapcache(const struct folio *folio)
test_bit(PG_swapcache, const_folio_flags(folio, 0));
}
-static __always_inline bool PageSwapCache(const struct page *page)
-{
- return folio_test_swapcache(page_folio(page));
-}
-
-SETPAGEFLAG(SwapCache, swapcache, PF_NO_TAIL)
-CLEARPAGEFLAG(SwapCache, swapcache, PF_NO_TAIL)
+FOLIO_SET_FLAG(swapcache, FOLIO_HEAD_PAGE)
+FOLIO_CLEAR_FLAG(swapcache, FOLIO_HEAD_PAGE)
#else
-PAGEFLAG_FALSE(SwapCache, swapcache)
+FOLIO_FLAG_FALSE(swapcache)
#endif
PAGEFLAG(Unevictable, unevictable, PF_HEAD)
diff --git a/mm/ksm.c b/mm/ksm.c
index 8e53666bc7b0..a2e2a521df0a 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -909,12 +909,13 @@ static struct folio *ksm_get_folio(struct ksm_stable_node *stable_node,
*/
while (!folio_try_get(folio)) {
/*
- * Another check for page->mapping != expected_mapping would
- * work here too. We have chosen the !PageSwapCache test to
- * optimize the common case, when the page is or is about to
- * be freed: PageSwapCache is cleared (under spin_lock_irq)
- * in the ref_freeze section of __remove_mapping(); but Anon
- * folio->mapping reset to NULL later, in free_pages_prepare().
+ * Another check for folio->mapping != expected_mapping
+ * would work here too. We have chosen to test the
+ * swapcache flag to optimize the common case, when the
+ * folio is or is about to be freed: the swapcache flag
+ * is cleared (under spin_lock_irq) in the ref_freeze
+ * section of __remove_mapping(); but anon folio->mapping
+ * is reset to NULL later, in free_pages_prepare().
*/
if (!folio_test_swapcache(folio))
goto stale;
@@ -945,7 +946,7 @@ static struct folio *ksm_get_folio(struct ksm_stable_node *stable_node,
stale:
/*
- * We come here from above when page->mapping or !PageSwapCache
+ * We come here from above when folio->mapping or the swapcache flag
* suggests that the node is stale; but it might be under migration.
* We need smp_rmb(), matching the smp_wmb() in folio_migrate_ksm(),
* before checking whether node->kpfn has been changed.
@@ -1452,7 +1453,7 @@ static int try_to_merge_one_page(struct vm_area_struct *vma,
goto out;
/*
- * We need the page lock to read a stable PageSwapCache in
+ * We need the folio lock to read a stable swapcache flag in
* write_protect_page(). We use trylock_page() instead of
* lock_page() because we don't want to wait here - we
* prefer to continue scanning and merging different pages,
@@ -3123,7 +3124,7 @@ void folio_migrate_ksm(struct folio *newfolio, struct folio *folio)
* newfolio->mapping was set in advance; now we need smp_wmb()
* to make sure that the new stable_node->kpfn is visible
* to ksm_get_folio() before it can see that folio->mapping
- * has gone stale (or that folio_test_swapcache has been cleared).
+ * has gone stale (or that the swapcache flag has been cleared).
*/
smp_wmb();
folio_set_stable_node(folio, NULL);
diff --git a/mm/migrate.c b/mm/migrate.c
index 1248c89d4dbd..4f55f4930fe8 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -666,7 +666,8 @@ void folio_migrate_flags(struct folio *newfolio, struct folio *folio)
folio_migrate_ksm(newfolio, folio);
/*
* Please do not reorder this without considering how mm/ksm.c's
- * ksm_get_folio() depends upon ksm_migrate_page() and PageSwapCache().
+ * ksm_get_folio() depends upon ksm_migrate_page() and the
+ * swapcache flag.
*/
if (folio_test_swapcache(folio))
folio_clear_swapcache(folio);
diff --git a/mm/shmem.c b/mm/shmem.c
index 22a3f3c1897e..752106aca845 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -502,8 +502,8 @@ static int shmem_replace_entry(struct address_space *mapping,
* Sometimes, before we decide whether to proceed or to fail, we must check
* that an entry was not already brought back from swap by a racing thread.
*
- * Checking page is not enough: by the time a SwapCache page is locked, it
- * might be reused, and again be SwapCache, using the same swap as before.
+ * Checking folio is not enough: by the time a swapcache folio is locked, it
+ * might be reused, and again be swapcache, using the same swap as before.
*/
static bool shmem_confirm_swap(struct address_space *mapping,
pgoff_t index, swp_entry_t swap)
@@ -1940,9 +1940,10 @@ static int shmem_replace_folio(struct folio **foliop, gfp_t gfp,
if (unlikely(error)) {
/*
- * Is this possible? I think not, now that our callers check
- * both PageSwapCache and page_private after getting page lock;
- * but be defensive. Reverse old to newpage for clear and free.
+ * Is this possible? I think not, now that our callers
+ * check both the swapcache flag and folio->private
+ * after getting the folio lock; but be defensive.
+ * Reverse old to newpage for clear and free.
*/
old = new;
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 05/10] mm: Remove PageUnevictable
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
` (3 preceding siblings ...)
2024-08-21 19:34 ` [PATCH 04/10] mm: Remove PageSwapCache Matthew Wilcox (Oracle)
@ 2024-08-21 19:34 ` Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 06/10] mm: Remove PageMlocked Matthew Wilcox (Oracle)
` (4 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
There is only one caller of PageUnevictable() left; convert it to call
folio_test_unevictable() and remove all the page accessors.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 6 +++---
mm/huge_memory.c | 16 ++++++++--------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 43a7996c53d4..bdf24f65d998 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -580,9 +580,9 @@ FOLIO_CLEAR_FLAG(swapcache, FOLIO_HEAD_PAGE)
FOLIO_FLAG_FALSE(swapcache)
#endif
-PAGEFLAG(Unevictable, unevictable, PF_HEAD)
- __CLEARPAGEFLAG(Unevictable, unevictable, PF_HEAD)
- TESTCLEARFLAG(Unevictable, unevictable, PF_HEAD)
+FOLIO_FLAG(unevictable, FOLIO_HEAD_PAGE)
+ __FOLIO_CLEAR_FLAG(unevictable, FOLIO_HEAD_PAGE)
+ FOLIO_TEST_CLEAR_FLAG(unevictable, FOLIO_HEAD_PAGE)
#ifdef CONFIG_MMU
PAGEFLAG(Mlocked, mlocked, PF_NO_TAIL)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index cf8e34f62976..d92f19812c89 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3017,25 +3017,25 @@ static void remap_page(struct folio *folio, unsigned long nr)
}
}
-static void lru_add_page_tail(struct page *head, struct page *tail,
+static void lru_add_page_tail(struct folio *folio, struct page *tail,
struct lruvec *lruvec, struct list_head *list)
{
- VM_BUG_ON_PAGE(!PageHead(head), head);
- VM_BUG_ON_PAGE(PageLRU(tail), head);
+ VM_BUG_ON_FOLIO(!folio_test_large(folio), folio);
+ VM_BUG_ON_FOLIO(PageLRU(tail), folio);
lockdep_assert_held(&lruvec->lru_lock);
if (list) {
/* page reclaim is reclaiming a huge page */
- VM_WARN_ON(PageLRU(head));
+ VM_WARN_ON(folio_test_lru(folio));
get_page(tail);
list_add_tail(&tail->lru, list);
} else {
/* head is still on lru (and we have it frozen) */
- VM_WARN_ON(!PageLRU(head));
- if (PageUnevictable(tail))
+ VM_WARN_ON(!folio_test_lru(folio));
+ if (folio_test_unevictable(folio))
tail->mlock_count = 0;
else
- list_add_tail(&tail->lru, &head->lru);
+ list_add_tail(&tail->lru, &folio->lru);
SetPageLRU(tail);
}
}
@@ -3134,7 +3134,7 @@ static void __split_huge_page_tail(struct folio *folio, int tail,
* pages to show after the currently processed elements - e.g.
* migrate_pages
*/
- lru_add_page_tail(head, page_tail, lruvec, list);
+ lru_add_page_tail(folio, page_tail, lruvec, list);
}
static void __split_huge_page(struct page *page, struct list_head *list,
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 06/10] mm: Remove PageMlocked
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
` (4 preceding siblings ...)
2024-08-21 19:34 ` [PATCH 05/10] mm: Remove PageUnevictable Matthew Wilcox (Oracle)
@ 2024-08-21 19:34 ` Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 07/10] mm: Remove PageOwnerPriv1 Matthew Wilcox (Oracle)
` (3 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
This flag is now only used on folios, so we can remove all the page
accessors.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
Documentation/mm/unevictable-lru.rst | 4 ++--
include/linux/page-flags.h | 13 ++++++++-----
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/Documentation/mm/unevictable-lru.rst b/Documentation/mm/unevictable-lru.rst
index 2feb2ed51ae2..255ef12a432b 100644
--- a/Documentation/mm/unevictable-lru.rst
+++ b/Documentation/mm/unevictable-lru.rst
@@ -253,8 +253,8 @@ Basic Management
mlocked pages - pages mapped into a VM_LOCKED VMA - are a class of unevictable
pages. When such a page has been "noticed" by the memory management subsystem,
-the page is marked with the PG_mlocked flag. This can be manipulated using the
-PageMlocked() functions.
+the folio is marked with the PG_mlocked flag. This can be manipulated using
+folio_set_mlocked() and folio_clear_mlocked() functions.
A PG_mlocked page will be placed on the unevictable list when it is added to
the LRU. Such pages can be "noticed" by memory management in several places:
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index bdf24f65d998..f1358f86a673 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -585,12 +585,15 @@ FOLIO_FLAG(unevictable, FOLIO_HEAD_PAGE)
FOLIO_TEST_CLEAR_FLAG(unevictable, FOLIO_HEAD_PAGE)
#ifdef CONFIG_MMU
-PAGEFLAG(Mlocked, mlocked, PF_NO_TAIL)
- __CLEARPAGEFLAG(Mlocked, mlocked, PF_NO_TAIL)
- TESTSCFLAG(Mlocked, mlocked, PF_NO_TAIL)
+FOLIO_FLAG(mlocked, FOLIO_HEAD_PAGE)
+ __FOLIO_CLEAR_FLAG(mlocked, FOLIO_HEAD_PAGE)
+ FOLIO_TEST_CLEAR_FLAG(mlocked, FOLIO_HEAD_PAGE)
+ FOLIO_TEST_SET_FLAG(mlocked, FOLIO_HEAD_PAGE)
#else
-PAGEFLAG_FALSE(Mlocked, mlocked) __CLEARPAGEFLAG_NOOP(Mlocked, mlocked)
- TESTSCFLAG_FALSE(Mlocked, mlocked)
+FOLIO_FLAG_FALSE(mlocked)
+ __FOLIO_CLEAR_FLAG_NOOP(mlocked)
+ FOLIO_TEST_CLEAR_FLAG_FALSE(mlocked)
+ FOLIO_TEST_SET_FLAG_FALSE(mlocked)
#endif
#ifdef CONFIG_ARCH_USES_PG_UNCACHED
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 07/10] mm: Remove PageOwnerPriv1
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
` (5 preceding siblings ...)
2024-08-21 19:34 ` [PATCH 06/10] mm: Remove PageMlocked Matthew Wilcox (Oracle)
@ 2024-08-21 19:34 ` Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 08/10] mm: Remove page_has_private() Matthew Wilcox (Oracle)
` (2 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
While there are many aliases for this flag, nobody actually uses the
*PageOwnerPriv1() nor folio_*_owner_priv_1() accessors. Remove them.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index f1358f86a673..5112049cc102 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -539,8 +539,6 @@ FOLIO_FLAG(swapbacked, FOLIO_HEAD_PAGE)
*/
PAGEFLAG(Private, private, PF_ANY)
PAGEFLAG(Private2, private_2, PF_ANY) TESTSCFLAG(Private2, private_2, PF_ANY)
-PAGEFLAG(OwnerPriv1, owner_priv_1, PF_ANY)
- TESTCLEARFLAG(OwnerPriv1, owner_priv_1, PF_ANY)
/*
* Only test-and-set exist for PG_writeback. The unconditional operators are
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 08/10] mm: Remove page_has_private()
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
` (6 preceding siblings ...)
2024-08-21 19:34 ` [PATCH 07/10] mm: Remove PageOwnerPriv1 Matthew Wilcox (Oracle)
@ 2024-08-21 19:34 ` Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 09/10] mm: Rename PG_mappedtodisk to PG_owner_2 Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 10/10] x86: Remove PG_uncached Matthew Wilcox (Oracle)
9 siblings, 0 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
This function has no more callers, except folio_has_private().
Combine the two functions.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/page-flags.h | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5112049cc102..3513aa666c31 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -1175,20 +1175,15 @@ static __always_inline void __ClearPageAnonExclusive(struct page *page)
#define PAGE_FLAGS_PRIVATE \
(1UL << PG_private | 1UL << PG_private_2)
/**
- * page_has_private - Determine if page has private stuff
- * @page: The page to be checked
+ * folio_has_private - Determine if folio has private stuff
+ * @folio: The folio to be checked
*
- * Determine if a page has private stuff, indicating that release routines
+ * Determine if a folio has private stuff, indicating that release routines
* should be invoked upon it.
*/
-static inline int page_has_private(const struct page *page)
+static inline int folio_has_private(const struct folio *folio)
{
- return !!(page->flags & PAGE_FLAGS_PRIVATE);
-}
-
-static inline bool folio_has_private(const struct folio *folio)
-{
- return page_has_private(&folio->page);
+ return !!(folio->flags & PAGE_FLAGS_PRIVATE);
}
#undef PF_ANY
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 09/10] mm: Rename PG_mappedtodisk to PG_owner_2
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
` (7 preceding siblings ...)
2024-08-21 19:34 ` [PATCH 08/10] mm: Remove page_has_private() Matthew Wilcox (Oracle)
@ 2024-08-21 19:34 ` Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 10/10] x86: Remove PG_uncached Matthew Wilcox (Oracle)
9 siblings, 0 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
This flag has similar constraints to PG_owner_priv_1 -- it is ignored
by core code, and is entirely for the use of the code which allocated
the folio. Since the pagecache does not use it, individual filesystems
can use it. The bufferhead code does use it, so filesystems which use
the buffer cache must not use it for another purpose.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/proc/page.c | 2 +-
include/linux/kernel-page-flags.h | 2 +-
include/linux/page-flags.h | 24 ++++++++++++++++--------
include/trace/events/mmflags.h | 2 +-
tools/mm/page-types.c | 10 +++++-----
5 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/fs/proc/page.c b/fs/proc/page.c
index 73a0f872d97f..e74e639893be 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -211,7 +211,7 @@ u64 stable_page_flags(const struct page *page)
#endif
u |= kpf_copy_bit(k, KPF_RESERVED, PG_reserved);
- u |= kpf_copy_bit(k, KPF_MAPPEDTODISK, PG_mappedtodisk);
+ u |= kpf_copy_bit(k, KPF_OWNER_2, PG_owner_2);
u |= kpf_copy_bit(k, KPF_PRIVATE, PG_private);
u |= kpf_copy_bit(k, KPF_PRIVATE_2, PG_private_2);
u |= kpf_copy_bit(k, KPF_OWNER_PRIVATE, PG_owner_priv_1);
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h
index 859f4b0c1b2b..7c587a711be1 100644
--- a/include/linux/kernel-page-flags.h
+++ b/include/linux/kernel-page-flags.h
@@ -10,7 +10,7 @@
*/
#define KPF_RESERVED 32
#define KPF_MLOCKED 33
-#define KPF_MAPPEDTODISK 34
+#define KPF_OWNER_2 34
#define KPF_PRIVATE 35
#define KPF_PRIVATE_2 36
#define KPF_OWNER_PRIVATE 37
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 3513aa666c31..c001e3c29c4c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -101,12 +101,12 @@ enum pageflags {
PG_waiters, /* Page has waiters, check its waitqueue. Must be bit #7 and in the same byte as "PG_locked" */
PG_active,
PG_workingset,
- PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/
+ PG_owner_priv_1, /* Owner use. If pagecache, fs may use */
+ PG_owner_2, /* Owner use. If pagecache, fs may use */
PG_arch_1,
PG_reserved,
PG_private, /* If pagecache, has fs-private data */
PG_private_2, /* If pagecache, has fs aux data */
- PG_mappedtodisk, /* Has blocks allocated on-disk */
PG_reclaim, /* To be reclaimed asap */
PG_swapbacked, /* Page is backed by RAM/swap */
PG_unevictable, /* Page is "unevictable" */
@@ -131,6 +131,11 @@ enum pageflags {
PG_readahead = PG_reclaim,
+ /* Anonymous memory (and shmem) */
+ PG_swapcache = PG_owner_priv_1, /* Swap page: swp_entry_t in private */
+ /* Some filesystems */
+ PG_checked = PG_owner_priv_1,
+
/*
* Depending on the way an anonymous folio can be mapped into a page
* table (e.g., single PMD/PUD/CONT of the head page vs. PTE-mapped
@@ -138,13 +143,13 @@ enum pageflags {
* tail pages of an anonymous folio. For now, we only expect it to be
* set on tail pages for PTE-mapped THP.
*/
- PG_anon_exclusive = PG_mappedtodisk,
-
- /* Filesystems */
- PG_checked = PG_owner_priv_1,
+ PG_anon_exclusive = PG_owner_2,
- /* SwapBacked */
- PG_swapcache = PG_owner_priv_1, /* Swap page: swp_entry_t in private */
+ /*
+ * Set if all buffer heads in the folio are mapped.
+ * Filesystems which do not use BHs can use it for their own purpose.
+ */
+ PG_mappedtodisk = PG_owner_2,
/* Two page bits are conscripted by FS-Cache to maintain local caching
* state. These bits are set on pages belonging to the netfs's inodes
@@ -540,6 +545,9 @@ FOLIO_FLAG(swapbacked, FOLIO_HEAD_PAGE)
PAGEFLAG(Private, private, PF_ANY)
PAGEFLAG(Private2, private_2, PF_ANY) TESTSCFLAG(Private2, private_2, PF_ANY)
+/* owner_2 can be set on tail pages for anon memory */
+FOLIO_FLAG(owner_2, FOLIO_HEAD_PAGE)
+
/*
* Only test-and-set exist for PG_writeback. The unconditional operators are
* risky: they bypass page accounting.
diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h
index c151cc21d367..3b51558cdc9b 100644
--- a/include/trace/events/mmflags.h
+++ b/include/trace/events/mmflags.h
@@ -107,13 +107,13 @@
DEF_PAGEFLAG_NAME(active), \
DEF_PAGEFLAG_NAME(workingset), \
DEF_PAGEFLAG_NAME(owner_priv_1), \
+ DEF_PAGEFLAG_NAME(owner_2), \
DEF_PAGEFLAG_NAME(arch_1), \
DEF_PAGEFLAG_NAME(reserved), \
DEF_PAGEFLAG_NAME(private), \
DEF_PAGEFLAG_NAME(private_2), \
DEF_PAGEFLAG_NAME(writeback), \
DEF_PAGEFLAG_NAME(head), \
- DEF_PAGEFLAG_NAME(mappedtodisk), \
DEF_PAGEFLAG_NAME(reclaim), \
DEF_PAGEFLAG_NAME(swapbacked), \
DEF_PAGEFLAG_NAME(unevictable) \
diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c
index 8d5595b6c59f..8ca41c41105e 100644
--- a/tools/mm/page-types.c
+++ b/tools/mm/page-types.c
@@ -71,7 +71,7 @@
/* [32-] kernel hacking assistances */
#define KPF_RESERVED 32
#define KPF_MLOCKED 33
-#define KPF_MAPPEDTODISK 34
+#define KPF_OWNER_2 34
#define KPF_PRIVATE 35
#define KPF_PRIVATE_2 36
#define KPF_OWNER_PRIVATE 37
@@ -129,7 +129,7 @@ static const char * const page_flag_names[] = {
[KPF_RESERVED] = "r:reserved",
[KPF_MLOCKED] = "m:mlocked",
- [KPF_MAPPEDTODISK] = "d:mappedtodisk",
+ [KPF_OWNER_2] = "d:owner_2",
[KPF_PRIVATE] = "P:private",
[KPF_PRIVATE_2] = "p:private_2",
[KPF_OWNER_PRIVATE] = "O:owner_private",
@@ -472,9 +472,9 @@ static int bit_mask_ok(uint64_t flags)
static uint64_t expand_overloaded_flags(uint64_t flags, uint64_t pme)
{
- /* Anonymous pages overload PG_mappedtodisk */
- if ((flags & BIT(ANON)) && (flags & BIT(MAPPEDTODISK)))
- flags ^= BIT(MAPPEDTODISK) | BIT(ANON_EXCLUSIVE);
+ /* Anonymous pages use PG_owner_2 for anon_exclusive */
+ if ((flags & BIT(ANON)) && (flags & BIT(OWNER_2)))
+ flags ^= BIT(OWNER_2) | BIT(ANON_EXCLUSIVE);
/* SLUB overloads several page flags */
if (flags & BIT(SLAB)) {
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 10/10] x86: Remove PG_uncached
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
` (8 preceding siblings ...)
2024-08-21 19:34 ` [PATCH 09/10] mm: Rename PG_mappedtodisk to PG_owner_2 Matthew Wilcox (Oracle)
@ 2024-08-21 19:34 ` Matthew Wilcox (Oracle)
9 siblings, 0 replies; 15+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-08-21 19:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel, x86
Convert x86 to use PG_arch_2 instead of PG_uncached and remove
PG_uncached.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
.../features/vm/PG_uncached/arch-support.txt | 30 -------------------
arch/arm64/Kconfig | 3 +-
arch/x86/Kconfig | 5 +---
arch/x86/mm/pat/memtype.c | 8 ++---
fs/proc/page.c | 8 ++---
include/linux/kernel-page-flags.h | 1 -
include/linux/page-flags.h | 13 ++------
include/trace/events/mmflags.h | 23 +++++++-------
mm/Kconfig | 9 ++----
mm/huge_memory.c | 4 ++-
tools/mm/page-types.c | 3 +-
11 files changed, 31 insertions(+), 76 deletions(-)
delete mode 100644 Documentation/features/vm/PG_uncached/arch-support.txt
diff --git a/Documentation/features/vm/PG_uncached/arch-support.txt b/Documentation/features/vm/PG_uncached/arch-support.txt
deleted file mode 100644
index 5a7508b8c967..000000000000
--- a/Documentation/features/vm/PG_uncached/arch-support.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Feature name: PG_uncached
-# Kconfig: ARCH_USES_PG_UNCACHED
-# description: arch supports the PG_uncached page flag
-#
- -----------------------
- | arch |status|
- -----------------------
- | alpha: | TODO |
- | arc: | TODO |
- | arm: | TODO |
- | arm64: | TODO |
- | csky: | TODO |
- | hexagon: | TODO |
- | loongarch: | TODO |
- | m68k: | TODO |
- | microblaze: | TODO |
- | mips: | TODO |
- | nios2: | TODO |
- | openrisc: | TODO |
- | parisc: | TODO |
- | powerpc: | TODO |
- | riscv: | TODO |
- | s390: | TODO |
- | sh: | TODO |
- | sparc: | TODO |
- | um: | TODO |
- | x86: | ok |
- | xtensa: | TODO |
- -----------------------
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index a2f8ff354ca6..6494848019a0 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -2100,7 +2100,8 @@ config ARM64_MTE
depends on ARM64_PAN
select ARCH_HAS_SUBPAGE_FAULTS
select ARCH_USES_HIGH_VMA_FLAGS
- select ARCH_USES_PG_ARCH_X
+ select ARCH_USES_PG_ARCH_2
+ select ARCH_USES_PG_ARCH_3
help
Memory Tagging (part of the ARMv8.5 Extensions) provides
architectural support for run-time, always-on detection of
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 09f8fbcfe000..42edf11f5166 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1800,6 +1800,7 @@ config X86_PAT
def_bool y
prompt "x86 PAT support" if EXPERT
depends on MTRR
+ select ARCH_USES_PG_ARCH_2
help
Use PAT attributes to setup page level cache control.
@@ -1811,10 +1812,6 @@ config X86_PAT
If unsure, say Y.
-config ARCH_USES_PG_UNCACHED
- def_bool y
- depends on X86_PAT
-
config X86_UMIP
def_bool y
prompt "User Mode Instruction Prevention" if EXPERT
diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index bdc2a240c2aa..1fa0bf6ed295 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -104,7 +104,7 @@ __setup("debugpat", pat_debug_setup);
#ifdef CONFIG_X86_PAT
/*
- * X86 PAT uses page flags arch_1 and uncached together to keep track of
+ * X86 PAT uses page flags arch_1 and arch_2 together to keep track of
* memory type of pages that have backing page struct.
*
* X86 PAT supports 4 different memory types:
@@ -118,9 +118,9 @@ __setup("debugpat", pat_debug_setup);
#define _PGMT_WB 0
#define _PGMT_WC (1UL << PG_arch_1)
-#define _PGMT_UC_MINUS (1UL << PG_uncached)
-#define _PGMT_WT (1UL << PG_uncached | 1UL << PG_arch_1)
-#define _PGMT_MASK (1UL << PG_uncached | 1UL << PG_arch_1)
+#define _PGMT_UC_MINUS (1UL << PG_arch_2)
+#define _PGMT_WT (1UL << PG_arch_2 | 1UL << PG_arch_1)
+#define _PGMT_MASK (1UL << PG_arch_2 | 1UL << PG_arch_1)
#define _PGMT_CLEAR_MASK (~_PGMT_MASK)
static inline enum page_cache_mode get_page_memtype(struct page *pg)
diff --git a/fs/proc/page.c b/fs/proc/page.c
index e74e639893be..a55f5acefa97 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -206,18 +206,16 @@ u64 stable_page_flags(const struct page *page)
u |= kpf_copy_bit(page->flags, KPF_HWPOISON, PG_hwpoison);
#endif
-#ifdef CONFIG_ARCH_USES_PG_UNCACHED
- u |= kpf_copy_bit(k, KPF_UNCACHED, PG_uncached);
-#endif
-
u |= kpf_copy_bit(k, KPF_RESERVED, PG_reserved);
u |= kpf_copy_bit(k, KPF_OWNER_2, PG_owner_2);
u |= kpf_copy_bit(k, KPF_PRIVATE, PG_private);
u |= kpf_copy_bit(k, KPF_PRIVATE_2, PG_private_2);
u |= kpf_copy_bit(k, KPF_OWNER_PRIVATE, PG_owner_priv_1);
u |= kpf_copy_bit(k, KPF_ARCH, PG_arch_1);
-#ifdef CONFIG_ARCH_USES_PG_ARCH_X
+#ifdef CONFIG_ARCH_USES_PG_ARCH_2
u |= kpf_copy_bit(k, KPF_ARCH_2, PG_arch_2);
+#endif
+#ifdef CONFIG_ARCH_USES_PG_ARCH_3
u |= kpf_copy_bit(k, KPF_ARCH_3, PG_arch_3);
#endif
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h
index 7c587a711be1..196778a087c4 100644
--- a/include/linux/kernel-page-flags.h
+++ b/include/linux/kernel-page-flags.h
@@ -15,7 +15,6 @@
#define KPF_PRIVATE_2 36
#define KPF_OWNER_PRIVATE 37
#define KPF_ARCH 38
-#define KPF_UNCACHED 39
#define KPF_SOFTDIRTY 40
#define KPF_ARCH_2 41
#define KPF_ARCH_3 42
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index c001e3c29c4c..7b90a700b26a 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -113,9 +113,6 @@ enum pageflags {
#ifdef CONFIG_MMU
PG_mlocked, /* Page is vma mlocked */
#endif
-#ifdef CONFIG_ARCH_USES_PG_UNCACHED
- PG_uncached, /* Page has been mapped as uncached */
-#endif
#ifdef CONFIG_MEMORY_FAILURE
PG_hwpoison, /* hardware poisoned page. Don't touch */
#endif
@@ -123,8 +120,10 @@ enum pageflags {
PG_young,
PG_idle,
#endif
-#ifdef CONFIG_ARCH_USES_PG_ARCH_X
+#ifdef CONFIG_ARCH_USES_PG_ARCH_2
PG_arch_2,
+#endif
+#ifdef CONFIG_ARCH_USES_PG_ARCH_3
PG_arch_3,
#endif
__NR_PAGEFLAGS,
@@ -602,12 +601,6 @@ FOLIO_FLAG_FALSE(mlocked)
FOLIO_TEST_SET_FLAG_FALSE(mlocked)
#endif
-#ifdef CONFIG_ARCH_USES_PG_UNCACHED
-PAGEFLAG(Uncached, uncached, PF_NO_COMPOUND)
-#else
-PAGEFLAG_FALSE(Uncached, uncached)
-#endif
-
#ifdef CONFIG_MEMORY_FAILURE
PAGEFLAG(HWPoison, hwpoison, PF_ANY)
TESTSCFLAG(HWPoison, hwpoison, PF_ANY)
diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h
index 3b51558cdc9b..58f2699331b6 100644
--- a/include/trace/events/mmflags.h
+++ b/include/trace/events/mmflags.h
@@ -71,12 +71,6 @@
#define IF_HAVE_PG_MLOCK(_name)
#endif
-#ifdef CONFIG_ARCH_USES_PG_UNCACHED
-#define IF_HAVE_PG_UNCACHED(_name) ,{1UL << PG_##_name, __stringify(_name)}
-#else
-#define IF_HAVE_PG_UNCACHED(_name)
-#endif
-
#ifdef CONFIG_MEMORY_FAILURE
#define IF_HAVE_PG_HWPOISON(_name) ,{1UL << PG_##_name, __stringify(_name)}
#else
@@ -89,10 +83,16 @@
#define IF_HAVE_PG_IDLE(_name)
#endif
-#ifdef CONFIG_ARCH_USES_PG_ARCH_X
-#define IF_HAVE_PG_ARCH_X(_name) ,{1UL << PG_##_name, __stringify(_name)}
+#ifdef CONFIG_ARCH_USES_PG_ARCH_2
+#define IF_HAVE_PG_ARCH_2(_name) ,{1UL << PG_##_name, __stringify(_name)}
+#else
+#define IF_HAVE_PG_ARCH_2(_name)
+#endif
+
+#ifdef CONFIG_ARCH_USES_PG_ARCH_3
+#define IF_HAVE_PG_ARCH_3(_name) ,{1UL << PG_##_name, __stringify(_name)}
#else
-#define IF_HAVE_PG_ARCH_X(_name)
+#define IF_HAVE_PG_ARCH_3(_name)
#endif
#define DEF_PAGEFLAG_NAME(_name) { 1UL << PG_##_name, __stringify(_name) }
@@ -118,12 +118,11 @@
DEF_PAGEFLAG_NAME(swapbacked), \
DEF_PAGEFLAG_NAME(unevictable) \
IF_HAVE_PG_MLOCK(mlocked) \
-IF_HAVE_PG_UNCACHED(uncached) \
IF_HAVE_PG_HWPOISON(hwpoison) \
IF_HAVE_PG_IDLE(idle) \
IF_HAVE_PG_IDLE(young) \
-IF_HAVE_PG_ARCH_X(arch_2) \
-IF_HAVE_PG_ARCH_X(arch_3)
+IF_HAVE_PG_ARCH_2(arch_2) \
+IF_HAVE_PG_ARCH_3(arch_3)
#define show_page_flags(flags) \
(flags) ? __print_flags(flags, "|", \
diff --git a/mm/Kconfig b/mm/Kconfig
index 5946dcdcaeda..8078a4b3c509 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -1079,13 +1079,10 @@ config ARCH_USES_HIGH_VMA_FLAGS
config ARCH_HAS_PKEYS
bool
-config ARCH_USES_PG_ARCH_X
+config ARCH_USES_PG_ARCH_2
+ bool
+config ARCH_USES_PG_ARCH_3
bool
- help
- Enable the definition of PG_arch_x page flags with x > 1. Only
- suitable for 64-bit architectures with CONFIG_FLATMEM or
- CONFIG_SPARSEMEM_VMEMMAP enabled, otherwise there may not be
- enough room for additional bits in page->flags.
config VM_EVENT_COUNTERS
default y
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index d92f19812c89..389d619845c9 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3078,8 +3078,10 @@ static void __split_huge_page_tail(struct folio *folio, int tail,
(1L << PG_workingset) |
(1L << PG_locked) |
(1L << PG_unevictable) |
-#ifdef CONFIG_ARCH_USES_PG_ARCH_X
+#ifdef CONFIG_ARCH_USES_PG_ARCH_2
(1L << PG_arch_2) |
+#endif
+#ifdef CONFIG_ARCH_USES_PG_ARCH_3
(1L << PG_arch_3) |
#endif
(1L << PG_dirty) |
diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c
index 8ca41c41105e..fa050d5a48cd 100644
--- a/tools/mm/page-types.c
+++ b/tools/mm/page-types.c
@@ -76,7 +76,7 @@
#define KPF_PRIVATE_2 36
#define KPF_OWNER_PRIVATE 37
#define KPF_ARCH 38
-#define KPF_UNCACHED 39
+#define KPF_UNCACHED 39 /* unused */
#define KPF_SOFTDIRTY 40
#define KPF_ARCH_2 41
@@ -134,7 +134,6 @@ static const char * const page_flag_names[] = {
[KPF_PRIVATE_2] = "p:private_2",
[KPF_OWNER_PRIVATE] = "O:owner_private",
[KPF_ARCH] = "h:arch",
- [KPF_UNCACHED] = "c:uncached",
[KPF_SOFTDIRTY] = "f:softdirty",
[KPF_ARCH_2] = "H:arch_2",
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 01/10] mm: Remove PageActive
2024-08-21 19:34 ` [PATCH 01/10] mm: Remove PageActive Matthew Wilcox (Oracle)
@ 2024-08-22 13:22 ` kernel test robot
2024-08-22 18:24 ` Andrew Morton
2024-08-22 15:47 ` kernel test robot
1 sibling, 1 reply; 15+ messages in thread
From: kernel test robot @ 2024-08-22 13:22 UTC (permalink / raw)
To: Matthew Wilcox (Oracle), Andrew Morton
Cc: oe-kbuild-all, Linux Memory Management List,
Matthew Wilcox (Oracle), linux-fsdevel, x86
Hi Matthew,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on arm64/for-next/core tip/x86/core tip/x86/mm linus/master v6.11-rc4 next-20240822]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Wilcox-Oracle/mm-Remove-PageActive/20240822-033717
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20240821193445.2294269-2-willy%40infradead.org
patch subject: [PATCH 01/10] mm: Remove PageActive
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20240822/202408222044.zZMToCKk-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240822/202408222044.zZMToCKk-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408222044.zZMToCKk-lkp@intel.com/
All errors (new ones prefixed by >>):
arch/powerpc/mm/pgtable-frag.c: In function 'pte_free_defer':
>> arch/powerpc/mm/pgtable-frag.c:142:9: error: implicit declaration of function 'SetPageActive' [-Wimplicit-function-declaration]
142 | SetPageActive(page);
| ^~~~~~~~~~~~~
vim +/SetPageActive +142 arch/powerpc/mm/pgtable-frag.c
32cc0b7c9d508e Hugh Dickins 2023-07-11 135
32cc0b7c9d508e Hugh Dickins 2023-07-11 136 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
32cc0b7c9d508e Hugh Dickins 2023-07-11 137 void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable)
32cc0b7c9d508e Hugh Dickins 2023-07-11 138 {
32cc0b7c9d508e Hugh Dickins 2023-07-11 139 struct page *page;
32cc0b7c9d508e Hugh Dickins 2023-07-11 140
32cc0b7c9d508e Hugh Dickins 2023-07-11 141 page = virt_to_page(pgtable);
32cc0b7c9d508e Hugh Dickins 2023-07-11 @142 SetPageActive(page);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 01/10] mm: Remove PageActive
2024-08-21 19:34 ` [PATCH 01/10] mm: Remove PageActive Matthew Wilcox (Oracle)
2024-08-22 13:22 ` kernel test robot
@ 2024-08-22 15:47 ` kernel test robot
1 sibling, 0 replies; 15+ messages in thread
From: kernel test robot @ 2024-08-22 15:47 UTC (permalink / raw)
To: Matthew Wilcox (Oracle), Andrew Morton
Cc: llvm, oe-kbuild-all, Linux Memory Management List,
Matthew Wilcox (Oracle), linux-fsdevel, x86
Hi Matthew,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on arm64/for-next/core tip/x86/core tip/x86/mm linus/master v6.11-rc4 next-20240822]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Wilcox-Oracle/mm-Remove-PageActive/20240822-033717
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20240821193445.2294269-2-willy%40infradead.org
patch subject: [PATCH 01/10] mm: Remove PageActive
config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20240822/202408222357.ksCAhSZQ-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 26670e7fa4f032a019d23d56c6a02926e854e8af)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240822/202408222357.ksCAhSZQ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408222357.ksCAhSZQ-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from arch/powerpc/mm/pgtable-frag.c:10:
In file included from include/linux/mm.h:2199:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> arch/powerpc/mm/pgtable-frag.c:142:2: error: call to undeclared function 'SetPageActive'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
142 | SetPageActive(page);
| ^
4 warnings and 1 error generated.
vim +/SetPageActive +142 arch/powerpc/mm/pgtable-frag.c
32cc0b7c9d508e Hugh Dickins 2023-07-11 135
32cc0b7c9d508e Hugh Dickins 2023-07-11 136 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
32cc0b7c9d508e Hugh Dickins 2023-07-11 137 void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable)
32cc0b7c9d508e Hugh Dickins 2023-07-11 138 {
32cc0b7c9d508e Hugh Dickins 2023-07-11 139 struct page *page;
32cc0b7c9d508e Hugh Dickins 2023-07-11 140
32cc0b7c9d508e Hugh Dickins 2023-07-11 141 page = virt_to_page(pgtable);
32cc0b7c9d508e Hugh Dickins 2023-07-11 @142 SetPageActive(page);
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 01/10] mm: Remove PageActive
2024-08-22 13:22 ` kernel test robot
@ 2024-08-22 18:24 ` Andrew Morton
2024-08-22 18:34 ` Matthew Wilcox
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2024-08-22 18:24 UTC (permalink / raw)
To: kernel test robot
Cc: Matthew Wilcox (Oracle), oe-kbuild-all,
Linux Memory Management List, linux-fsdevel, x86
On Thu, 22 Aug 2024 21:22:43 +0800 kernel test robot <lkp@intel.com> wrote:
> arch/powerpc/mm/pgtable-frag.c: In function 'pte_free_defer':
> >> arch/powerpc/mm/pgtable-frag.c:142:9: error: implicit declaration of function 'SetPageActive' [-Wimplicit-function-declaration]
> 142 | SetPageActive(page);
> | ^~~~~~~~~~~~~
this, I assume?
--- a/arch/powerpc/mm/pgtable-frag.c~mm-remove-pageactive-fix
+++ a/arch/powerpc/mm/pgtable-frag.c
@@ -136,10 +136,10 @@ void pte_fragment_free(unsigned long *ta
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable)
{
- struct page *page;
+ struct folio *folio;
- page = virt_to_page(pgtable);
- SetPageActive(page);
+ folio = virt_to_folio(pgtable);
+ folio_set_active(folio);
pte_fragment_free((unsigned long *)pgtable, 0);
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
_
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 01/10] mm: Remove PageActive
2024-08-22 18:24 ` Andrew Morton
@ 2024-08-22 18:34 ` Matthew Wilcox
0 siblings, 0 replies; 15+ messages in thread
From: Matthew Wilcox @ 2024-08-22 18:34 UTC (permalink / raw)
To: Andrew Morton
Cc: kernel test robot, oe-kbuild-all, Linux Memory Management List,
linux-fsdevel, x86
On Thu, Aug 22, 2024 at 11:24:24AM -0700, Andrew Morton wrote:
> On Thu, 22 Aug 2024 21:22:43 +0800 kernel test robot <lkp@intel.com> wrote:
>
> > arch/powerpc/mm/pgtable-frag.c: In function 'pte_free_defer':
> > >> arch/powerpc/mm/pgtable-frag.c:142:9: error: implicit declaration of function 'SetPageActive' [-Wimplicit-function-declaration]
> > 142 | SetPageActive(page);
> > | ^~~~~~~~~~~~~
>
> this, I assume?
It's a good quick fix. I don't think this use of PG_active is
documented anywhere, so I'll send a patch to fix that too.
> --- a/arch/powerpc/mm/pgtable-frag.c~mm-remove-pageactive-fix
> +++ a/arch/powerpc/mm/pgtable-frag.c
> @@ -136,10 +136,10 @@ void pte_fragment_free(unsigned long *ta
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable)
> {
> - struct page *page;
> + struct folio *folio;
>
> - page = virt_to_page(pgtable);
> - SetPageActive(page);
> + folio = virt_to_folio(pgtable);
> + folio_set_active(folio);
> pte_fragment_free((unsigned long *)pgtable, 0);
> }
> #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
> _
>
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2024-08-22 18:34 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21 19:34 [PATCH 00/10] Simplify the page flags a little Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 01/10] mm: Remove PageActive Matthew Wilcox (Oracle)
2024-08-22 13:22 ` kernel test robot
2024-08-22 18:24 ` Andrew Morton
2024-08-22 18:34 ` Matthew Wilcox
2024-08-22 15:47 ` kernel test robot
2024-08-21 19:34 ` [PATCH 02/10] mm: Remove PageSwapBacked Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 03/10] mm: Remove PageReadahead Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 04/10] mm: Remove PageSwapCache Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 05/10] mm: Remove PageUnevictable Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 06/10] mm: Remove PageMlocked Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 07/10] mm: Remove PageOwnerPriv1 Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 08/10] mm: Remove page_has_private() Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 09/10] mm: Rename PG_mappedtodisk to PG_owner_2 Matthew Wilcox (Oracle)
2024-08-21 19:34 ` [PATCH 10/10] x86: Remove PG_uncached Matthew Wilcox (Oracle)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).