+ kcompactd-hang-during-memory-offlining.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm: fix kcompactd hang during memory offlining
has been added to the -mm tree.  Its filename is
     kcompactd-hang-during-memory-offlining.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/kcompactd-hang-during-memory-offlining.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/kcompactd-hang-during-memory-offlining.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: Vlastimil Babka <vbabka@xxxxxxx>
Subject: mm: fix kcompactd hang during memory offlining

Assume memory47 is the last online block left in node1. This will hang:

# echo offline > /sys/devices/system/node/node1/memory47/state

After a couple of minutes, the following pops up in dmesg:

INFO: task bash:957 blocked for more than 120 seconds.
       Not tainted 4.6.0-rc6+ #6
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
bash            D ffff8800b7adbaf8     0   957    951 0x00000000
  ffff8800b7adbaf8 ffff880034d5b880 ffff8800b698d4c0 ffff8800b7adc000
  7fffffffffffffff ffff88003381ff10 ffff8800b698d4c0 0000000000180000
  ffff8800b7adbb10 ffffffff817be0b5 ffff88003381ff08 ffff8800b7adbbc0
Call Trace:
  [<ffffffff817be0b5>] schedule+0x35/0x80
  [<ffffffff817c100c>] schedule_timeout+0x1ac/0x270
  [<ffffffff810d9750>] ? check_preempt_wakeup+0x100/0x220
  [<ffffffff810ce0a0>] ? check_preempt_curr+0x80/0x90
  [<ffffffff817bf501>] wait_for_completion+0xe1/0x120
  [<ffffffff810cefc0>] ? wake_up_q+0x70/0x70
  [<ffffffff810c42ff>] kthread_stop+0x4f/0x110
  [<ffffffff811e1046>] kcompactd_stop+0x26/0x40
  [<ffffffff817b7a16>] __offline_pages.constprop.28+0x7e6/0x840
  [<ffffffff8121ee61>] offline_pages+0x11/0x20
  [<ffffffff8151a073>] memory_block_action+0x73/0x1d0
  [<ffffffff8151a217>] memory_subsys_offline+0x47/0x60
  [<ffffffff81502dc6>] device_offline+0x86/0xb0
  [<ffffffff8151a8fa>] store_mem_state+0xda/0xf0
  [<ffffffff814ffea8>] dev_attr_store+0x18/0x30
  [<ffffffff812c1097>] sysfs_kf_write+0x37/0x40
  [<ffffffff812c062d>] kernfs_fop_write+0x11d/0x170
  [<ffffffff8123e797>] __vfs_write+0x37/0x120
  [<ffffffff8134d1ad>] ? security_file_permission+0x3d/0xc0
  [<ffffffff810eed32>] ? percpu_down_read+0x12/0x50
  [<ffffffff8123f969>] vfs_write+0xa9/0x1a0
  [<ffffffff8134d543>] ? security_file_fcntl+0x43/0x60
  [<ffffffff81240dc5>] SyS_write+0x55/0xc0
  [<ffffffff817c21b2>] entry_SYSCALL_64_fastpath+0x1a/0xa4

kcompactd is waiting for kcompactd_max_order > 0 when it's woken up to
actually exit.  Check kthread_should_stop() to break out of the wait.

Reported-by: Reza Arbab <arbab@xxxxxxxxxxxxxxxxxx>
Tested-by: Reza Arbab <arbab@xxxxxxxxxxxxxxxxxx>
Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx>
Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
Cc: Rik van Riel <riel@xxxxxxxxxx>
Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
Cc: David Rientjes <rientjes@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Hugh Dickins <hughd@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/compaction.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff -puN mm/compaction.c~kcompactd-hang-during-memory-offlining mm/compaction.c
--- a/mm/compaction.c~kcompactd-hang-during-memory-offlining
+++ a/mm/compaction.c
@@ -1733,7 +1733,7 @@ void compaction_unregister_node(struct n
 
 static inline bool kcompactd_work_requested(pg_data_t *pgdat)
 {
-	return pgdat->kcompactd_max_order > 0;
+	return pgdat->kcompactd_max_order > 0 || kthread_should_stop();
 }
 
 static bool kcompactd_node_suitable(pg_data_t *pgdat)
@@ -1797,6 +1797,8 @@ static void kcompactd_do_work(pg_data_t
 		INIT_LIST_HEAD(&cc.freepages);
 		INIT_LIST_HEAD(&cc.migratepages);
 
+		if (kthread_should_stop())
+			return;
 		status = compact_zone(zone, &cc);
 
 		if (zone_watermark_ok(zone, cc.order, low_wmark_pages(zone),
_

Patches currently in -mm which might be from vbabka@xxxxxxx are

kcompactd-hang-during-memory-offlining.patch
mm-compaction-wrap-calculating-first-and-last-pfn-of-pageblock.patch
compaction-wrap-calculating-first-and-last-pfn-of-pageblock-fix.patch
mm-compaction-reduce-spurious-pcplist-drains.patch
mm-compaction-skip-blocks-where-isolation-fails-in-async-direct-compaction.patch
mm-page_alloc-un-inline-the-bad-part-of-free_pages_check.patch
cpuset-use-static-key-better-and-convert-to-new-api.patch
mm-page_alloc-uninline-the-bad-page-part-of-check_new_page.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



[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux