Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 82202b6f authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

mm/memory_hotplug: Fix deadlock in try_online_one_block()



There is a possible scenario where the system can deadlock
itself when it is low on memory, and attempts to online
a memory block. Consider the following scenario:

 -A thread in userspace onlines a memory block through sysfs-
 state_store() /* Acquires the device_hotplug_lock */
 device_online()
 memory_subsys_online()
 memory_block_change_state()
 memory_block_action()
 online_pages()
 memory_notify(MEM_GOING_ONLINE, ...)
 online_page_ext()
 alloc_page_ext()
 __alloc_pages_nodemask(GFP_KERNEL, ...)
 /* System enters into a critically low memory state */
 out_of_memory()
 try_online_one_block() /* Invokes lock_device_hotplug() and deadlocks */

Fix deadlock by introducing and using trylock_device_hotplug()
instead of lock_device_hotplug().

Change-Id: I52bc8075ae713c50e3c381216f3616ce8366cf31
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent c322899f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment