Re: [PATCH] mm: memcg: initialize *locked in memcg1_oom_prepare() stub
From: Breno Leitao
Date: Thu Jul 16 2026 - 09:54:12 EST
On Fri, Jun 26, 2026 at 05:04:45PM -0700, SeongJae Park wrote:
> On Fri, 26 Jun 2026 14:53:20 -0400 Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
> >
> > Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> >
> > I prefer this way over the idea to initialize in the caller. For the
> > actual implementation, the protocol is that the thing is initialized
> > when the function returns true. This version of the fix maintains that
> > for the dummy as well:
>
> I agree. I also feel the caller code is _slightly_ easier to read as is, than
> adding the initialization there. If it is initialized there, I would assume it
> will be used somewhere. But after finding out it is not used for early return
> cases including memcg1_oom_prepare() reuturning false case, I would be confused
> about the inefficiency. Using a variable after passing its pointer to a
> function depending on the function's return value makes me assume the variable
> will be set inside the function.
>
> The code is simple enough to read in any way, and my taste is sometimes just
> weird, though.
>
> Anyway nice fix, thank you!
>
> Reviewed-by: SeongJae Park <sj@xxxxxxxxxx>
Thanks! I'll respin with the Reviewed-by tags to reflect that these
points have been addressed.