From: Daniel Jordan <daniel.m.jordan@oracle.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org
Cc: aaron.lu@intel.com, ak@linux.intel.com,
akpm@linux-foundation.org, dave.dice@oracle.com,
dave.hansen@linux.intel.com, hannes@cmpxchg.org,
levyossi@icloud.com, ldufour@linux.vnet.ibm.com,
mgorman@techsingularity.net, mhocko@kernel.org,
Pavel.Tatashin@microsoft.com, steven.sistare@oracle.com,
tim.c.chen@intel.com, vdavydov.dev@gmail.com,
ying.huang@intel.com
Subject: [RFC PATCH v2 5/8] mm: enable concurrent LRU removals
Date: Mon, 10 Sep 2018 20:59:46 -0400 [thread overview]
Message-ID: <20180911005949.5635-2-daniel.m.jordan@oracle.com> (raw)
In-Reply-To: <20180911004240.4758-1-daniel.m.jordan@oracle.com>
The previous patch used the concurrent algorithm serially to see that it
was stable for one task. Now in release_pages, take lru_lock as reader
instead of writer to allow concurrent removals from one or more LRUs.
Suggested-by: Yosef Lev <levyossi@icloud.com>
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
---
mm/swap.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/mm/swap.c b/mm/swap.c
index 613b841bd208..b1030eb7f459 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -737,8 +737,8 @@ void release_pages(struct page **pages, int nr)
* same pgdat. The lock is held only if pgdat != NULL.
*/
if (locked_pgdat && ++lock_batch == SWAP_CLUSTER_MAX) {
- write_unlock_irqrestore(&locked_pgdat->lru_lock,
- flags);
+ read_unlock_irqrestore(&locked_pgdat->lru_lock,
+ flags);
locked_pgdat = NULL;
}
@@ -748,9 +748,8 @@ void release_pages(struct page **pages, int nr)
/* Device public page can not be huge page */
if (is_device_public_page(page)) {
if (locked_pgdat) {
- write_unlock_irqrestore(
- &locked_pgdat->lru_lock,
- flags);
+ read_unlock_irqrestore(&locked_pgdat->lru_lock,
+ flags);
locked_pgdat = NULL;
}
put_zone_device_private_or_public_page(page);
@@ -763,9 +762,8 @@ void release_pages(struct page **pages, int nr)
if (PageCompound(page)) {
if (locked_pgdat) {
- write_unlock_irqrestore(
- &locked_pgdat->lru_lock,
- flags);
+ read_unlock_irqrestore(&locked_pgdat->lru_lock,
+ flags);
locked_pgdat = NULL;
}
__put_compound_page(page);
@@ -776,14 +774,14 @@ void release_pages(struct page **pages, int nr)
struct pglist_data *pgdat = page_pgdat(page);
if (pgdat != locked_pgdat) {
- if (locked_pgdat) {
- write_unlock_irqrestore(
- &locked_pgdat->lru_lock, flags);
- }
+ if (locked_pgdat)
+ read_unlock_irqrestore(
+ &locked_pgdat->lru_lock,
+ flags);
lock_batch = 0;
locked_pgdat = pgdat;
- write_lock_irqsave(&locked_pgdat->lru_lock,
- flags);
+ read_lock_irqsave(&locked_pgdat->lru_lock,
+ flags);
}
lruvec = mem_cgroup_page_lruvec(page, locked_pgdat);
@@ -800,7 +798,7 @@ void release_pages(struct page **pages, int nr)
list_add(&page->lru, &pages_to_free);
}
if (locked_pgdat)
- write_unlock_irqrestore(&locked_pgdat->lru_lock, flags);
+ read_unlock_irqrestore(&locked_pgdat->lru_lock, flags);
mem_cgroup_uncharge_list(&pages_to_free);
free_unref_page_list(&pages_to_free);
--
2.18.0
next prev parent reply other threads:[~2018-09-11 1:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-11 0:42 [RFC PATCH v2 0/8] lru_lock scalability and SMP list functions Daniel Jordan
2018-09-11 0:42 ` [RFC PATCH v2 1/8] mm, memcontrol.c: make memcg lru stats thread-safe without lru_lock Daniel Jordan
2018-09-11 16:32 ` Laurent Dufour
2018-09-12 13:28 ` Daniel Jordan
2018-09-11 0:42 ` [RFC PATCH v2 2/8] mm: make zone_reclaim_stat updates thread-safe Daniel Jordan
2018-09-11 16:40 ` Laurent Dufour
2018-09-12 13:30 ` Daniel Jordan
2018-09-11 0:42 ` [RFC PATCH v2 3/8] mm: convert lru_lock from a spinlock_t to a rwlock_t Daniel Jordan
2018-09-11 0:59 ` [RFC PATCH v2 4/8] mm: introduce smp_list_del for concurrent list entry removals Daniel Jordan
2018-09-11 0:59 ` Daniel Jordan [this message]
2018-09-11 0:59 ` [RFC PATCH v2 6/8] mm: splice local lists onto the front of the LRU Daniel Jordan
2018-09-11 0:59 ` [RFC PATCH v2 7/8] mm: introduce smp_list_splice to prepare for concurrent LRU adds Daniel Jordan
2018-09-11 0:59 ` [RFC PATCH v2 8/8] mm: enable " Daniel Jordan
2018-10-19 11:35 ` [RFC PATCH v2 0/8] lru_lock scalability and SMP list functions Vlastimil Babka
2018-10-19 15:35 ` Daniel Jordan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180911005949.5635-2-daniel.m.jordan@oracle.com \
--to=daniel.m.jordan@oracle.com \
--cc=Pavel.Tatashin@microsoft.com \
--cc=aaron.lu@intel.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=dave.dice@oracle.com \
--cc=dave.hansen@linux.intel.com \
--cc=hannes@cmpxchg.org \
--cc=ldufour@linux.vnet.ibm.com \
--cc=levyossi@icloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@kernel.org \
--cc=steven.sistare@oracle.com \
--cc=tim.c.chen@intel.com \
--cc=vdavydov.dev@gmail.com \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).