Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
uvm ncolors [was: CVS commit: src/sys/arch/x86/x86]
Thor Lancelot Simon wrote:
> Module Name: src
> Committed By: tls
> Date: Tue Apr 22 02:23:05 UTC 2008
>
> Modified Files:
>
> src/sys/arch/x86/x86: cpu.c
>
> Log Message:
>
> Commit a quick workaround for the not-power-of-two cache colors problem
> pointed out by Simon (Simon's option #3): use the greatest power of two
> which is a divisor of the desired number of cache colors.
>
> This code might want to stay even after the cache probing code is fixed.
I've got a simpler patch (below) that fixes this in uvm itself - this
change doesn't help any non-x86 if they ever try to do something stupid.
OK to back this out and apply this one instead? I'll probably change
the wording in the comment slightly. I also had the panic in an #ifdef
DIAGNOSTIC, but now think that it's worth enabling all the time - the
lossage mode when this is wrong isn't obvious.
Cheers,
Simon.
--
Index: uvm_page.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_page.c,v
retrieving revision 1.131
diff -d -p -u -r1.131 uvm_page.c
--- uvm_page.c 24 Mar 2008 08:53:25 -0000 1.131
+++ uvm_page.c 21 Apr 2008 00:30:07 -0000
@@ -942,6 +942,16 @@ uvm_page_recolor(int newncolors)
if (newncolors <= uvmexp.ncolors)
return;
+ /*
+ * check if newncolors is a power-of-two, and adjust if not
+ * to the largest power-of-two that divides cleanly into the
+ * original requested number of colours.
+ */
+ newncolors = 1 << (ffs(newncolors) - 1);
+ if ((newncolors & (newncolors - 1)) != 0)
+ panic("%s: ncolors not a power of two %d", __func__,
+ newncolors);
+
if (uvm.page_init_done == false) {
uvmexp.ncolors = newncolors;
return;
Home |
Main Index |
Thread Index |
Old Index