linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 resend] mm/memory_hotplug: Make unpopulated zones PCP structures unreachable during hot remove
@ 2021-04-12 12:08 Mel Gorman
  2021-04-12 12:12 ` David Hildenbrand
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Mel Gorman @ 2021-04-12 12:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Oscar Salvador, Michael S. Tsirkin, Vlastimil Babka,
	Alexander Duyck, Minchan Kim, Michal Hocko, David Hildenbrand,
	Linux-MM, LKML

zone_pcp_reset allegedly protects against a race with drain_pages
using local_irq_save but this is bogus. local_irq_save only operates
on the local CPU. If memory hotplug is running on CPU A and drain_pages
is running on CPU B, disabling IRQs on CPU A does not affect CPU B and
offers no protection.

This patch deletes IRQ disable/enable on the grounds that IRQs protect
nothing and assumes the existing hotplug paths guarantees the PCP cannot be
used after zone_pcp_enable(). That should be the case already because all
the pages have been freed and there is no page to put on the PCP lists.

Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
---
Resending for email address correction and adding lists

Changelog since v1
o Minimal fix

 mm/page_alloc.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5e8aedb64b57..9bf0db982f14 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8952,12 +8952,9 @@ void zone_pcp_enable(struct zone *zone)
 
 void zone_pcp_reset(struct zone *zone)
 {
-	unsigned long flags;
 	int cpu;
 	struct per_cpu_pageset *pset;
 
-	/* avoid races with drain_pages()  */
-	local_irq_save(flags);
 	if (zone->pageset != &boot_pageset) {
 		for_each_online_cpu(cpu) {
 			pset = per_cpu_ptr(zone->pageset, cpu);
@@ -8966,7 +8963,6 @@ void zone_pcp_reset(struct zone *zone)
 		free_percpu(zone->pageset);
 		zone->pageset = &boot_pageset;
 	}
-	local_irq_restore(flags);
 }
 
 #ifdef CONFIG_MEMORY_HOTREMOVE

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-04-14  7:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 12:08 [PATCH v2 resend] mm/memory_hotplug: Make unpopulated zones PCP structures unreachable during hot remove Mel Gorman
2021-04-12 12:12 ` David Hildenbrand
2021-04-12 12:40 ` Vlastimil Babka
2021-04-12 14:08   ` Mel Gorman
2021-04-12 14:12     ` David Hildenbrand
2021-04-12 15:27       ` Mel Gorman
2021-04-12 16:02         ` David Hildenbrand
2021-04-13  9:36     ` Vlastimil Babka
2021-04-13  9:49       ` Mel Gorman
2021-04-13 10:16       ` Michal Hocko
2021-04-13  6:44   ` Michal Hocko
2021-04-13  6:40 ` Michal Hocko
2021-04-14  7:18 ` Oscar Salvador

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).