Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Neither limit the number of requests for the page da...



details:   https://anonhg.NetBSD.org/src/rev/61b38385e96c
branches:  trunk
changeset: 375889:61b38385e96c
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Fri May 19 15:42:43 2023 +0000

description:
Neither limit the number of requests for the page daemon.
Otherwise you may deadlock when the backend needs to allocate
memory and the page daemon needs to flush dirty vnd buffers.

See PR 57421 for details.

diffstat:

 sys/dev/vnd.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r ec4908f8b2cc -r 61b38385e96c sys/dev/vnd.c
--- a/sys/dev/vnd.c     Fri May 19 14:47:16 2023 +0000
+++ b/sys/dev/vnd.c     Fri May 19 15:42:43 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.288 2023/03/14 12:55:43 hannken Exp $        */
+/*     $NetBSD: vnd.c,v 1.289 2023/05/19 15:42:43 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008, 2020 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.288 2023/03/14 12:55:43 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.289 2023/05/19 15:42:43 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -123,6 +123,8 @@
 #include <sys/compat_stub.h>
 #include <sys/atomic.h>
 
+#include <uvm/uvm.h>
+
 #include <net/zlib.h>
 
 #include <miscfs/genfs/genfs.h>
@@ -559,7 +561,7 @@ vndstrategy(struct buf *bp)
                 * thread to add requests, as a wedge on vnd queues
                 * requests with biodone() -> dkstart() -> vndstrategy().
                 */
-               if (curlwp != vnd->sc_kthread) {
+               if (curlwp != vnd->sc_kthread && curlwp != uvm.pagedaemon_lwp) {
                        while (vnd->sc_pending >= VND_MAXPENDING(vnd))
                                tsleep(&vnd->sc_pending, PRIBIO, "vndpc", 0);
                }



Home | Main Index | Thread Index | Old Index