All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel@surriel.com>
To: Baoquan He <bhe@redhat.com>
Cc: "Vivek Goyal" <vgoyal@redhat.com>,
	"Dave Young" <dyoung@redhat.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	kernel-team@meta.com, "Breno Leitão" <leitao@debian.org>,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH] fs/proc: fix softlockup in __read_vmcore (part 2)
Date: Fri, 10 Jan 2025 10:28:21 -0500	[thread overview]
Message-ID: <20250110102821.2a37581b@fangorn> (raw)

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.

Signed-off-by: Rik van Riel <riel@surriel.com>
Fixes: 5cbcb62dddf5 ("fs/proc: fix softlockup in __read_vmcore")
Reported-by: Breno Leitao <leitao@debian.org>
---
 fs/proc/vmcore.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index 3d8a82cee63e..658bf199d424 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -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;
-- 
2.47.1



                 reply	other threads:[~2025-01-10 15:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250110102821.2a37581b@fangorn \
    --to=riel@surriel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=kernel-team@meta.com \
    --cc=kexec@lists.infradead.org \
    --cc=leitao@debian.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.