]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
fs/proc: fix softlockup in __read_vmcore (part 2)
authorRik van Riel <riel@surriel.com>
Fri, 10 Jan 2025 15:28:21 +0000 (10:28 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 13 Jan 2025 03:03:38 +0000 (19:03 -0800)
Since commit 5cbcb62dddf5 ("fs/proc: fix softlockup in __read_vmcore") the
number of softlockups in __read_vmcore at kdump time have gone down, but
they still happen sometimes.

In a memory constrained environment like the kdump image, a softlockup is
not just a harmless message, but it can interfere with things like RCU
freeing memory, causing the crashdump to get stuck.

The second loop in __read_vmcore has a lot more opportunities for natural
sleep points, like scheduling out while waiting for a data write to
happen, but apparently that is not always enough.

Add a cond_resched() to the second loop in __read_vmcore to (hopefully)
get rid of the softlockups.

Link: https://lkml.kernel.org/r/20250110102821.2a37581b@fangorn
Fixes: 5cbcb62dddf5 ("fs/proc: fix softlockup in __read_vmcore")
Signed-off-by: Rik van Riel <riel@surriel.com>
Reported-by: Breno Leitao <leitao@debian.org>
Cc: Baoquan He <bhe@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/vmcore.c

index 3d8a82cee63e3611c4723c3c41c15e6f8b43035b..658bf199d4247949966235e7c3e8afff42a7cbc7 100644 (file)
@@ -404,6 +404,8 @@ static ssize_t __read_vmcore(struct iov_iter *iter, loff_t *fpos)
                        if (!iov_iter_count(iter))
                                return acc;
                }
+
+               cond_resched();
        }
 
        return acc;