On Friday 12 April 2002 03:49, Thomas Duffy wrote:
> [cc list trimmed]
> On Thu, 2002-04-11 at 18:10, Kanoj Sarcar wrote:
> > --- Rik van Riel <riel@...> wrote:
> > > "Lets keep struct page a power of 2 so we can drop a
> > > field"
> > >
> > > ... that makes surprisingly little sense to my tired
> > > mind ;)
> > So that to go from a kernel address to its struct page
> > and vice versa need not involve mult/div (with size
> > of struct page), just left or right shifts (of log2
> > struct page size).
> I think what Rik was trying to say is that the doesn't make much sense
> to eliminate the "virtual" field in the page struct if because that
> entry is no longer there, you have to maintain the struct as a power of
> 2 in order to make mults/divs cheap on some hw.
It would be nice if it were possible to identify a per-page field or two that
would be equally happy as a member of struct page or an element of a separate
vector and wrap such a field in a get/set_somefield(page) inline so that the
field can be optionally excluded from struct page to bring the size to a
power-of-2 value. That said, I'll put this idea away. The multiply isn't
that horrible for the ordinal_to_page conversion and either an optimized
divide or a field implicitly recording the page number will do for
Whatever the spar64 compiler bug is that prevents the divide from being
optimized, it should be fixed. There is no reasonable excuse for failing to
This doesn't affect the structure of the config_nonlinear patch or its
applicability to sparc, since the page_to_ordinal conversion is
per-architecture. I suppose it will stay that way, though I am considering
the idea of giving the page.h's of all architectures a good scrubbing. Some
of them are pretty filthy at the moment.
At this point I favor the idea of creating a page_common.h to be included
from the per-arch page.h, and which would contain some number of generic
conversions that are applicable to most architectures. The sparc64
architecture, for example, could simply fail to include page_common.h and use
a cut, pasted and hacked version instead. However, since we already have a
config option for this (WANT_PAGE_VIRTUAL) we may be within sight of being
able to write page_common.h in a completely cross-architecture way.