DragonFly users List (threaded) for 2007-07
DragonFly BSD
DragonFly users List (threaded) for 2007-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: vnode_pager_putpages flood


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 28 Jul 2007 12:33:29 -0700 (PDT)

:vnode_pager_putpages: residual I/O 65536 at XXXX
:
:where XXX is a number.
:
:It junks the console with this message. It is my fault since /home got
:full but it should handle it somehow, the machine reacts to
:CTRL-ALT-DEL by the way. But I cannot stop apps that write to the disk
:and the machine becomes unresponsive via SSH and local console as well,
:only the aforementioned solution helps.
:
:-- 
:Gergo Szakal MD <bastyaelvtars@gmail.com>
:University Of Szeged, HU
:Faculty Of General Medicine
:
:/* Please do not CC me with replies, thank you. */

    Try this patch.  We need a kprintf wrapper for this anyway so I went
    ahead and wrote one.  The pps rate check code is kinda hokey.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>


Index: kern/subr_prf.c
===================================================================
RCS file: /cvs/src/sys/kern/subr_prf.c,v
retrieving revision 1.17
diff -u -p -r1.17 subr_prf.c
--- kern/subr_prf.c	26 Dec 2006 11:01:07 -0000	1.17
+++ kern/subr_prf.c	28 Jul 2007 19:31:56 -0000
@@ -332,6 +332,28 @@ 	return (retval);
 }
 
 /*
+ * Limited rate kprintf.  The passed rate structure must be initialized
+ * with the desired reporting frequency.  A frequency of 0 will result in
+ * no output.
+ */
+void
+krateprintf(struct krate *rate, const char *fmt, ...)
+{
+	__va_list ap;
+
+	if (rate->ticks != ticks) {
+		rate->ticks = ticks;
+		rate->count = 0;
+	}
+	if (rate->count < rate->freq) {
+		++rate->count;
+		__va_start(ap, fmt);
+		kvprintf(fmt, ap);
+		__va_end(ap);
+	}
+}
+
+/*
  * Print a character on console or users terminal.  If destination is
  * the console then the last bunch of characters are saved in msgbuf for
  * inspection later.
Index: sys/systm.h
===================================================================
RCS file: /cvs/src/sys/sys/systm.h,v
retrieving revision 1.73
diff -u -p -r1.73 systm.h
--- sys/systm.h	2 Jul 2007 16:52:01 -0000	1.73
+++ sys/systm.h	28 Jul 2007 19:25:33 -0000
@@ -132,6 +132,7 @@ struct trapframe;
 struct user;
 struct vmspace;
 struct savetls;
+struct krate;
 
 void	Debugger (const char *msg);
 void	backtrace(void);
@@ -172,6 +173,7 @@ int	log (int, const char *, ...) __print
 void	logwakeup (void);
 void	log_console (struct uio *);
 int	kprintf (const char *, ...) __printflike(1, 2);
+void	krateprintf (struct krate *, const char *, ...) __printflike(2, 3);
 int	ksnprintf (char *, size_t, const char *, ...) __printflike(3, 4);
 int	ksprintf (char *buf, const char *, ...) __printflike(2, 3);
 int	uprintf (const char *, ...) __printflike(1, 2);
Index: sys/time.h
===================================================================
RCS file: /cvs/src/sys/sys/time.h,v
retrieving revision 1.16
diff -u -p -r1.16 time.h
--- sys/time.h	7 Jan 2007 00:42:55 -0000	1.16
+++ sys/time.h	28 Jul 2007 19:28:18 -0000
@@ -192,6 +192,19 @@ #define TIMER_ABSTIME	0x1	/* absolute ti
 #endif
 
 #ifdef _KERNEL
+
+/*
+ * For krateprintf()
+ */
+struct krate {
+	int freq;
+	int ticks;
+	int count;
+};
+
+#endif
+
+#ifdef _KERNEL
 extern time_t	time_second;
 extern int64_t	ntp_tick_permanent;
 extern int64_t	ntp_tick_acc;
Index: vm/vnode_pager.c
===================================================================
RCS file: /cvs/src/sys/vm/vnode_pager.c,v
retrieving revision 1.34
diff -u -p -r1.34 vnode_pager.c
--- vm/vnode_pager.c	8 Jun 2007 02:00:47 -0000	1.34
+++ vm/vnode_pager.c	28 Jul 2007 19:28:16 -0000
@@ -91,6 +91,9 @@ 	vnode_pager_haspage,
 	NULL
 };
 
+static struct krate vbadrate = { 1 };
+static struct krate vresrate = { 1 };
+
 int vnode_pbuf_freecnt = -1;	/* start out unlimited */
 
 /*
@@ -1010,11 +1013,13 @@ 	mycpu->gd_cnt.v_vnodeout++;
 	mycpu->gd_cnt.v_vnodepgsout += ncount;
 
 	if (error) {
-		kprintf("vnode_pager_putpages: I/O error %d\n", error);
+		krateprintf(&vbadrate,
+			    "vnode_pager_putpages: I/O error %d\n", error);
 	}
 	if (auio.uio_resid) {
-		kprintf("vnode_pager_putpages: residual I/O %d at %lu\n",
-		    auio.uio_resid, (u_long)m[0]->pindex);
+		krateprintf(&vresrate,
+			    "vnode_pager_putpages: residual I/O %d at %lu\n",
+			    auio.uio_resid, (u_long)m[0]->pindex);
 	}
 	for (i = 0; i < ncount; i++) {
 		rtvals[i] = VM_PAGER_OK;



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