1 files changed, 6 insertions, 1 deletions
@@ -1724,8 +1724,13 @@ static int ksm_memory_callback(struct notifier_block *self,
* Keep it very simple for now: just lock out ksmd and
* MADV_UNMERGEABLE while any memory is going offline.
+ * mutex_lock_nested() is necessary because lockdep was alarmed
+ * that here we take ksm_thread_mutex inside notifier chain
+ * mutex, and later take notifier chain mutex inside
+ * ksm_thread_mutex to unlock it. But that's safe because both
+ * are inside mem_hotplug_mutex.
+ mutex_lock_nested(&ksm_thread_mutex, SINGLE_DEPTH_NESTING);