From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 946863D647E for ; Mon, 17 Aug 2026 09:31:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786959104; cv=none; b=fpwdBvPP6CrfRW52WmrkrVWDfXKRzHX/PJ8VkqQOt8z7XYSCWY66CKGiyyzqRpo3VQlFZKylO6ut22y7rysdnibLsiPhl8Hzu26WFPHRfByZNJtsIB8yiliQRaq6sxt4l7l8mcIS0evuPaTH17fYbDpCD0iI1y53gjj+a8ctH5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786959104; c=relaxed/simple; bh=gF2R1TeVaUGmLGcCHX6NjyK9ArJZKfl2Ed/Hr4tnVMs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VugZVqBhcHbAvLzTQXpBVvtaTNJhnkQAqp9CxX6CzT9l6C3TlJ0Z6dhFSk7OKQ0NyDfDn9G9rUmDo7fIQIp376If5bpG8TdUP+s5+Iuy07QRGHaDCNbyxbMCtPNNbmNmqv8mTbTHVQgH1DAHlVw1jx0J4gfDSNLIJ8SOFWY047k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=r9Gk2fZB; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="r9Gk2fZB" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description; bh=BY2LkZEV75VdRKC+EAUB3TNiV4cpx9y+rtp1/41c53k=; b=r9Gk2fZB9cfEG0VaSO5oI/fqP5 g69PCBq5qcPnhfxiCYHfmNpdid+3WbPGyvqzvqCYtWzGtl5qLBa6gHRk0TGW707n6qhVdO3ZeM/Nr f6j7PKlzlS4WhMqfgeUEDKmmmNsxsRTIC9z/GCIY3peYbeTWdyi8xJWjxUxTVcRTb9eaaZjYHP71n G6Sc5apuxY3TU4sQsccFEHic/NQRS1XoHEwco1HpYK3OSrMvD2eemcJ6CYBlQtWM9sTGo/92tmyQL EiQaVyQqJUgZ04WpFVGEwE8xO21n9U+kp10Q7V7LYgN8kC/jYv+ramdKGwYaI8MJ1DwC+uSpFspAc LIJteWuQ==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wvtfu-0087yL-0m; Mon, 17 Aug 2026 09:30:34 +0000 Date: Mon, 17 Aug 2026 02:30:27 -0700 From: Breno Leitao To: Barry Song Cc: Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Youngjun Park , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , Hugh Dickins , Baolin Wang , Peter Xu , Johannes Weiner , Yosry Ahmed , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH v2 3/3] mm: fail the fault on a malformed swap entry instead of retrying it Message-ID: References: <20260813-swap-v2-0-4a625ccabdae@debian.org> <20260813-swap-v2-3-4a625ccabdae@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Debian-User: leitao On Mon, Aug 17, 2026 at 06:22:41AM +0800, Barry Song wrote: > On Thu, Aug 13, 2026 at 6:02 PM Breno Leitao wrote: > > > > do_swap_page() returns 0 when get_swap_device() fails, which the fault > > handler reads as "handled". For an entry that can never become valid > > the retry takes the same fault again, so the thread spins forever, > > retrying on the same fault. > > > > Return VM_FAULT_SIGBUS (Bad access) for a malformed entry (pr_err() was > > called at get_swap_device()). > > > > Signed-off-by: Breno Leitao > > --- > > mm/memory.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/mm/memory.c b/mm/memory.c > > index 7201e848129a7..fa2b3d2ad3202 100644 > > --- a/mm/memory.c > > +++ b/mm/memory.c > > @@ -4957,6 +4957,9 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) > > /* Prevent swapoff from happening to us, and reject a bad entry. */ > > si = get_swap_device(entry); > > if (IS_ERR_OR_NULL(si)) { > > + /* A malformed entry never becomes valid, so don't retry it. */ > > + if (IS_ERR(si)) > > + ret = VM_FAULT_SIGBUS; > > > Hi Breno, > > Since you now return VM_FAULT_SIGBUS, the page fault should no > longer retry repeatedly. Do we still need patch 1/3, which adds the > rate-limited printk? Yes, I still think we need it, for a few reasons: 1) A different bug could just as easily trigger the same message flood again. 2) I don't see a case where flooding the log with this message would help. If it keeps firing, something else is already broken, and the repeated message itself adds nothing useful. 3) From a monitoring perspective, I'd guess 95% of our log messages should be rate limited anyway, and this one would fall into this category. You think this one shouldn't be ratelimited? Thanks for the review, --breno