[PATCH] mm-page_alloc-use-static-global-work_struct-for-draining-per-cpu-pages-fix
From: Michal Hocko
Date: Tue Feb 07 2017 - 15:28:20 EST
From: Michal Hocko <mhocko@xxxxxxxx>
there is no need to have both pcpu_drain and pcpu_drain_mutex visible
outside of drain_all_pages. This might just attract abuse.
Signed-off-by: Michal Hocko <mhocko@xxxxxxxx>
---
Hi Andrew, Mel,
I think this would be a good cleanup to be folded into
mm-page_alloc-use-static-global-work_struct-for-draining-per-cpu-pages.patch.
mm/page_alloc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b6411816787a..6c48053bcd81 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -92,10 +92,6 @@ EXPORT_PER_CPU_SYMBOL(_numa_mem_);
int _node_numa_mem_[MAX_NUMNODES];
#endif
-/* work_structs for global per-cpu drains */
-DEFINE_MUTEX(pcpu_drain_mutex);
-DEFINE_PER_CPU(struct work_struct, pcpu_drain);
-
#ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
volatile unsigned long latent_entropy __latent_entropy;
EXPORT_SYMBOL(latent_entropy);
@@ -2364,6 +2360,8 @@ static void drain_local_pages_wq(struct work_struct *work)
*/
void drain_all_pages(struct zone *zone)
{
+ static DEFINE_PER_CPU(struct work_struct, pcpu_drain);
+ static DEFINE_MUTEX(pcpu_drain_mutex);
int cpu;
/*
--
2.11.0