lkml.org 
[lkml]   [2018]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v2 8/8] mm: enable concurrent LRU adds
Date
Switch over to holding lru_lock as reader when splicing pages onto the
front of an LRU. The main benefit of doing this is to allow LRU adds
and removes to happen concurrently. Before this patch, an add blocks
all removing threads.

Suggested-by: Yosef Lev <levyossi@icloud.com>
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
---
mm/swap.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/mm/swap.c b/mm/swap.c
index fe3098c09815..ccd82ef3c217 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -999,9 +999,9 @@ void __pagevec_lru_add(struct pagevec *pvec)
*/
if (pagepgdat != pgdat) {
if (pgdat)
- write_unlock_irqrestore(&pgdat->lru_lock, flags);
+ read_unlock_irqrestore(&pgdat->lru_lock, flags);
pgdat = pagepgdat;
- write_lock_irqsave(&pgdat->lru_lock, flags);
+ read_lock_irqsave(&pgdat->lru_lock, flags);
}

lruvec = mem_cgroup_page_lruvec(page, pagepgdat);
@@ -1016,12 +1016,16 @@ void __pagevec_lru_add(struct pagevec *pvec)

if (splice->pgdat != pgdat) {
if (pgdat)
- write_unlock_irqrestore(&pgdat->lru_lock, flags);
+ read_unlock_irqrestore(&pgdat->lru_lock, flags);
pgdat = splice->pgdat;
- write_lock_irqsave(&pgdat->lru_lock, flags);
+ read_lock_irqsave(&pgdat->lru_lock, flags);
}
smp_list_splice(&splice->list, splice->lru);
}
+ if (pgdat) {
+ read_unlock_irqrestore(&pgdat->lru_lock, flags);
+ pgdat = NULL;
+ }

while (!list_empty(&singletons)) {
page = list_first_entry(&singletons, struct page, lru);
--
2.18.0
\
 
 \ /
  Last update: 2018-09-11 03:01    [W:0.139 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site