[PATCH] memcg: Optimise relock_page_lruvec functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Leave interrupts disabled when we change which lru lock is held.

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
 include/linux/memcontrol.h | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 3096c9a0ee01..a6a90b00a22b 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -1524,16 +1524,22 @@ static inline bool page_matches_lruvec(struct page *page, struct lruvec *lruvec)
 }
 
 /* Don't lock again iff page's lruvec locked */
-static inline struct lruvec *relock_page_lruvec_irq(struct page *page,
+static inline struct lruvec *relock_page_lruvec(struct page *page,
 		struct lruvec *locked_lruvec)
 {
-	if (locked_lruvec) {
-		if (page_matches_lruvec(page, locked_lruvec))
-			return locked_lruvec;
+	if (page_matches_lruvec(page, locked_lruvec))
+		return locked_lruvec;
 
-		unlock_page_lruvec_irq(locked_lruvec);
-	}
+	unlock_page_lruvec(locked_lruvec);
+	return lock_page_lruvec(page);
+}
 
+/* Don't lock again iff page's lruvec locked */
+static inline struct lruvec *relock_page_lruvec_irq(struct page *page,
+		struct lruvec *locked_lruvec)
+{
+	if (locked_lruvec)
+		return relock_page_lruvec(page, locked_lruvec);
 	return lock_page_lruvec_irq(page);
 }
 
@@ -1541,13 +1547,8 @@ static inline struct lruvec *relock_page_lruvec_irq(struct page *page,
 static inline struct lruvec *relock_page_lruvec_irqsave(struct page *page,
 		struct lruvec *locked_lruvec, unsigned long *flags)
 {
-	if (locked_lruvec) {
-		if (page_matches_lruvec(page, locked_lruvec))
-			return locked_lruvec;
-
-		unlock_page_lruvec_irqrestore(locked_lruvec, *flags);
-	}
-
+	if (locked_lruvec)
+		return relock_page_lruvec(page, locked_lruvec);
 	return lock_page_lruvec_irqsave(page, flags);
 }
 
-- 
2.32.0





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux