Intel 0day report there are performance regression on this patchset. The detailed info points to rcu_read_lock + PROVE_LOCKING which causes queued_spin_lock_slowpath waiting too long time to get lock. Remove rcu_read_lock is safe here since we had a spinlock hold. Reported-by: kbuild test robot <lkp@xxxxxxxxx> Signed-off-by: Alex Shi <alex.shi@xxxxxxxxxxxxxxxxx> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Roman Gushchin <guro@xxxxxx> Cc: Shakeel Butt <shakeelb@xxxxxxxxxx> Cc: Chris Down <chris@xxxxxxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: linux-mm@xxxxxxxxx Cc: linux-kernel@xxxxxxxxxxxxxxx --- include/linux/memcontrol.h | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 2421b720d272..f869897a68f0 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1307,20 +1307,18 @@ static inline struct lruvec *relock_page_lruvec_irq(struct page *page, struct pglist_data *pgdat = page_pgdat(page); struct lruvec *lruvec; - rcu_read_lock(); + if (!locked_lruvec) + goto lock; + lruvec = mem_cgroup_page_lruvec(page, pgdat); - if (locked_lruvec == lruvec) { - rcu_read_unlock(); + if (locked_lruvec == lruvec) return lruvec; - } - rcu_read_unlock(); - if (locked_lruvec) - spin_unlock_irq(&locked_lruvec->lru_lock); + spin_unlock_irq(&locked_lruvec->lru_lock); +lock: lruvec = lock_page_lruvec_irq(page, pgdat); - return lruvec; } @@ -1331,21 +1329,18 @@ static inline struct lruvec *relock_page_lruvec_irqsave(struct page *page, struct pglist_data *pgdat = page_pgdat(page); struct lruvec *lruvec; - rcu_read_lock(); + if (!locked_lruvec) + goto lock; + lruvec = mem_cgroup_page_lruvec(page, pgdat); - if (locked_lruvec == lruvec) { - rcu_read_unlock(); + if (locked_lruvec == lruvec) return lruvec; - } - rcu_read_unlock(); - if (locked_lruvec) - spin_unlock_irqrestore(&locked_lruvec->lru_lock, - locked_lruvec->flags); + spin_unlock_irqrestore(&locked_lruvec->lru_lock, locked_lruvec->flags); +lock: lruvec = lock_page_lruvec_irqsave(page, pgdat); - return lruvec; } -- 1.8.3.1