From: Michal Hocko <mhocko@suse.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm: memcontrol: unshare v2-only charge API bits again
Date: Mon, 27 Jan 2025 13:50:44 +0100 [thread overview]
Message-ID: <Z5eBJIF0SPDLaeGg@tiehlicka> (raw)
In-Reply-To: <20250124043859.18808-1-hannes@cmpxchg.org>
On Thu 23-01-25 23:38:58, Johannes Weiner wrote:
> 6b611388b626 ("memcg-v1: remove charge move code") removed the
> remaining v1 callers.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Thanks!
> ---
> mm/memcontrol-v1.h | 15 ---------------
> mm/memcontrol.c | 17 +++++++++++++----
> 2 files changed, 13 insertions(+), 19 deletions(-)
>
> diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h
> index 144d71b65907..6dd7eaf96856 100644
> --- a/mm/memcontrol-v1.h
> +++ b/mm/memcontrol-v1.h
> @@ -7,21 +7,6 @@
>
> /* Cgroup v1 and v2 common declarations */
>
> -int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
> - unsigned int nr_pages);
> -
> -static inline int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
> - unsigned int nr_pages)
> -{
> - if (mem_cgroup_is_root(memcg))
> - return 0;
> -
> - return try_charge_memcg(memcg, gfp_mask, nr_pages);
> -}
> -
> -void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n);
> -void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n);
> -
> /*
> * Iteration constructs for visiting all cgroups (under a tree). If
> * loops are exited prematurely (break), mem_cgroup_iter_break() must
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 46f8b372d212..818143b81760 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2198,8 +2198,8 @@ void mem_cgroup_handle_over_high(gfp_t gfp_mask)
> css_put(&memcg->css);
> }
>
> -int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
> - unsigned int nr_pages)
> +static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
> + unsigned int nr_pages)
> {
> unsigned int batch = max(MEMCG_CHARGE_BATCH, nr_pages);
> int nr_retries = MAX_RECLAIM_RETRIES;
> @@ -2388,6 +2388,15 @@ int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
> return 0;
> }
>
> +static inline int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
> + unsigned int nr_pages)
> +{
> + if (mem_cgroup_is_root(memcg))
> + return 0;
> +
> + return try_charge_memcg(memcg, gfp_mask, nr_pages);
> +}
> +
> static void commit_charge(struct folio *folio, struct mem_cgroup *memcg)
> {
> VM_BUG_ON_FOLIO(folio_memcg_charged(folio), folio);
> @@ -3368,13 +3377,13 @@ static void mem_cgroup_id_remove(struct mem_cgroup *memcg)
> }
> }
>
> -void __maybe_unused mem_cgroup_id_get_many(struct mem_cgroup *memcg,
> +static void __maybe_unused mem_cgroup_id_get_many(struct mem_cgroup *memcg,
> unsigned int n)
> {
> refcount_add(n, &memcg->id.ref);
> }
>
> -void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
> +static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
> {
> if (refcount_sub_and_test(n, &memcg->id.ref)) {
> mem_cgroup_id_remove(memcg);
> --
> 2.48.1
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2025-01-27 12:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-24 4:38 Johannes Weiner
2025-01-24 4:38 ` [PATCH 2/2] mm: memcontrol: move stray ratelimit bits to v1 Johannes Weiner
2025-01-25 1:26 ` Roman Gushchin
2025-01-25 20:12 ` Shakeel Butt
2025-01-27 12:51 ` Michal Hocko
2025-01-25 1:27 ` [PATCH 1/2] mm: memcontrol: unshare v2-only charge API bits again Roman Gushchin
2025-01-25 20:11 ` Shakeel Butt
2025-01-27 12:50 ` Michal Hocko [this message]
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=Z5eBJIF0SPDLaeGg@tiehlicka \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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