Thread (17 messages) flat view 17 messages, 4 authors, 2021-02-18

Re: [RFC 1/2] mm: disable LRU pagevec during the migration temporarily

From: Michal Hocko <mhocko@suse.com>
Date: 2021-02-18 17:14:12
Also in: linux-fsdevel, lkml

On Thu 18-02-21 07:52:25, Minchan Kim wrote:
On Thu, Feb 18, 2021 at 09:17:02AM +0100, Michal Hocko wrote:
quoted
On Wed 17-02-21 13:32:05, Minchan Kim wrote:
quoted
On Wed, Feb 17, 2021 at 09:16:12PM +0000, Matthew Wilcox wrote:
quoted
On Wed, Feb 17, 2021 at 12:46:19PM -0800, Minchan Kim wrote:
quoted
quoted
I suspect you do not want to add atomic_read inside hot paths, right? Is
this really something that we have to microoptimize for? atomic_read is
a simple READ_ONCE on many archs.
It's also spin_lock_irq_save in some arch. If the new synchonization is
heavily compilcated, atomic would be better for simple start but I thought
this locking scheme is too simple so no need to add atomic operation in
readside.
What arch uses a spinlock for atomic_read()?  I just had a quick grep and
didn't see any.
Ah, my bad. I was confused with update side.
Okay, let's use atomic op to make it simple.
Thanks. This should make the code much more simple. Before you send
another version for the review I have another thing to consider. You are
kind of wiring this into the migration code but control over lru pcp
caches can be used in other paths as well. Memory offlining would be
another user. We already disable page allocator pcp caches to prevent
regular draining. We could do the same with lru pcp caches.
I didn't catch your point here. If memory offlining is interested on
disabling lru pcp, it could call migrate_prep and migrate_finish
like other places. Are you suggesting this one?
What I meant to say is that you can have a look at this not as an
integral part of the migration code but rather a common functionality
that migration and others can use. So instead of an implicit part of
migrate_prep this would become disable_lru_cache and migrate_finish
would become lruc_cache_enable. See my point? 

An advantage of that would be that this would match the pcp page
allocator disabling and we could have it in place for the whole
operation to make the page state more stable wrt. LRU state (PageLRU).
 
quoted hunk ↗ jump to hunk
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index a969463bdda4..0ec1c13bfe32 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1425,8 +1425,12 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
                node_clear(mtc.nid, nmask);
                if (nodes_empty(nmask))
                        node_set(mtc.nid, nmask);
+
+               migrate_prep();
                ret = migrate_pages(&source, alloc_migration_target, NULL,
                        (unsigned long)&mtc, MIGRATE_SYNC, MR_MEMORY_HOTPLUG);
+
+               migrate_finish();
                if (ret) {
                        list_for_each_entry(page, &source, lru) {
                                pr_warn("migrating pfn %lx failed ret:%d ",
-- 
Michal Hocko
SUSE Labs
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help