From owner-freebsd-stable Tue Oct 2 18: 6:53 2001 Delivered-To: freebsd-stable@freebsd.org Received: from fun.ee.lbl.gov (fun.ee.lbl.gov [131.243.1.81]) by hub.freebsd.org (Postfix) with ESMTP id 75A4A37B406 for ; Tue, 2 Oct 2001 18:06:45 -0700 (PDT) Received: (from leres@localhost) by fun.ee.lbl.gov (8.11.6/8.11.6) id f9316hB11322; Tue, 2 Oct 2001 18:06:43 -0700 (PDT) Message-Id: <200110030106.f9316hB11322@fun.ee.lbl.gov> From: leres@no.spam.ee.lbl.gov (Craig Leres) To: freebsd-stable@freebsd.org Subject: Re: 4GB memory problem Date: Tue, 02 Oct 2001 18:06:43 PDT Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Slawek Zak wrote: > Has the problem with 4GB RAM on Intel been fixed? I didn't see any > mention of this in release notes for 4.4. I think the answer is no. I have some systems with the SuperMicro P3TDLE motherboard and 4GB of memory; a kernel configed with maxusers 256 would bomb with: panic: swap_pager_swap_init: swap_zone == NULL I did a quick diff of 4.4-RELEASE's vm/swap_pager.c against FreeBSD-current (always a good place to start) and found that there is some new code that deals with this problem. I adapted the new code to 4.4-RELEASE and now on bootup I get: Swap zone entries reduced from 1005708 to 670472 My system seems to run ok now. Appended are context diffs against 4.4-RELEASE. Craig =================================================================== RCS file: RCS/swap_pager.c,v retrieving revision 1.1 diff -c -r1.1 swap_pager.c *** swap_pager.c 2001/10/03 00:26:55 1.1 --- swap_pager.c 2001/10/03 00:41:30 *************** *** 265,271 **** void swap_pager_swap_init() { ! int n; /* * Number of in-transit swap bp operations. Don't --- 265,271 ---- void swap_pager_swap_init() { ! int n, n2; /* * Number of in-transit swap bp operations. Don't *************** *** 298,319 **** nsw_wcount_async_max = nsw_wcount_async; /* ! * Initialize our zone. Right now I'm just guessing on the number ! * we need based on the number of pages in the system. Each swblock ! * can hold 16 pages, so this is probably overkill. */ n = cnt.v_page_count; - swap_zone = zinit( - "SWAPMETA", - sizeof(struct swblock), - n, - ZONE_INTERRUPT, - 1 - ); if (swap_zone == NULL) ! panic("swap_pager_swap_init: swap_zone == NULL"); /* * Initialize our meta-data hash table. The swapper does not need to --- 298,334 ---- nsw_wcount_async_max = nsw_wcount_async; /* ! * Initialize our zone. Right now I'm just guessing on the number ! * we need based on the number of pages in the system. Each swblock ! * can hold 16 pages, so this is probably overkill. This reservation ! * is typically limited to around 70MB by default. */ n = cnt.v_page_count; + n2 = n; + + do { + swap_zone = zinit( + "SWAPMETA", + sizeof(struct swblock), + n, + ZONE_INTERRUPT, + 1 + ); + if (swap_zone != NULL) + break; + /* + * if the allocation failed, try a zone two thirds the + * size of the previous attempt. + */ + n -= ((n + 2) / 3); + } while (n > 0); if (swap_zone == NULL) ! panic("failed to zinit swap_zone."); ! if (n2 != n) ! printf("Swap zone entries reduced from %d to %d.\n", n2, n); ! n2 = n; /* * Initialize our meta-data hash table. The swapper does not need to *************** *** 324,334 **** * swhash_mask: hash table index mask */ ! for (n = 1; n < cnt.v_page_count / 4; n <<= 1) ; ! swhash = malloc(sizeof(struct swblock *) * n, M_VMPGDATA, M_WAITOK); ! bzero(swhash, sizeof(struct swblock *) * n); swhash_mask = n - 1; } --- 339,349 ---- * swhash_mask: hash table index mask */ ! for (n = 1; n < n2 / 8; n *= 2) ; ! swhash = ! malloc(sizeof(struct swblock *) * n, M_VMPGDATA, M_WAITOK | M_ZERO); swhash_mask = n - 1; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message