diff mbox series

[2/2] mm: workingset: Replace IRQ-off check with a lockdep assert.

Message ID 20220301122143.1521823-3-bigeasy@linutronix.de (mailing list archive)
State New
Headers show
Series [1/2] cgroup: Use irqsave in cgroup_rstat_flush_locked(). | expand

Commit Message

Sebastian Andrzej Siewior March 1, 2022, 12:21 p.m. UTC
Commit
  68d48e6a2df57 ("mm: workingset: add vmstat counter for shadow nodes")

introduced an IRQ-off check to ensure that a lock is held which also
disabled interrupts. This does not work the same way on PREEMPT_RT
because none of the locks, that are held, disable interrupts.

Replace this check with a lockdep assert which ensures that the lock is
held.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 mm/workingset.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/workingset.c b/mm/workingset.c
index 2e4fd7c3296fe..8a3828acc0bfd 100644
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -434,6 +434,8 @@  struct list_lru shadow_nodes;
 
 void workingset_update_node(struct xa_node *node)
 {
+	struct address_space *mapping;
+
 	/*
 	 * Track non-empty nodes that contain only shadow entries;
 	 * unlink those that contain pages or are being freed.
@@ -442,7 +444,8 @@  void workingset_update_node(struct xa_node *node)
 	 * already where they should be. The list_empty() test is safe
 	 * as node->private_list is protected by the i_pages lock.
 	 */
-	VM_WARN_ON_ONCE(!irqs_disabled());  /* For __inc_lruvec_page_state */
+	mapping = container_of(node->array, struct address_space, i_pages);
+	lockdep_assert_held(&mapping->i_pages.xa_lock);
 
 	if (node->count && node->count == node->nr_values) {
 		if (list_empty(&node->private_list)) {