summaryrefslogtreecommitdiffstats
path: root/mm/workingset.c
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2018-10-26 18:06:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-26 19:26:33 -0400
commit68d48e6a2df575b935edd420396c3cb8b6aa6ad3 (patch)
tree65782c01f3abd521fffc93ea78166915882ddb57 /mm/workingset.c
parent505802a53510e54ad5fbbd655a68893df83bfb91 (diff)
mm: workingset: add vmstat counter for shadow nodes
Make it easier to catch bugs in the shadow node shrinker by adding a counter for the shadow nodes in circulation. [akpm@linux-foundation.org: assert that irqs are disabled, for __inc_lruvec_page_state()] [akpm@linux-foundation.org: s/WARN_ON_ONCE/VM_WARN_ON_ONCE/, per Johannes] Link: http://lkml.kernel.org/r/20181009184732.762-4-hannes@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/workingset.c')
-rw-r--r--mm/workingset.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/mm/workingset.c b/mm/workingset.c
index 5a72c9d5e195..7e6ef312cea5 100644
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -377,12 +377,20 @@ void workingset_update_node(struct radix_tree_node *node)
377 * already where they should be. The list_empty() test is safe 377 * already where they should be. The list_empty() test is safe
378 * as node->private_list is protected by the i_pages lock. 378 * as node->private_list is protected by the i_pages lock.
379 */ 379 */
380 VM_WARN_ON_ONCE(!irqs_disabled()); /* For __inc_lruvec_page_state */
381
380 if (node->count && node->count == node->exceptional) { 382 if (node->count && node->count == node->exceptional) {
381 if (list_empty(&node->private_list)) 383 if (list_empty(&node->private_list)) {
382 list_lru_add(&shadow_nodes, &node->private_list); 384 list_lru_add(&shadow_nodes, &node->private_list);
385 __inc_lruvec_page_state(virt_to_page(node),
386 WORKINGSET_NODES);
387 }
383 } else { 388 } else {
384 if (!list_empty(&node->private_list)) 389 if (!list_empty(&node->private_list)) {
385 list_lru_del(&shadow_nodes, &node->private_list); 390 list_lru_del(&shadow_nodes, &node->private_list);
391 __dec_lruvec_page_state(virt_to_page(node),
392 WORKINGSET_NODES);
393 }
386 } 394 }
387} 395}
388 396
@@ -473,6 +481,8 @@ static enum lru_status shadow_lru_isolate(struct list_head *item,
473 } 481 }
474 482
475 list_lru_isolate(lru, item); 483 list_lru_isolate(lru, item);
484 __dec_lruvec_page_state(virt_to_page(node), WORKINGSET_NODES);
485
476 spin_unlock(lru_lock); 486 spin_unlock(lru_lock);
477 487
478 /* 488 /*