mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 01:04:08 +08:00
mm: list_lru: remove holding lru lock
Since commit e5bc3af773
("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/20211025124534.56345-1-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
58056f7750
commit
60ec6a48ee
@ -398,18 +398,7 @@ static int memcg_update_list_lru_node(struct list_lru_node *nlru,
|
||||
}
|
||||
|
||||
memcpy(&new->lru, &old->lru, flex_array_size(new, lru, old_size));
|
||||
|
||||
/*
|
||||
* The locking below allows readers that hold nlru->lock avoid taking
|
||||
* rcu_read_lock (see list_lru_from_memcg_idx).
|
||||
*
|
||||
* Since list_lru_{add,del} may be called under an IRQ-safe lock,
|
||||
* we have to use IRQ-safe primitives here to avoid deadlock.
|
||||
*/
|
||||
spin_lock_irq(&nlru->lock);
|
||||
rcu_assign_pointer(nlru->memcg_lrus, new);
|
||||
spin_unlock_irq(&nlru->lock);
|
||||
|
||||
kvfree_rcu(old, rcu);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user