Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 1998 03:36:28 +0200 (EET)
From:      Alexander Litvin <archer@lucky.net>
To:        Luoqi Chen <luoqi@watermarkgroup.com>
Cc:        current@FreeBSD.ORG
Subject:   Re: The infamous dying daemons bug
Message-ID:  <199811100136.DAA00563@grape.carrier.kiev.ua>
In-Reply-To: <199811092056.PAA22043@lor.watermarkgroup.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <199811092056.PAA22043@lor.watermarkgroup.com> you wrote:
>> 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.
>> 
LC> I went through swap_pager.c today and found a problem that could potentially
LC> have bad consequences. It's a comparison between page index in the swap pager
LC> and the size of the vm object, since a shadowed object may have a non-zero
LC> paging offset with respect to the swap pager, the comparison should have taken
LC> the offset into account. This piece of code has been there since '95, so
LC> I can't say if this was responsible for the daemon dying problem.

It is definitely not responsible. At least for this particular problem,
though it may fix something else ;)

After applying the patch, and artificially exhausting memory, I promptly
got:

Nov 10 03:15:34 grape /kernel: swap_pager: suggest more swap space: 61 MB
Nov 10 03:16:26 grape /kernel: pid 310 (sendmail), uid 0: exited on signal 11
Nov 10 03:17:26 grape /kernel: pid 311 (sendmail), uid 0: exited on signal 11
Nov 10 03:18:25 grape /kernel: pid 313 (sendmail), uid 0: exited on signal 11
Nov 10 03:19:25 grape /kernel: pid 353 (sendmail), uid 0: exited on signal 11
Nov 10 03:20:26 grape /kernel: pid 394 (sendmail), uid 0: exited on signal 11

LC> -lq


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

--- 
We are the people our parents warned us about.

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?199811100136.DAA00563>