Re: [PATCH bpf-next v3 4/6] memcg: Use trylock to access memcg stock_lock.

Michal Hocko
2024-12-21T07:20:11Z

On Fri 20-12-24 11:45:47, Shakeel Butt wrote:
[...]
> I think the code is fine as the overcharge amount will be refilled into
> the stock (old one will be flushed).
>
> if (gfpflags_allow_spinning(gfp_mask))
> batch = nr_pages;
>
> The above code will just avoid the refill and flushing the older stock.
> Maybe Michal's suggestion is due to that reason.

Exactly. This surely begs for a comment to explain that.

> BTW after the done_restock tag in try_charge_memcg(), we will another
> gfpflags_allow_spinning() check to avoid schedule_work() and
> mem_cgroup_handle_over_high(). Maybe simply return early for
> gfpflags_allow_spinning() without checking high marks.

Right you are.

Btw. I will be mostly offline until Jan 6.
--
Michal Hocko
SUSE Labs