From: Johannes Weiner <hannes@cmpxchg.org>
To: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Michal Hocko <mhocko@kernel.org>,
Shakeel Butt <shakeel.butt@linux.dev>,
Muchun Song <muchun.song@linux.dev>
Subject: Re: [PATCH v3 1/3] mm: memcg: don't call propagate_protected_usage() needlessly
Date: Fri, 26 Jul 2024 19:08:08 -0400 [thread overview]
Message-ID: <20240726230808.GD1702603@cmpxchg.org> (raw)
In-Reply-To: <20240726203110.1577216-2-roman.gushchin@linux.dev>
On Fri, Jul 26, 2024 at 08:31:08PM +0000, Roman Gushchin wrote:
> Memory protection (min/low) requires a constant tracking of
> protected memory usage. propagate_protected_usage() is called
> on each page counters update and does a number of operations
> even in cases when the actual memory protection functionality
> is not supported (e.g. hugetlb cgroups or memcg swap counters).
>
> It's obviously inefficient and leads to a waste of CPU cycles.
> It can be addressed by calling propagate_protected_usage() only
> for the counters which do support memory guarantees. As of now
> it's only memcg->memory - the unified memory memcg counter.
>
> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Makes perfect sense.
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> @@ -13,6 +13,11 @@
> #include <linux/bug.h>
> #include <asm/page.h>
>
> +static bool track_protection(struct page_counter *c)
> +{
> + return c->protection_support;
> +}
IMO it's a bit easier to follow without this. page_counter.c should be
able to access struct page_counter members directly :)
next prev parent reply other threads:[~2024-07-26 23:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 20:31 [PATCH v3 0/3] mm: memcg: page counters optimizations Roman Gushchin
2024-07-26 20:31 ` [PATCH v3 1/3] mm: memcg: don't call propagate_protected_usage() needlessly Roman Gushchin
2024-07-26 23:08 ` Johannes Weiner [this message]
2024-07-26 20:31 ` [PATCH v3 2/3] mm: page_counters: put page_counter_calculate_protection() under CONFIG_MEMCG Roman Gushchin
2024-07-26 23:09 ` Johannes Weiner
2024-07-26 20:31 ` [PATCH v3 3/3] mm: page_counters: initialize usage using ATOMIC_LONG_INIT() macro Roman Gushchin
2024-07-26 21:37 ` Shakeel Butt
2024-07-26 23:11 ` Johannes Weiner
2024-07-28 20:54 ` Andrew Morton
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=20240726230808.GD1702603@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
/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