Bug 15420

Summary: 3.3-RELEASE Kernel freeze
Product: Base System Reporter: mitja <mitja>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.3-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description mitja 1999-12-11 19:50:01 UTC
Kernel freezes under heavy VM load.

Fix: The following kernel patch fixes the problem for me, but since this is my 
first FreeBSD hacking attempt, I'm not sure if it's OK.
--------------------------------->8--------------------------------
How-To-Repeat: Spawn few programs that chew up all memory. 
The bug may not show up immediately, so run the programs few times.

This script triggers the problem on two PCs I tested on:
--------------------------------->8--------------------------------
#!/bin/sh
cat << EOF > qq.c
void main(void) {
        for(;;)
                memset(malloc(1000000), 0, 1000000);
}
EOF
cc qq.c -o qq
./qq &
./qq &
./qq &
./qq &
wait
rm -f qq qq.c
--------------------------------->8--------------------------------
Comment 1 mitja 1999-12-12 18:19:10 UTC
In the last bug report I sent the wrong patch. Sorry for the inconvenience.
The right patch is this:
--------------------------------->8--------------------------------
--- vm_pageout.c.orig   Mon Aug 30 00:42:11 1999
+++ vm_pageout.c        Sun Dec 12 18:16:38 1999
@@ -1136,8 +1136,9 @@
         * make sure that we have swap space -- if we are low on memory and
         * swap -- then kill the biggest process.
         */
-       if ((vm_swap_size == 0 || swap_pager_full) &&
-           ((cnt.v_free_count + cnt.v_cache_count) < cnt.v_free_min)) {
+       if (vm_swap_size == 0 &&   
+          (cnt.v_free_count + cnt.v_cache_count) < cnt.v_free_min ||
+          swap_pager_full) {
                bigproc = NULL;
                bigsize = 0;
                for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
--------------------------------->8--------------------------------

Regards,
Mitja
Comment 2 mitja 1999-12-13 17:36:32 UTC
After rerunning the tests with more processes (10+) I noticed that random
kernel freezes were still happening. After digging a bit around the swapper
code I came up with a third patch.  My machine with this patch applied is
stable although running for three hours with 15 memory hogs.
-------------------------------->8-------------------------------------------
        diff -u sys.orig/vm/vm_pageout.c sys/vm/vm_pageout.c
        --- sys.orig/vm/vm_pageout.c    Sun Aug 29 18:33:38 1999
        +++ sys/vm/vm_pageout.c Mon Dec 13 17:20:38 1999
        @@ -1136,8 +1136,9 @@
                 * make sure that we have swap space -- if we are low on memory and
                 * swap -- then kill the biggest process.
                 */
-       if ((vm_swap_size == 0 || swap_pager_full) &&
-           ((cnt.v_free_count + cnt.v_cache_count) < cnt.v_free_min)) {
+       if (vm_swap_size == 0 &&
+           (cnt.v_free_count + cnt.v_cache_count) < cnt.v_free_min ||
+           swap_pager_full) {
                bigproc = NULL;
                bigsize = 0;
                for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
@@ -1174,7 +1175,7 @@
                        bigproc->p_nice = PRIO_MIN;
                        resetpriority(bigproc);
                        wakeup(&cnt.v_free_count);
-               }
+               }
        }
        return force_wakeup;
 }
-------------------------------->8-------------------------------------------
Regards,
Mitja
Comment 3 mitja 1999-12-14 14:40:33 UTC
Hi again, in the previous post I appended the wrong patch again.
Please forgive me, I have a lot of other things to do besides this ;)
The patch is now uuencoded.
Regards,
Distracted Mitja ;)
begin 644 vm-3.3-RELEASE.patch
M9&EF9B`M=2!S>7,N;W)I9R]V;2]S=V%P7W!A9V5R+F,@<WES+W9M+W-W87!?
M<&%G97(N8PHM+2T@<WES+F]R:6<O=FTO<W=A<%]P86=E<BYC"5-U;B!!=6<@
M,CD@,3@Z,S,Z,C<@,3DY.0HK*RL@<WES+W9M+W-W87!?<&%G97(N8PE-;VX@
M1&5C(#$S(#$W.C(P.C(U(#$Y.3D*0$`@+3$X-2PQ,2`K,3@U+#$Q($!`"B!S
M=&%T:6,@7U]I;FQI;F4@=F]I9`H@<W=A<'-I>F5C:&5C:R@I"B!["BT):68@
M*'9M7W-W87!?<VEZ92`\(#$R."`J(&)T;V1B*%!!1T5?4TE:12DI('L**PEI
M9B`H=FU?<W=A<%]S:7IE(#P](#4Q,BIB=&]D8BA004=%7U-)6D4I*2!["B`)
M"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&%N9`H@"2`J('-W87`@+2T@=&AE;B!K:6QL
M('1H92!B:6=G97-T('!R;V-E<W,N"B`)("HO"BT):68@*"AV;5]S=V%P7W-I
M>F4@/3T@,"!\?"!S=V%P7W!A9V5R7V9U;&PI("8F"BT)("`@("@H8VYT+G9?
M9G)E95]C;W5N="`K(&-N="YV7V-A8VAE7V-O=6YT*2`\(&-N="YV7V9R965?
M;6EN*2D@>PHK"6EF("AV;5]S=V%P7W-I>F4@/3T@,"`F)@HK"2`@("`H8VYT
M+G9?9G)E95]C;W5N="`K(&-N="YV7V-A8VAE7V-O=6YT*2`\(&-N="YV7V9R
M965?;6EN('Q\(`HK"2`@("!S=V%P7W!A9V5R7V9U;&PI('L*(`D)8FEG<')O
M8R`]($Y53$P["B`)"6)I9W-I>F4@/2`P.PH@"0EF;W(@*'`@/2!A;&QP<F]C
M+FQH7V9I<G-T.R!P("$](#`[('`@/2!P+3YP7VQI<W0N;&5?;F5X="D@>PI`
M0"`M,3$W-"PW("LQ,3<U+#<@0$`*(`D)"6)I9W!R;V,M/G!?;FEC92`](%!2
M24]?34E..PH@"0D)<F5S971P<FEO<FET>2AB:6=P<F]C*3L*(`D)"7=A:V5U
M<"@F8VYT+G9?9G)E95]C;W5N="D["BT)"7T**PD)?2`*(`E]"B`)<F5T=7)N
2(&9O<F-E7W=A:V5U<#L*('T*
`
end
Comment 4 Poul-Henning Kamp freebsd_committer freebsd_triage 2001-06-06 22:05:40 UTC
State Changed
From-To: open->closed

timed out