Vlastimil Babka writes:
@@ -948,7 +949,7 @@ void drop_slab_node(int nid)
do {
freed += shrink_slab(GFP_KERNEL, nid, memcg, 0);
} while ((memcg = mem_cgroup_iter(NULL, memcg, NULL)) != NULL);
- } while (freed > 10);
+ } while ((freed >> shift++) > 0);
I think this is a good idea, thanks for bringing it up :-)
I'm not sure about the bitshift idea, though. It certainly makes sure that even
large, continuous periods of reclaim eventually terminates, but I find it hard
to reason about -- for example, if there's a lot of parallel activity, that
might result in 10 constantly reintroduced pages, or 1000 pages, and it's not
immediately obvious that we should treat those differently.
What about using MAX_RECLAIM_RETRIES? There's already precedent for using it in
non-OOM scenarios, like mem_cgroup_handle_over_high.