+ mm-list_lru-remove-holding-lru-lock.patch added to -mm tree
From: akpm@linux-foundation.org
Date: 2021-10-27 21:18:42
The patch titled
Subject: mm: list_lru: remove holding lru lock
has been added to the -mm tree. Its filename is
mm-list_lru-remove-holding-lru-lock.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-list_lru-remove-holding-lru-lock.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-list_lru-remove-holding-lru-lock.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Muchun Song <redacted>
Subject: mm: list_lru: remove holding lru lock
Since commit e5bc3af7734f ("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 <redacted>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Roman Gushchin <redacted>
Cc: Shakeel Butt <redacted>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/list_lru.c | 11 -----------
1 file changed, 11 deletions(-)
--- a/mm/list_lru.c~mm-list_lru-remove-holding-lru-lock
+++ a/mm/list_lru.c@@ -398,18 +398,7 @@ static int memcg_update_list_lru_node(st } 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; }
_ Patches currently in -mm which might be from songmuchun@bytedance.com are mm-list_lru-remove-holding-lru-lock.patch mm-list_lru-fix-the-return-value-of-list_lru_count_one.patch mm-memcontrol-remove-kmemcg_id-reparenting.patch mm-memcontrol-remove-the-kmem-states.patch