Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Johannes Weiner and committed by
Linus Torvalds
68d48e6a 505802a5

+14 -2
+1
include/linux/mmzone.h
··· 161 161 NR_SLAB_UNRECLAIMABLE, 162 162 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */ 163 163 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */ 164 + WORKINGSET_NODES, 164 165 WORKINGSET_REFAULT, 165 166 WORKINGSET_ACTIVATE, 166 167 WORKINGSET_RESTORE,
+1
mm/vmstat.c
··· 1143 1143 "nr_slab_unreclaimable", 1144 1144 "nr_isolated_anon", 1145 1145 "nr_isolated_file", 1146 + "workingset_nodes", 1146 1147 "workingset_refault", 1147 1148 "workingset_activate", 1148 1149 "workingset_restore",
+12 -2
mm/workingset.c
··· 377 377 * already where they should be. The list_empty() test is safe 378 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 382 if (node->count && node->count == node->exceptional) { 381 - if (list_empty(&node->private_list)) 383 + if (list_empty(&node->private_list)) { 382 384 list_lru_add(&shadow_nodes, &node->private_list); 385 + __inc_lruvec_page_state(virt_to_page(node), 386 + WORKINGSET_NODES); 387 + } 383 388 } else { 384 - if (!list_empty(&node->private_list)) 389 + if (!list_empty(&node->private_list)) { 385 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 ··· 481 473 } 482 474 483 475 list_lru_isolate(lru, item); 476 + __dec_lruvec_page_state(virt_to_page(node), WORKINGSET_NODES); 477 + 484 478 spin_unlock(lru_lock); 485 479 486 480 /*