All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Yoo <harry.yoo@oracle.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	Christoph Lameter <cl@gentwo.org>,
	David Rientjes <rientjes@google.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH 03/10] slab: Add SL_private flag
Date: Mon, 9 Jun 2025 11:25:09 +0900	[thread overview]
Message-ID: <aEZGBRW-2OsQ6ilr@hyeyoo> (raw)
In-Reply-To: <20250606222214.1395799-4-willy@infradead.org>

On Fri, Jun 06, 2025 at 11:22:05PM +0100, Matthew Wilcox (Oracle) wrote:
> Give slab its own name for this flag.  Keep the PG_workingset alias
> information in one place.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---

nit: subject should be "slab: Add SL_partial flag"

Otherwise looks good to me.

Acked-by: Harry Yoo <harry.yoo@oracle.com>

-- 
Cheers,
Harry / Hyeonggon

>  mm/slab.h |  2 ++
>  mm/slub.c | 20 ++++++++------------
>  2 files changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/mm/slab.h b/mm/slab.h
> index a25f12244b6c..fca818011f7d 100644
> --- a/mm/slab.h
> +++ b/mm/slab.h
> @@ -116,6 +116,7 @@ static_assert(IS_ALIGNED(offsetof(struct slab, freelist), sizeof(freelist_aba_t)
>  /**
>   * enum slab_flags - How the slab flags bits are used.
>   * @SL_locked: Is locked with slab_lock()
> + * @SL_partial: On the per-node partial list
>   *
>   * The slab flags share space with the page flags but some bits have
>   * different interpretations.  The high bits are used for information
> @@ -123,6 +124,7 @@ static_assert(IS_ALIGNED(offsetof(struct slab, freelist), sizeof(freelist_aba_t)
>   */
>  enum slab_flags {
>  	SL_locked,
> +	SL_partial = PG_workingset,	/* Historical reasons for this bit */
>  };
>  
>  /**
> diff --git a/mm/slub.c b/mm/slub.c
> index e9cbacee406d..804b39d06fa0 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -91,14 +91,14 @@
>   *   The partially empty slabs cached on the CPU partial list are used
>   *   for performance reasons, which speeds up the allocation process.
>   *   These slabs are not frozen, but are also exempt from list management,
> - *   by clearing the PG_workingset flag when moving out of the node
> + *   by clearing the SL_partial flag when moving out of the node
>   *   partial list. Please see __slab_free() for more details.
>   *
>   *   To sum up, the current scheme is:
> - *   - node partial slab: PG_Workingset && !frozen
> - *   - cpu partial slab: !PG_Workingset && !frozen
> - *   - cpu slab: !PG_Workingset && frozen
> - *   - full slab: !PG_Workingset && !frozen
> + *   - node partial slab: SL_partial && !frozen
> + *   - cpu partial slab: !SL_partial && !frozen
> + *   - cpu slab: !SL_partial && frozen
> + *   - full slab: !SL_partial && !frozen
>   *
>   *   list_lock
>   *
> @@ -2717,23 +2717,19 @@ static void discard_slab(struct kmem_cache *s, struct slab *slab)
>  	free_slab(s, slab);
>  }
>  
> -/*
> - * SLUB reuses PG_workingset bit to keep track of whether it's on
> - * the per-node partial list.
> - */
>  static inline bool slab_test_node_partial(const struct slab *slab)
>  {
> -	return folio_test_workingset(slab_folio(slab));
> +	return test_bit(SL_partial, &slab->flags);
>  }
>  
>  static inline void slab_set_node_partial(struct slab *slab)
>  {
> -	set_bit(PG_workingset, folio_flags(slab_folio(slab), 0));
> +	set_bit(SL_partial, &slab->flags);
>  }
>  
>  static inline void slab_clear_node_partial(struct slab *slab)
>  {
> -	clear_bit(PG_workingset, folio_flags(slab_folio(slab), 0));
> +	clear_bit(SL_partial, &slab->flags);
>  }
>  
>  /*
> -- 
> 2.47.2
> 
> 


  reply	other threads:[~2025-06-09  2:25 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06 22:22 [PATCH 00/10] Various slab improvements Matthew Wilcox (Oracle)
2025-06-06 22:22 ` [PATCH 01/10] doc: Move SLUB documentation to the admin guide Matthew Wilcox (Oracle)
2025-06-09  1:42   ` Harry Yoo
2025-06-09 12:13   ` Vlastimil Babka
2025-06-06 22:22 ` [PATCH 02/10] slab: Rename slab->__page_flags to slab->flags Matthew Wilcox (Oracle)
2025-06-09  2:15   ` Harry Yoo
2025-06-09 12:45     ` Matthew Wilcox
2025-06-09 13:12   ` Vlastimil Babka
2025-06-06 22:22 ` [PATCH 03/10] slab: Add SL_private flag Matthew Wilcox (Oracle)
2025-06-09  2:25   ` Harry Yoo [this message]
2025-06-06 22:22 ` [PATCH 04/10] slab: Add SL_pfmemalloc flag Matthew Wilcox (Oracle)
2025-06-09  2:27   ` Harry Yoo
2025-06-06 22:22 ` [PATCH 05/10] doc: Add slab internal kernel-doc Matthew Wilcox (Oracle)
2025-06-09  2:37   ` Harry Yoo
2025-06-09 15:22     ` Matthew Wilcox
2025-06-06 22:22 ` [PATCH 06/10] vmcoreinfo: Remove documentation of PG_slab and PG_hugetlb Matthew Wilcox (Oracle)
2025-06-09  2:44   ` Harry Yoo
2025-06-06 22:22 ` [PATCH 07/10] proc: Remove mention of PG_slab Matthew Wilcox (Oracle)
2025-06-06 22:22 ` [PATCH 08/10] kfence: " Matthew Wilcox (Oracle)
2025-06-09  3:42   ` Harry Yoo
2025-06-09 13:33   ` Vlastimil Babka
2025-06-09 15:02     ` Matthew Wilcox
2025-06-10 13:23       ` Marco Elver
2025-06-06 22:22 ` [PATCH 09/10] memcg_slabinfo: Fix use " Matthew Wilcox (Oracle)
2025-06-09  3:08   ` Harry Yoo
2025-06-06 22:22 ` [PATCH 10/10] slab: Fix MAINTAINERS entry Matthew Wilcox (Oracle)
2025-06-09  3:21   ` Harry Yoo
2025-06-09 13:38   ` Vlastimil Babka
2025-06-09 13:59   ` Lorenzo Stoakes
2025-06-09 16:42     ` Christoph Lameter (Ampere)
2025-06-09 17:44       ` 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=aEZGBRW-2OsQ6ilr@hyeyoo \
    --to=harry.yoo@oracle.com \
    --cc=cl@gentwo.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.