From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-mm@kvack.org
Subject: [PATCH 05/11] slab: Use memdesc_flags_t
Date: Tue, 5 Aug 2025 18:22:55 +0100 [thread overview]
Message-ID: <20250805172307.1302730-6-willy@infradead.org> (raw)
In-Reply-To: <20250805172307.1302730-1-willy@infradead.org>
The slab flags are memdesc flags and contain the same information in the
upper bits as the other memdescs (like node ID).
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
mm/slab.h | 2 +-
mm/slub.c | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/mm/slab.h b/mm/slab.h
index 248b34c839b7..7757331e7c80 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -50,7 +50,7 @@ typedef union {
/* Reuses the bits in struct page */
struct slab {
- unsigned long flags;
+ memdesc_flags_t flags;
struct kmem_cache *slab_cache;
union {
diff --git a/mm/slub.c b/mm/slub.c
index cf7c6032d5fd..0160af3b3943 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -657,17 +657,17 @@ static inline unsigned int slub_get_cpu_partial(struct kmem_cache *s)
*/
static inline bool slab_test_pfmemalloc(const struct slab *slab)
{
- return test_bit(SL_pfmemalloc, &slab->flags);
+ return test_bit(SL_pfmemalloc, &slab->flags.f);
}
static inline void slab_set_pfmemalloc(struct slab *slab)
{
- set_bit(SL_pfmemalloc, &slab->flags);
+ set_bit(SL_pfmemalloc, &slab->flags.f);
}
static inline void __slab_clear_pfmemalloc(struct slab *slab)
{
- __clear_bit(SL_pfmemalloc, &slab->flags);
+ __clear_bit(SL_pfmemalloc, &slab->flags.f);
}
/*
@@ -675,12 +675,12 @@ static inline void __slab_clear_pfmemalloc(struct slab *slab)
*/
static __always_inline void slab_lock(struct slab *slab)
{
- bit_spin_lock(SL_locked, &slab->flags);
+ bit_spin_lock(SL_locked, &slab->flags.f);
}
static __always_inline void slab_unlock(struct slab *slab)
{
- bit_spin_unlock(SL_locked, &slab->flags);
+ bit_spin_unlock(SL_locked, &slab->flags.f);
}
static inline bool
@@ -1046,7 +1046,7 @@ static void print_slab_info(const struct slab *slab)
{
pr_err("Slab 0x%p objects=%u used=%u fp=0x%p flags=%pGp\n",
slab, slab->objects, slab->inuse, slab->freelist,
- &slab->flags);
+ &slab->flags.f);
}
void skip_orig_size_check(struct kmem_cache *s, const void *object)
@@ -2755,17 +2755,17 @@ static void discard_slab(struct kmem_cache *s, struct slab *slab)
static inline bool slab_test_node_partial(const struct slab *slab)
{
- return test_bit(SL_partial, &slab->flags);
+ return test_bit(SL_partial, &slab->flags.f);
}
static inline void slab_set_node_partial(struct slab *slab)
{
- set_bit(SL_partial, &slab->flags);
+ set_bit(SL_partial, &slab->flags.f);
}
static inline void slab_clear_node_partial(struct slab *slab)
{
- clear_bit(SL_partial, &slab->flags);
+ clear_bit(SL_partial, &slab->flags.f);
}
/*
--
2.47.2
next prev parent reply other threads:[~2025-08-06 12:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 17:22 [PATCH 00/11] Add and use memdesc_flags_t Matthew Wilcox (Oracle)
2025-08-05 17:22 ` [PATCH 01/11] mm: Introduce memdesc_flags_t Matthew Wilcox (Oracle)
2025-08-06 18:24 ` Zi Yan
2025-08-19 17:49 ` Kairui Song
2025-08-19 17:58 ` Matthew Wilcox
2025-08-19 18:03 ` Kairui Song
2025-08-05 17:22 ` [PATCH 02/11] mm: Convert page_to_section() to memdesc_section() Matthew Wilcox (Oracle)
2025-08-06 18:31 ` Zi Yan
2025-08-05 17:22 ` [PATCH 03/11] mm: Introduce memdesc_nid() Matthew Wilcox (Oracle)
2025-08-06 18:47 ` Zi Yan
2025-08-06 19:04 ` Matthew Wilcox
2025-08-06 19:07 ` Zi Yan
2025-08-05 17:22 ` [PATCH 04/11] mm: Introduce memdesc_zonenum() Matthew Wilcox (Oracle)
2025-08-06 18:57 ` Zi Yan
2025-08-05 17:22 ` Matthew Wilcox (Oracle) [this message]
2025-08-06 19:16 ` [PATCH 05/11] slab: Use memdesc_flags_t Zi Yan
2025-08-05 17:22 ` [PATCH 06/11] slab: Use memdesc_nid() Matthew Wilcox (Oracle)
2025-08-06 19:17 ` Zi Yan
2025-08-05 17:22 ` [PATCH 07/11] mm: Introduce memdesc_is_zone_device() Matthew Wilcox (Oracle)
2025-08-06 19:22 ` Zi Yan
2025-08-05 17:22 ` [PATCH 08/11] mm: Reimplement folio_is_device_private() Matthew Wilcox (Oracle)
2025-08-06 19:25 ` Zi Yan
2025-08-05 17:22 ` [PATCH 09/11] mm: Reimplement folio_is_device_coherent() Matthew Wilcox (Oracle)
2025-08-06 19:27 ` Zi Yan
2025-08-05 17:23 ` [PATCH 10/11] mm: Reimplement folio_is_fsdax() Matthew Wilcox (Oracle)
2025-08-06 19:27 ` Zi Yan
2025-08-05 17:23 ` [PATCH 11/11] mm: Add folio_is_pci_p2pdma() Matthew Wilcox (Oracle)
2025-08-05 21:40 ` [PATCH 00/11] Add and use memdesc_flags_t Shakeel Butt
2025-08-06 12:55 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250805172307.1302730-6-willy@infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox