Re: [PATCH] mm: memcontrol: asynchronous reclaim for memory.high
From: Daniel Jordan
Date: Thu Feb 20 2020 - 13:25:49 EST
On Thu, Feb 20, 2020 at 10:56:51AM -0500, Tejun Heo wrote:
> On Thu, Feb 20, 2020 at 10:45:24AM -0500, Daniel Jordan wrote:
> > Ok, consistency with io and memory is one advantage to doing it that way.
> > Creating kthreads in cgroups also seems viable so far, and it's unclear whether
> > either approach is significantly simpler or more maintainable than the other,
> > at least to me.
> The problem with separate kthread approach is that many of these work
> units are tiny, and cgroup membership might not be known or doesn't
> agree with the processing context from the beginning
The amount of work wouldn't seem to matter as long as the kernel thread stays
in the cgroup and lives long enough. There's only the one-time cost of
attaching it when it's forked. That seems doable for unbound workqueues (the
async reclaim), but may not be for the network packets.
The membership and context issues are pretty compelling though. Good to know,
I'll keep it in mind as I think this through.
> For example, the ownership of network packets can't be determined till
> processing has progressed quite a bit in shared contexts and each item
> too small to bounce around. The only viable way I can think of
> splitting aggregate overhead according to the number of packets (or
> some other trivially measureable quntity) processed.
> Anything sitting in reclaim layer is the same. Reclaim should be
> charged to the cgroup whose memory is reclaimed *but* shouldn't block
> other cgroups which are waiting for that memory. It has to happen in
> the context of the highest priority entity waiting for memory but the
> costs incurred must be charged to the memory owners.
> So, one way or the other, I think we'll need back charging and once
> back charging is needed for big ticket items like network and reclaim,
> it's kinda silly to use separate mechanisms for other stuff.
Yes, having both would appear to be redundant.
> > Is someone on your side working on remote charging right now? I was planning
> > to post an RFD comparing these soon and it would make sense to include them.
> It's been on the to do list but nobody is working on it yet.