From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796306172; b=lH1j3i3khxq5rV48yRYCwBdkkXqVJpAyBHmqE0ciV81+ArFFG70nb8I4C6Nk9KyIhQiJ DY86J5AHS9unt9A4ZUduf1nSY2dv2qfRANAZSi7pwcmcIcrmtseSAV2aDoJb3Ik0iq6Cy EG5RHJX1EdTXPInLsdcMKP50uBEuHUL8dPalME2U27iUg6fTqhPGxv0iOGGaGfMRCxhbH AY9xslQqbumPXoLMzVnbT/D3+chO/tcEbg6cH//LXtX9tGHcugcntM8JRRTFLkWlhb//R NdIfM22deoBbVDtyqUPDxQegNDkjw2HoVLKgtF/4OF8PD6DmU3N8WxRxkiY4UN/FkXw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796306172; h=DMARC-Filter:Received:Received:DKIM-Signature:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=Ch9btgGR+zqxLCbMl5L4LoVgSWxBmuAnLEaxG1JCgbQ=; b=fGRkCZvPD6CIRspyaJ5+GQZiEh3/YI7D9fcuRKubvraOsAVBpeQ/sS9bXMk92lM5N5hG 4FEpMxxlUmbTlPc0OAa4pQRdn/Rk/kvGVBM3O/Wy0z6CvZ8J8J4D6YI0Th0MfuzHjxWxa cEfaAzx/4dnmBtZIk8s2jyMCUszfaW+uRn6r/U+KKaeFkWMbY3aCGMj2jTSNUHXTDOlwB z/9E8NCqmsb7k62Pkf1M6/hU47qnNNwhJTHH/2U7UdxK+vSgLSMQjObBIafZKOmYxAYFQ 2aoePv0pcYnHPC0WNhgsvxJOYHauF6UHt6vWjPFsqvfMiEoNWDlJbYcgk2riXbKrzYA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=uDfjz5+O; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3292606A33B; Thu, 3 Dec 2026 13:56:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B3292606A33B Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=uDfjz5+O Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A70D41477; Thu, 3 Dec 2026 05:56:07 -0800 (PST) Received: from [10.164.19.62] (unknown [10.164.19.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8086A3F7D8; Thu, 3 Dec 2026 05:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796306170; bh=ZR1u/Hwqo13TRHCguYl7U0WO7eWBgUEKIc8+lTsfyl4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=uDfjz5+ODkO5acKnpXujwQlizR2EBDz0qdND36w3PXIf7vpbhlJ+kWZS9MJ6mSWMr RLjR8U1hnHHJmHwFJMnKlg7EpGENifVcn9ppiijm9HUIPbnEe+3/tqxP1RefwzYCad 3MPNhG4RqBai3GFK0/9u6mon5ABNmV7WrY1pqia0= Message-ID: Date: Thu, 3 Dec 2026 19:25:47 +0530 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 13/32] mm/khugepaged: stop MADV_COLLAPSE on a fatal signal To: "David Hildenbrand (Arm)" , Hugh Dickins , Baolin Wang , Andrew Morton , Mike Rapoport , Peter Xu , Michal Hocko , Kiryl Shutsemau , Manfred Spraul , Davidlohr Bueso , Cyrill Gorcunov , Zi Yan , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Barry Song , Lance Yang , Usama Arif , Lorenzo Stoakes , Rik van Riel , Vlastimil Babka , Harry Yoo , Jann Horn , Yang Shi , Zach O'Keefe , Song Liu , David Stevens , Kefeng Wang , Alex Williamson , Suren Baghdasaryan , Dave Jiang , Matthew Wilcox , Miaohe Lin , David Rientjes , Shakeel Butt , Jan Kara , Mel Gorman , Jason Gunthorpe , John Hubbard , Gerd Hoffmann , Vivek Kasireddy , Dave Airlie , Matthew Brost , Joshua Hahn , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Hagen Paul Pfeifer , James Bottomley , Felix Kuehling , Alex Sierra , Balbir Singh , Kairui Song , Qi Zheng , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Oscar Salvador , Muchun Song , Dan Williams , Rakie Kim , Hao Li , Christoph Lameter , Roman Gushchin , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Alexei Starovoitov , Xu Xin , Chengming Zhou , Shivank Garg Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cxl@vger.kernel.org, linux-rt-devel@lists.linux.dev, SJ Park , Chris Mason References: <20261129-fixes_core_3-v1-0-f66094116801@kernel.org> <20261129-fixes_core_3-v1-13-f66094116801@kernel.org> Content-Language: en-US From: Dev Jain In-Reply-To: <20261129-fixes_core_3-v1-13-f66094116801@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 29/11/26 3:36 pm, David Hildenbrand (Arm) wrote: > A task that gets a fatal signal during MADV_COLLAPSE keeps collapsing > the rest of the range. Consequently, the exit of the task can be delayed > for a while for a large range. > > Let's fix it by checking for a fatal signal before each PMD, simply > breaking out of the loop. User space will never see the return value, > so no need to return -EINTR. > > This has low urgency, as it only delays the exit of the task. No need to > CC stable. > > Fixes: 7d8faaf15545 ("mm/madvise: introduce MADV_COLLAPSE sync hugepage collapse") > Reported-by: Chris Mason > Signed-off-by: David Hildenbrand (Arm) > --- Reviewed-by: Dev Jain > mm/khugepaged.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index 091e4136ba037..0495fb1a9e31c 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -4,6 +4,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -3372,6 +3373,9 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start, > for (addr = hstart; addr < hend; addr += HPAGE_PMD_SIZE) { > enum scan_result result = SCAN_FAIL; > > + if (fatal_signal_pending(current)) > + break; > + > if (mmap_unlocked) { > cond_resched(); > mmap_read_lock(mm); >