Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Mar 2016 14:32:56 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Timothy Macintyre <tmacintyre@outlook.com>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: Fw: FreeBSD 9.0 16kb Page Size
Message-ID:  <20160320123256.GH1741@kib.kiev.ua>
In-Reply-To: <VI1PR05MB1343F3ED86DA432DA8DC265BDA8E0@VI1PR05MB1343.eurprd05.prod.outlook.com>
References:  <VI1PR05MB1343B48CB99607A90FB15C09DA8C0@VI1PR05MB1343.eurprd05.prod.outlook.com> <20160319132752.932a5a1e.freebsd@edvax.de> <VI1PR05MB1343451F6F4EBE6BCDF9F020DA8D0@VI1PR05MB1343.eurprd05.prod.outlook.com> <VI1PR05MB1343F3ED86DA432DA8DC265BDA8E0@VI1PR05MB1343.eurprd05.prod.outlook.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 20, 2016 at 10:16:37AM +0000, Timothy Macintyre wrote:
> Hi,
> 
> I originally asked this on freebsd-questions (below) and was forwarded here. I have tried updating the page size of the latest release (10) and the kernel still crashes, I imagine I'm missing something like an invalid struct size but not sure where. Any help would be greatly appreciated.
> 
You did not added the patch which would show what have you done so far.

First, I am interesting why do you want to use 16K pages on amd64.
I am aware that somebody did an experiment with 8K pages on i386 or
amd64, not sure which arch was it. The goal was to reduce memory
allocation cost in CPU cycles, but the pay for it was more severe memory
underutilization and in fact more CPU use in pmap.

Note that hardware only supports 4K/2M/1G page sizes, so 16K pages require
different code than what is currently present in amd64/pmap.c.  You cannot
get away with just redefining constants.

One on the issue is software->hardware flow. One PTE only maps 4K still,
so to map the whole 16K page you need to fill 4 consequtive PTEs.
Note that the pmap code assumes atomic pte updates, you would need to
consider this requirement when doing the adjustments.

Another issue is hardware->software.  Since one page is mapped with 4 PTEs,
you have 4 accessed/modified bits from PTEs to reflect to the high-level
vm_page_t state.  This is related to the atomicity issue I noted above.

Summary is, what you want to do (for whatever reason) cannot be achieved
by changing compilation constants, it requires code changes, some of them
are delicate.

> Thanks.
> 
> ________________________________________
> From: Polytropon <freebsd@edvax.de>
> Sent: 19 March 2016 12:27
> To: Timothy Macintyre
> Cc: freebsd-questions@freebsd.org
> Subject: Re: FreeBSD 9.0 16kb Page Size
> 
> On Fri, 18 Mar 2016 11:11:17 +0000, Timothy Macintyre wrote:
> > I'm trying to do some testing on FreeBSD 9.0 with the page size
> > set to 16kb on amd64 but I'm having trouble building a stable kernel.
> >
> > I've changed the PAGE_SHIFT to 14 under param.h and also updated
> > pmap.h/c with the following values so it doesn't complain about
> > invalid struct sizes at compile but I'm getting a crash after
> > install and reboot. Is there something I'm missing here?
> >
> >
> > #define _NPCM 12
> > #define _NPCPV 677
> 
> You should probably repeat that experiment with a currently
> supported code base. FreeBSD 9.0 is already EOL. The best
> idea would be to use the FreeBSD 10.2 release (amd64) and
> make the required changes.
> 
> In case you have a valid reason not to use FreeBSD 10, but
> instead need to keep FreeBSD 9, try the most current release,
> which is FreeBSD 9.3. Remember: it's a legacy release, not a
> production release.
> 
> If you have done this and you're still experiencing problems,
> write to the freebsd-hackers@ mailing list, which is primarily
> intended for higher-level "Technical Discussions relating to
> FreeBSD", as freebsd-questions@ is mostly a users' question
> list (less technical, often focused on "easy" problems).
> Messing with the bowels of the kernel's memory management
> isn't a typical "user question". ;-)
> 
> 
> 
> 
> --
> Polytropon
> Magdeburg, Germany
> Happy FreeBSD user since 4.0
> Andra moi ennepe, Mousa, ...
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160320123256.GH1741>