From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756765AbcECWQt (ORCPT ); Tue, 3 May 2016 18:16:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:41216 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756519AbcECWQs (ORCPT ); Tue, 3 May 2016 18:16:48 -0400 Subject: Re: kcompactd hang during memory offlining To: Reza Arbab , Arnd Bergmann , Paul Gortmaker , Andrew Morton References: <20160503170247.GA4239@arbab-laptop.austin.ibm.com> Cc: Andrea Arcangeli , "Kirill A. Shutemov" , Rik van Riel , Joonsoo Kim , Mel Gorman , David Rientjes , Michal Hocko , Johannes Weiner , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org From: Vlastimil Babka Message-ID: <5729234A.1080502@suse.cz> Date: Wed, 4 May 2016 00:16:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <20160503170247.GA4239@arbab-laptop.austin.ibm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/03/2016 07:02 PM, Reza Arbab wrote: > 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. Damn, can you test this patch? I hope it's just the simple mistake and kcompactd is waiting for the kcompactd_max_order > 0 when it's woken up to actually exit. No idea what happens if memory actually gets offlined during compaction's pfn scan... but that wouldn't be new or specific to kcompactd... ----8<---- diff --git a/mm/compaction.c b/mm/compaction.c index 481004c73c90..0e28981d4510 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1852,7 +1852,7 @@ void compaction_unregister_node(struct node *node) 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) @@ -1916,6 +1916,8 @@ static void kcompactd_do_work(pg_data_t *pgdat) 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),