"indefinite" wait buffer patch

Kostik Belousov kostikbel at gmail.com
Fri Nov 2 00:56:10 PDT 2007


On Thu, Nov 01, 2007 at 09:20:42PM +0100, Arno J. Klaassen wrote:
> Hello,
> 
> 
> while slowly testing releng_7, I remembered I have since about
> two years the attached diff in my releng_6 sources (patch
> recreated against releng_7 with low timeouts for debugging) :
> 
> it addresses the situation when one creates a huge swap-space on 
> a (relatively) slow disk-subsystem : e.g. for scientific computing
> it sometimes makes sense to have, e.g. 8G swap for 2G main memory
> if you know you're treating N less then 2G matrices and process
> is CPU-bound for quite a while for 1 matrix before switching to 
> the other.
> But then, when switching from one matrix to another, dmesg gets
> flooded by :
> 
>   "indefinite wait buffer" 
> 
> messages.
> 
> The attached patch shows in fact that the wait buffer is never
> "indefinite" (unless a real HW-problem probably) and linearly
> increases timeout to match with reality.
I think this is mostly good. See below.
> 
> The last chunk is just to prevent for a panic at reboot when
> there is so much data swapped out that is doesn't get treated
> before 'reboot-finish-time-out'.
This chunk would cause (non-silent) data corruption. Besides reboot,
the code is used when swap is turned off on live system.

Index: sys/vm/swap_pager.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/swap_pager.c,v
retrieving revision 1.295
diff -u -r1.295 swap_pager.c
--- sys/vm/swap_pager.c	5 Aug 2007 21:04:32 -0000	1.295
+++ sys/vm/swap_pager.c	1 Nov 2007 18:59:18 -0000
@@ -941,6 +941,10 @@
...
+	static int timo_secs = TIMO_START;
...
+			if (retry*TIMO_CHUNK > timo_secs) {
+			  timo_secs = retry*TIMO_CHUNK;
Imagine that two buffers got the timeout on swap-in simultaneously.
I think that, instead, making timo_secs local variable would be right.
Also, timeout reading one buffer shall not increase the timeout swapping
in another one.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20071102/d4f4f6ab/attachment.pgp


More information about the freebsd-hackers mailing list