kern/67898: page fault while in kernel mode

Bruce M Simpson bms at spc.org
Wed Jun 23 08:54:19 GMT 2004


On Wed, Jun 23, 2004 at 10:36:52AM +0200, Poul-Henning Kamp wrote:
> I don't really have a good idea.  The devtoname() is patently invalid
> in the face of paging to NFS so I guess we'd have to stick a name
> string in swdevt and print that if we don't just remove the devtoname()
> entirely.

The assumption which kvm_getswapinfo() currently makes is to simply
substitute the string "[NFS swap]" for the case of (dev == NODEV).

Therefore, might I suggest the following:
%%
Index: src/sys/vm/swap_pager.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/swap_pager.c,v
retrieving revision 1.252
diff -u -r1.252 swap_pager.c
--- src/sys/vm/swap_pager.c	17 Jun 2004 17:16:53 -0000	1.252
+++ src/sys/vm/swap_pager.c	23 Jun 2004 08:53:28 -0000
@@ -1125,6 +1125,8 @@
 	 * cleared on completion.  If an I/O error occurs, SWAPBLK_NONE
 	 * is set in the meta-data.
 	 */
+#define GETSWDEVNAME(_bp) \
+	((_bp)->b_dev == NODEV ? "[NFS swap]" : devtoname(bp->b_dev))
 	s = splvm();
 	vm_page_lock_queues();
 	while ((mreq->flags & PG_SWAPINPROG) != 0) {
@@ -1134,11 +1136,12 @@
 			printf(
 			    "swap_pager: indefinite wait buffer: device:"
 				" %s, blkno: %ld, size: %ld\n",
-			    devtoname(bp->b_dev), (long)bp->b_blkno,
+			    GETSWDEVNAME(bp), (long)bp->b_blkno,
 			    bp->b_bcount
 			);
 		}
 	}
+#undef GETSWDEVNAME
 	vm_page_unlock_queues();
 	splx(s);
%%

Regards,
BMS


More information about the freebsd-bugs mailing list