From nobody Thu Dec 18 23:21:42 2025 Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31ABD309DCB for ; Tue, 16 Dec 2025 21:21:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765920086; cv=none; b=ZJac+vZytuouA9cPTawrTtcvIOu3zvOuMgha8+/w9t9iL5q371ZgZJhziYybiSznpXQjSn11H/ryjGUc57BXE7Sox89rpo4g3NAi1H+lVWxTs/r67TXXEnqq+oVojbGrs36pjjEe/wHdknSB27ugO8bgXyaqizpzjUFf7YTAz10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765920086; c=relaxed/simple; bh=8Xo+YlPqEZ2Y1elD3Kdie3P6r3c7tGNOIT866GNXXd4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MppxdGHkb6y3hx7S1q+kaaWI6I3tvyET4fwD2S+aVd0WV6dPj/e979BN2H6cXsAuzTXIRrVl51bK7O0rhgLA5E5UTAxbIrYVmJ4HDXvPIUvOq/DM4TMdsalWQvVmyr9+/0osldi+1LPbNLi0vUoYO5PPoi/+1f5qLXgJhn755hs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ey6woMYF; arc=none smtp.client-ip=91.218.175.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ey6woMYF" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1765920067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZfOZ1kb7S1+OirlSYPDDjGrFljxGcHFaYN634TXPH08=; b=ey6woMYFLSuMSGJ1GMOKxV+l8NVP/+hqcWLToOCCN8rcLfAqLUsKHsuJRwZ3uujYyzJ+6J lZYR2kyyxmQ9XQWq2j1kzCRssuqMk0y2gA/0F8U9allCiqWgajBlM8r99+6pDuBt41blWU RGOISzMUDyPXqnXzHwJrh8fqrbDeYZ0= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Vlastimil Babka , Meta kernel team , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chris Mason Subject: [PATCH] mm: memcg: fix unit conversion for K() macro in OOM log Date: Tue, 16 Dec 2025 13:20:54 -0800 Message-ID: <20251216212054.484079-1-shakeel.butt@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" 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 Reported-by: Chris Mason Fixes: bc8e51c05ad5 ("mm: memcg: dump memcg protection info on oom or alloc= failures") Acked-by: Michal Hocko Acked-by: Vlastimil Babka Reviewed-by: Muchun Song --- 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_cgro= up *memcg) memcg =3D root_mem_cgroup; =20 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))); } --=20 2.47.3