[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJD7tkY+atjCn=3o4tCKt-PsRveMbv5mzM+QppqM6jBGHUnwqg@mail.gmail.com>
Date: Wed, 24 Jul 2024 16:17:55 -0700
From: Yosry Ahmed <yosryahmed@...gle.com>
To: Pasha Tatashin <pasha.tatashin@...een.com>
Cc: akpm@...ux-foundation.org, jpoimboe@...nel.org, kent.overstreet@...ux.dev,
peterz@...radead.org, nphamcs@...il.com, cerasuolodomenico@...il.com,
surenb@...gle.com, lizhijian@...itsu.com, willy@...radead.org,
shakeel.butt@...ux.dev, vbabka@...e.cz, ziy@...dia.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v5 1/3] memcg: increase the valid index range for memcg stats
On Wed, Jul 24, 2024 at 1:33 PM Pasha Tatashin
<pasha.tatashin@...een.com> wrote:
>
> From: Shakeel Butt <shakeel.butt@...ux.dev>
>
> At the moment the valid index for the indirection tables for memcg stats
> and events is < S8_MAX. These indirection tables are used in performance
> critical codepaths. With the latest addition to the vm_events, the
> NR_VM_EVENT_ITEMS has gone over S8_MAX. One way to resolve is to
> increase the entry size of the indirection table from int8_t to int16_t
> but this will increase the potential number of cachelines needed to
> access the indirection table.
>
> This patch took a different approach and make the valid index < U8_MAX.
> In this way the size of the indirection tables will remain same and we
> only need to invalid index check from less than 0 to equal to U8_MAX.
> In this approach we have also removed a subtraction from the performance
> critical codepaths.
>
> Signed-off-by: Shakeel Butt <shakeel.butt@...ux.dev>
> Co-developed-by: Pasha Tatashin <pasha.tatashin@...een.com>
> Signed-off-by: Pasha Tatashin <pasha.tatashin@...een.com>
> ---
> mm/memcontrol.c | 50 +++++++++++++++++++++++++++----------------------
> 1 file changed, 28 insertions(+), 22 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 960371788687..2fdeece7f1f8 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -320,24 +320,27 @@ static const unsigned int memcg_stat_items[] = {
> #define NR_MEMCG_NODE_STAT_ITEMS ARRAY_SIZE(memcg_node_stat_items)
> #define MEMCG_VMSTAT_SIZE (NR_MEMCG_NODE_STAT_ITEMS + \
> ARRAY_SIZE(memcg_stat_items))
> -static int8_t mem_cgroup_stats_index[MEMCG_NR_STAT] __read_mostly;
> +#define IS_INVALID(index) ((index) == U8_MAX)
The use of this macro extends well into this file, should we use a
more specific name (e.g. IS_VALID_STATS_IDX())?
Powered by blists - more mailing lists