Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: uvm ncolors [was: CVS commit: src/sys/arch/x86/x86]



Our thanks to uebayasi-san for the insight into the correct way to do
this.

Best,
Al

PS. Is the check for newncolors being a power of two necessary any more?

On Tue, Apr 22, 2008 at 01:57:00PM +1000, Simon Burge wrote:
> [...]
> 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