Re: [PATCH v2 4/4] mm: memcontrol: fix unexpected massive positive number in memcg_state_val_in_pages()
From: Lorenzo Stoakes (Oracle)
Date: Thu Mar 26 2026 - 05:27:40 EST
On Thu, Mar 26, 2026 at 09:16:50AM +0000, Lorenzo Stoakes (Oracle) wrote:
> /* Get the absolute value of (val * unit / PAGE_SIZE). */
> res = mult_frac(abs(val), unit, PAGE_SIZE);
> /* Round up zero values. */
> res = res ?: 1;
> /* Retain sign. */
> return val < 0 ? -res : res;
(If you think the comments are too much, you can drop them, and the code
essentially spells it out anyway)
Cheers, Lorenzo