Re: [PATCH] mm, memcg: reclaim more aggressively before high allocator throttling

From: Chris Down
Date: Thu May 28 2020 - 15:48:40 EST


Shakeel Butt writes:
What was the initial reason to have different behavior in the first place?

This differing behaviour is simply a mistake, it was never intended to be this deviate from what happens elsewhere. To that extent this patch is as much a bug fix as it is an improvement.

static void high_work_func(struct work_struct *work)
@@ -2378,16 +2384,20 @@ void mem_cgroup_handle_over_high(void)
{
unsigned long penalty_jiffies;
unsigned long pflags;
+ unsigned long nr_reclaimed;
unsigned int nr_pages = current->memcg_nr_pages_over_high;

Is there any benefit to keep current->memcg_nr_pages_over_high after
this change? Why not just use SWAP_CLUSTER_MAX?

I don't feel strongly either way, but current->memcg_nr_pages_over_high can be very large for large allocations.

That said, maybe we should just reclaim `max(SWAP_CLUSTER_MAX, current - high)` for each loop? I agree that with this design it looks like perhaps we don't need it any more.

Johannes, what do you think?