Skip to content

Commit 60ec6a4

Browse files
Muchun Songtorvalds
authored andcommitted
mm: list_lru: remove holding lru lock
Since commit e5bc3af ("rcu: Consolidate PREEMPT and !PREEMPT synchronize_rcu()"), the critical section of spin lock can serve as an RCU read-side critical section which already allows readers that hold nlru->lock to avoid taking rcu lock. So just remove holding lock. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Muchun Song <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Roman Gushchin <[email protected]> Cc: Shakeel Butt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 58056f7 commit 60ec6a4

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

mm/list_lru.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -398,18 +398,7 @@ static int memcg_update_list_lru_node(struct list_lru_node *nlru,
398398
}
399399

400400
memcpy(&new->lru, &old->lru, flex_array_size(new, lru, old_size));
401-
402-
/*
403-
* The locking below allows readers that hold nlru->lock avoid taking
404-
* rcu_read_lock (see list_lru_from_memcg_idx).
405-
*
406-
* Since list_lru_{add,del} may be called under an IRQ-safe lock,
407-
* we have to use IRQ-safe primitives here to avoid deadlock.
408-
*/
409-
spin_lock_irq(&nlru->lock);
410401
rcu_assign_pointer(nlru->memcg_lrus, new);
411-
spin_unlock_irq(&nlru->lock);
412-
413402
kvfree_rcu(old, rcu);
414403
return 0;
415404
}

0 commit comments

Comments
 (0)