lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed,  5 Feb 2014 10:29:03 -0600
From:	Nathan Zimmer <nzimmer@....com>
To:	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc:	Nathan Zimmer <nzimmer@....com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Tang Chen <tangchen@...fujitsu.com>,
	Wen Congyang <wency@...fujitsu.com>,
	Toshi Kani <toshi.kani@...com>,
	Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>,
	Xishi Qiu <qiuxishi@...wei.com>,
	Cody P Schafer <cody@...ux.vnet.ibm.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	David Rientjes <rientjes@...gle.com>,
	Jiang Liu <liuj97@...il.com>, Hedi Berriche <hedi@....com>,
	Mike Travis <travis@....com>
Subject: [RFC] Move the memory_notifier out of the memory_hotplug lock

There are a few spots where we call memory_notifier. This doesn't need to be
done under lock since memory_notify is just a blocking_notifier_call_chain
with it's own locking mechanism.

This RFC is a follow on to the one I submitted earlier.
(move register_memory_resource out of the lock_memory_hotplug, commit ac13c46)
Most of our time is being spend under the memory hotplug lock in particular
online_pages() so it makes sense to move out everything that can be easily
moved out.

However perf pointed me to a spot to work on, setup_zone_migrate_reserve.
In fact most of the time is spent there.  Since that is going to require
more reading and time I will start by whittling out some easy pieces.

cc: Andrew Morton <akpm@...ux-foundation.org>
cc: Tang Chen <tangchen@...fujitsu.com>
cc: Wen Congyang <wency@...fujitsu.com>
cc: Toshi Kani <toshi.kani@...com>
cc: Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>
cc: Xishi Qiu <qiuxishi@...wei.com>
cc: Cody P Schafer <cody@...ux.vnet.ibm.com>
cc: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
cc: David Rientjes <rientjes@...gle.com>
cc: Jiang Liu <liuj97@...il.com>
Cc: Hedi Berriche <hedi@....com>
Cc: Mike Travis <travis@....com>
linux-mm@...ck.org (open list:MEMORY MANAGEMENT)
linux-kernel@...r.kernel.org (open list)

---
 mm/memory_hotplug.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 62a0cd1..a3cbd14 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -985,12 +985,12 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
 		if (need_zonelists_rebuild)
 			zone_pcp_reset(zone);
 		mutex_unlock(&zonelists_mutex);
+		unlock_memory_hotplug();
 		printk(KERN_DEBUG "online_pages [mem %#010llx-%#010llx] failed\n",
 		       (unsigned long long) pfn << PAGE_SHIFT,
 		       (((unsigned long long) pfn + nr_pages)
 			    << PAGE_SHIFT) - 1);
 		memory_notify(MEM_CANCEL_ONLINE, &arg);
-		unlock_memory_hotplug();
 		return ret;
 	}
 
@@ -1016,9 +1016,10 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ
 
 	writeback_set_ratelimit();
 
+	unlock_memory_hotplug();
+
 	if (onlined_pages)
 		memory_notify(MEM_ONLINE, &arg);
-	unlock_memory_hotplug();
 
 	return 0;
 }
@@ -1601,8 +1602,8 @@ repeat:
 	vm_total_pages = nr_free_pagecache_pages();
 	writeback_set_ratelimit();
 
-	memory_notify(MEM_OFFLINE, &arg);
 	unlock_memory_hotplug();
+	memory_notify(MEM_OFFLINE, &arg);
 	return 0;
 
 failed_removal:
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ