Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Nov 1998 15:56:29 -0500 (EST)
From:      Luoqi Chen <luoqi@watermarkgroup.com>
To:        dg@root.com, wollman@khavrinen.lcs.mit.edu
Cc:        current@FreeBSD.ORG, eivind@yes.no, jfieber@indiana.edu
Subject:   Re: The infamous dying daemons bug
Message-ID:  <199811092056.PAA22043@lor.watermarkgroup.com>

next in thread | raw e-mail | index | archive | help
> Totally unrelated to the problem.  It seems, so far as I was able to
> characterize, to happen to daemons which are *swapped out* at the time
> of the memory shortage.  If it's active enough to still be in core, it
> doesn't get spammed.
> 
I went through swap_pager.c today and found a problem that could potentially
have bad consequences. It's a comparison between page index in the swap pager
and the size of the vm object, since a shadowed object may have a non-zero
paging offset with respect to the swap pager, the comparison should have taken
the offset into account. This piece of code has been there since '95, so
I can't say if this was responsible for the daemon dying problem.

-lq


Index: swap_pager.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/swap_pager.c,v
retrieving revision 1.103
diff -u -r1.103 swap_pager.c
--- swap_pager.c	1998/10/31 15:31:28	1.103
+++ swap_pager.c	1998/11/09 11:02:54
@@ -349,7 +349,7 @@
 		*valid = 0;
 	ix = pindex / SWB_NPAGES;
 	if ((ix >= object->un_pager.swp.swp_nblocks) ||
-	    (pindex >= object->size)) {
+	    (pindex >= object->size + OFF_TO_IDX(object->paging_offset))) {
 		return (FALSE);
 	}
 	swb = &object->un_pager.swp.swp_blocks[ix];
@@ -1227,8 +1227,8 @@
 			 * intent of this code is to allocate small chunks for
 			 * small objects)
 			 */
-			if ((off == 0) && ((fidx + ntoget) > object->size)) {
-				ntoget = object->size - fidx;
+			if ((off == 0) && ((fidx + ntoget) > object->size + paging_pindex)) {
+				ntoget = object->size + paging_pindex - fidx;
 			}
 	retrygetspace:
 			if (!swap_pager_full && ntoget > 1 &&

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811092056.PAA22043>