From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-mm@kvack.org
Cc: tglx@linutronix.de, Vlastimil Babka <vbabka@suse.cz>,
frederic@kernel.org,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 2/2] mm/swap: Access struct pagevec remotely
Date: Fri, 14 Sep 2018 16:59:24 +0200 [thread overview]
Message-ID: <20180914145924.22055-3-bigeasy@linutronix.de> (raw)
In-Reply-To: <20180914145924.22055-1-bigeasy@linutronix.de>
From: Thomas Gleixner <tglx@linutronix.de>
Now that struct pagevec is locked during access, it is possible to
access it from a remote CPU. The advantage is that the work can be done
from the "requesting" CPU without firing a worker on a remote CPU and
waiting for it to complete the work.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[bigeasy: +commit message]
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
mm/swap.c | 37 +------------------------------------
1 file changed, 1 insertion(+), 36 deletions(-)
diff --git a/mm/swap.c b/mm/swap.c
index 17702ee5bf81c..ec36e733aab5d 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -733,54 +733,19 @@ void lru_add_drain(void)
lru_add_drain_cpu(raw_smp_processor_id());
}
-static void lru_add_drain_per_cpu(struct work_struct *dummy)
-{
- lru_add_drain();
-}
-
-static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work);
-
-/*
- * Doesn't need any cpu hotplug locking because we do rely on per-cpu
- * kworkers being shut down before our page_alloc_cpu_dead callback is
- * executed on the offlined cpu.
- * Calling this function with cpu hotplug locks held can actually lead
- * to obscure indirect dependencies via WQ context.
- */
void lru_add_drain_all(void)
{
- static DEFINE_MUTEX(lock);
- static struct cpumask has_work;
int cpu;
- /*
- * Make sure nobody triggers this path before mm_percpu_wq is fully
- * initialized.
- */
- if (WARN_ON(!mm_percpu_wq))
- return;
-
- mutex_lock(&lock);
- cpumask_clear(&has_work);
-
for_each_online_cpu(cpu) {
- struct work_struct *work = &per_cpu(lru_add_drain_work, cpu);
-
if (pagevec_count(&per_cpu(lru_add_pvec.pvec, cpu)) ||
pagevec_count(&per_cpu(lru_rotate_pvecs.pvec, cpu)) ||
pagevec_count(&per_cpu(lru_deactivate_file_pvecs.pvec, cpu)) ||
pagevec_count(&per_cpu(lru_lazyfree_pvecs.pvec, cpu)) ||
need_activate_page_drain(cpu)) {
- INIT_WORK(work, lru_add_drain_per_cpu);
- queue_work_on(cpu, mm_percpu_wq, work);
- cpumask_set_cpu(cpu, &has_work);
+ lru_add_drain_cpu(cpu);
}
}
-
- for_each_cpu(cpu, &has_work)
- flush_work(&per_cpu(lru_add_drain_work, cpu));
-
- mutex_unlock(&lock);
}
/**
--
2.19.0
next prev parent reply other threads:[~2018-09-14 14:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-14 14:59 [PATCH 0/2] mm/swap: Add locking for pagevec Sebastian Andrzej Siewior
2018-09-14 14:59 ` [PATCH 1/2] mm/swap: Add pagevec locking Sebastian Andrzej Siewior
2018-09-30 3:16 ` [LKP] [mm/swap] d884021f52: will-it-scale.per_process_ops -2.4% regression kernel test robot
2018-09-30 8:17 ` Sebastian Andrzej Siewior
2018-09-14 14:59 ` Sebastian Andrzej Siewior [this message]
2018-11-09 23:06 ` [PATCH 2/2] mm/swap: Access struct pagevec remotely Andrew Morton
2018-10-12 7:21 ` [PATCH 0/2] mm/swap: Add locking for pagevec Vlastimil Babka
2018-10-15 9:50 ` Mel Gorman
2018-10-16 16:26 ` Frederic Weisbecker
2018-10-16 17:13 ` Thomas Gleixner
2018-10-16 19:54 ` Frederic Weisbecker
2018-10-16 20:44 ` Thomas Gleixner
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=20180914145924.22055-3-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=frederic@kernel.org \
--cc=linux-mm@kvack.org \
--cc=tglx@linutronix.de \
--cc=vbabka@suse.cz \
/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