Date: Tue, 02 Oct 2001 18:06:43 PDT From: leres@no.spam.ee.lbl.gov (Craig Leres) To: freebsd-stable@freebsd.org Subject: Re: 4GB memory problem Message-ID: <200110030106.f9316hB11322@fun.ee.lbl.gov>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110030106.f9316hB11322>
