From: Yosry Ahmed <yosryahmed@google.com>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: akpm@linux-foundation.org, jpoimboe@kernel.org,
kent.overstreet@linux.dev, peterz@infradead.org,
nphamcs@gmail.com, cerasuolodomenico@gmail.com,
surenb@google.com, lizhijian@fujitsu.com, willy@infradead.org,
shakeel.butt@linux.dev, vbabka@suse.cz, ziy@nvidia.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v5 1/3] memcg: increase the valid index range for memcg stats
Date: Wed, 24 Jul 2024 16:17:55 -0700 [thread overview]
Message-ID: <CAJD7tkY+atjCn=3o4tCKt-PsRveMbv5mzM+QppqM6jBGHUnwqg@mail.gmail.com> (raw)
In-Reply-To: <20240724203322.2765486-2-pasha.tatashin@soleen.com>
On Wed, Jul 24, 2024 at 1:33 PM Pasha Tatashin
<pasha.tatashin@soleen.com> wrote:
>
> From: Shakeel Butt <shakeel.butt@linux.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@linux.dev>
> Co-developed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.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())?
next prev parent reply other threads:[~2024-07-24 23:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 20:33 [PATCH v5 0/3] Kernel stack usage histogram Pasha Tatashin
2024-07-24 20:33 ` [PATCH v5 1/3] memcg: increase the valid index range for memcg stats Pasha Tatashin
2024-07-24 23:17 ` Yosry Ahmed [this message]
2024-07-25 14:25 ` Pasha Tatashin
2024-07-24 20:33 ` [PATCH v5 2/3] vmstat: Kernel stack usage histogram Pasha Tatashin
2024-07-24 20:49 ` Shakeel Butt
2024-07-24 20:33 ` [PATCH v5 3/3] task_stack: uninline stack_not_used Pasha Tatashin
2024-07-24 20:50 ` Shakeel Butt
2024-07-25 14:30 ` Pasha Tatashin
2024-07-25 15:57 ` Shakeel Butt
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='CAJD7tkY+atjCn=3o4tCKt-PsRveMbv5mzM+QppqM6jBGHUnwqg@mail.gmail.com' \
--to=yosryahmed@google.com \
--cc=akpm@linux-foundation.org \
--cc=cerasuolodomenico@gmail.com \
--cc=jpoimboe@kernel.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizhijian@fujitsu.com \
--cc=nphamcs@gmail.com \
--cc=pasha.tatashin@soleen.com \
--cc=peterz@infradead.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=ziy@nvidia.com \
/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