* [PATCH] mm/memcg: alignment memcg_data define condition
@ 2024-07-08 6:32 alexs
2024-07-09 1:11 ` Suren Baghdasaryan
0 siblings, 1 reply; 2+ messages in thread
From: alexs @ 2024-07-08 6:32 UTC (permalink / raw)
To: Johannes Weiner, Andrew Morton, linux-mm, open list; +Cc: Alex Shi (Tencent)
From: "Alex Shi (Tencent)" <alexs@kernel.org>
commit 21c690a349ba ("mm: introduce slabobj_ext to support slab object
extensions") changed the folio/page->memcg_data define condition from
MEMCG to SLAB_OBJ_EXT. The code works well, since config SLAB_OBJ_EXT is
fold into MEMCG in init/Kconfig.
But many related functions that deal with memcg_data still defined under
MEMCG instead of SLAB_OBJ_EXT, and FOLIO_MATCH with memcg_data are defined
under MEMCG too. That looks weird and incorrect with memcg_data raw
meaning.
So let's put memcg_data under MEMCG config to alignment the definition
with FOLIO_MATCH and its usage in functions.
Signed-off-by: Alex Shi (Tencent) <alexs@kernel.org>
---
include/linux/mm_types.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index ef09c4eef6d3..c067db6fa711 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -180,7 +180,7 @@ struct page {
/* Usage count. *DO NOT USE DIRECTLY*. See page_ref.h */
atomic_t _refcount;
-#ifdef CONFIG_SLAB_OBJ_EXT
+#ifdef CONFIG_MEMCG
unsigned long memcg_data;
#endif
@@ -343,7 +343,7 @@ struct folio {
};
atomic_t _mapcount;
atomic_t _refcount;
-#ifdef CONFIG_SLAB_OBJ_EXT
+#ifdef CONFIG_MEMCG
unsigned long memcg_data;
#endif
#if defined(WANT_PAGE_VIRTUAL)
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/memcg: alignment memcg_data define condition
2024-07-08 6:32 [PATCH] mm/memcg: alignment memcg_data define condition alexs
@ 2024-07-09 1:11 ` Suren Baghdasaryan
0 siblings, 0 replies; 2+ messages in thread
From: Suren Baghdasaryan @ 2024-07-09 1:11 UTC (permalink / raw)
To: alexs; +Cc: Johannes Weiner, Andrew Morton, linux-mm, open list
On Sun, Jul 7, 2024 at 11:27 PM <alexs@kernel.org> wrote:
>
> From: "Alex Shi (Tencent)" <alexs@kernel.org>
>
> commit 21c690a349ba ("mm: introduce slabobj_ext to support slab object
> extensions") changed the folio/page->memcg_data define condition from
> MEMCG to SLAB_OBJ_EXT. The code works well, since config SLAB_OBJ_EXT is
> fold into MEMCG in init/Kconfig.
>
> But many related functions that deal with memcg_data still defined under
> MEMCG instead of SLAB_OBJ_EXT, and FOLIO_MATCH with memcg_data are defined
> under MEMCG too. That looks weird and incorrect with memcg_data raw
> meaning.
>
> So let's put memcg_data under MEMCG config to alignment the definition
> with FOLIO_MATCH and its usage in functions.
>
> Signed-off-by: Alex Shi (Tencent) <alexs@kernel.org>
Hi Alex,
I believe your change breaks this condition:
https://elixir.bootlin.com/linux/v6.10-rc7/source/mm/slab.h#L101
for the cases when CONFIG_SLAB_OBJ_EXT=y but CONFIG_MEMCG=n.
page.memcg_data will not be there to match slab.obj_exts.
You can test that by setting CONFIG_MEM_ALLOC_PROFILING=y and CONFIG_MEMCG=n.
Therefore sorry but NAK.
> ---
> include/linux/mm_types.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index ef09c4eef6d3..c067db6fa711 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -180,7 +180,7 @@ struct page {
> /* Usage count. *DO NOT USE DIRECTLY*. See page_ref.h */
> atomic_t _refcount;
>
> -#ifdef CONFIG_SLAB_OBJ_EXT
> +#ifdef CONFIG_MEMCG
> unsigned long memcg_data;
> #endif
>
> @@ -343,7 +343,7 @@ struct folio {
> };
> atomic_t _mapcount;
> atomic_t _refcount;
> -#ifdef CONFIG_SLAB_OBJ_EXT
> +#ifdef CONFIG_MEMCG
> unsigned long memcg_data;
> #endif
> #if defined(WANT_PAGE_VIRTUAL)
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-09 1:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-08 6:32 [PATCH] mm/memcg: alignment memcg_data define condition alexs
2024-07-09 1:11 ` Suren Baghdasaryan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox