Re: [PATCH 2/3] mm: memcg: add a helper for non-unified stats flushing

From: Michal Koutný
Date: Tue Aug 22 2023 - 12:35:17 EST


On Tue, Aug 22, 2023 at 09:00:06AM -0700, Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
> We can probably also kick FLUSH_TIME forward as well.

True, they guard same work.

> Perhaps I can move both into do_stats_flush() then. If I understand
> correctly this is what you mean?

Yes.

> What do you think?

The latter is certainly better looking code.

I wasn't sure at first about moving stats_flush_threshold reset before
actual flush but on second thought it should not be a significant change
- readers: may skip flushing, the values that they read should still be
below the error threshold,
- writers: may be slowed down a bit (because of conditional atomic write
optimization in memcg_rstat_updates), presumably not on average
though.

So the latter should work too.

Michal

Attachment: signature.asc
Description: PGP signature