The patch titled Subject: block/genhd.c: apply pm_runtime_set_memalloc_noio on block devices has been added to the -mm tree. Its filename is block-genhdc-apply-pm_runtime_set_memalloc_noio-on-block-devices.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Ming Lei <ming.lei@xxxxxxxxxxxxx> Subject: block/genhd.c: apply pm_runtime_set_memalloc_noio on block devices Apply the introduced pm_runtime_set_memalloc_noio on block device so that PM core will teach mm to not allocate memory with GFP_IOFS when calling the runtime_resume and runtime_suspend callback for block devices and its ancestors. Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> Cc: Oliver Neukum <oneukum@xxxxxxx> Cc: Jiri Kosina <jiri.kosina@xxxxxxxx> Cc: Mel Gorman <mel@xxxxxxxxx> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: "Rafael J. Wysocki" <rjw@xxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> Cc: Eric Dumazet <eric.dumazet@xxxxxxxxx> Cc: David Decotigny <david.decotigny@xxxxxxxxxx> Cc: Tom Herbert <therbert@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- block/genhd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff -puN block/genhd.c~block-genhdc-apply-pm_runtime_set_memalloc_noio-on-block-devices block/genhd.c --- a/block/genhd.c~block-genhdc-apply-pm_runtime_set_memalloc_noio-on-block-devices +++ a/block/genhd.c @@ -18,6 +18,7 @@ #include <linux/mutex.h> #include <linux/idr.h> #include <linux/log2.h> +#include <linux/pm_runtime.h> #include "blk.h" @@ -534,6 +535,14 @@ static void register_disk(struct gendisk return; } } + + /* + * avoid probable deadlock caused by allocating memory with + * GFP_KERNEL in runtime_resume callback of its all ancestor + * devices + */ + pm_runtime_set_memalloc_noio(ddev, true); + disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj); disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj); @@ -663,6 +672,7 @@ void del_gendisk(struct gendisk *disk) disk->driverfs_dev = NULL; if (!sysfs_deprecated) sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); + pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); device_del(disk_to_dev(disk)); } EXPORT_SYMBOL(del_gendisk); _ Patches currently in -mm which might be from ming.lei@xxxxxxxxxxxxx are origin.patch linux-next.patch mm-teach-mm-by-current-context-info-to-not-do-i-o-during-memory-allocation.patch pm-runtime-introduce-pm_runtime_set_memalloc_noio.patch block-genhdc-apply-pm_runtime_set_memalloc_noio-on-block-devices.patch net-core-apply-pm_runtime_set_memalloc_noio-on-network-devices.patch pm-runtime-force-memory-allocation-with-no-i-o-during-runtime-pm-callbcack.patch usb-forbid-memory-allocation-with-i-o-during-bus-reset.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html