All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <muchun.song@linux.dev>,
	Vlastimil Babka <vbabka@suse.cz>,
	Meta kernel team <kernel-team@meta.com>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Chris Mason <clm@fb.com>
Subject: Re: [PATCH] mm: memcg: fix unit conversion for K() macro in OOM log
Date: Wed, 17 Dec 2025 10:31:34 +0100	[thread overview]
Message-ID: <aUJ4dsVxsUj52hnz@tiehlicka> (raw)
In-Reply-To: <20251216212054.484079-1-shakeel.butt@linux.dev>

On Tue 16-12-25 13:20:54, Shakeel Butt wrote:
> The commit bc8e51c05ad5 ("mm: memcg: dump memcg protection info on oom
> or alloc failures") added functionality to dump memcg protections on OOM
> or allocation failures. It uses K() macro to dump the information and
> passes bytes to the macro. However the macro take number of pages
> instead of bytes. It is defined as:
> 
>  #define K(x) ((x) << (PAGE_SHIFT-10))
> 
> Let's fix this.
> 
> Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
> Reported-by: Chris Mason <clm@fb.com>
> Fixes: bc8e51c05ad5 ("mm: memcg: dump memcg protection info on oom or alloc failures")

Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!
> ---
>  mm/memcontrol.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index e2e49f4ec9e0..6f000f0e76d2 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5638,6 +5638,6 @@ void mem_cgroup_show_protected_memory(struct mem_cgroup *memcg)
>  		memcg = root_mem_cgroup;
>  
>  	pr_warn("Memory cgroup min protection %lukB -- low protection %lukB",
> -		K(atomic_long_read(&memcg->memory.children_min_usage)*PAGE_SIZE),
> -		K(atomic_long_read(&memcg->memory.children_low_usage)*PAGE_SIZE));
> +		K(atomic_long_read(&memcg->memory.children_min_usage)),
> +		K(atomic_long_read(&memcg->memory.children_low_usage)));
>  }
> -- 
> 2.47.3
> 

-- 
Michal Hocko
SUSE Labs

      parent reply	other threads:[~2025-12-17  9:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16 21:20 [PATCH] mm: memcg: fix unit conversion for K() macro in OOM log Shakeel Butt
2025-12-17  2:35 ` Muchun Song
2025-12-17  9:08 ` Vlastimil Babka
2025-12-17  9:31 ` 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=aUJ4dsVxsUj52hnz@tiehlicka \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=clm@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@meta.com \
    --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 \
    --cc=vbabka@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.