@@ -133,6 +133,7 @@ struct reclaim_state {
unsigned long reclaimed_pages; /* pages freed by shrinkers */
unsigned long scanned_objects; /* quantity of work done */
unsigned long deferred_objects; /* work that wasn't done */
+ bool need_backoff; /* tell kswapd to slow down */
};
/*
@@ -2951,8 +2951,16 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
* implies that pages are cycling through the LRU
* faster than they are written so also forcibly stall.
*/
- if (sc->nr.immediate)
+ if (sc->nr.immediate) {
congestion_wait(BLK_RW_ASYNC, HZ/10);
+ } else if (reclaim_state && reclaim_state->need_backoff) {
+ /*
+ * Ditto, but it's a slab cache that is cycling
+ * through the LRU faster than they are written
+ */
+ congestion_wait(BLK_RW_ASYNC, HZ/10);
+ reclaim_state->need_backoff = false;
+ }
}
/*