[CRIU] [PATCH 2/2] include/common: Default to build host's page size

Dmitry Safonov 0x7f454c46 at gmail.com
Wed Nov 2 13:29:48 PDT 2016


2016-11-02 20:15 GMT+03:00 Christopher Covington <cov at codeaurora.org>:
> On PowerPC or arm64, different distributions may configure their
> kernel to provide different page sizes (4k versus 64k for example).
> CRIU must currently be built for a specific page size. Default to
> using the build system's page size, to make native building work by
> default. For cross-compiling or other situations, the default can
> be overriden like so:
>
>   rm criu/include/config.h
>   make PAGE_SIZE=65536
>
> Signed-off-by: Christopher Covington <cov at codeaurora.org>

Hi,

I have a dumb question :)
Why do we have PAGE_SIZE constant *and* page_size() func?
I mean, I don't completely get why in some places we use one over
the other alternative. I see two cons for using page_size() everywhere:
1. perf cost for calling sysconf()
2. using PAGE_SIZE in BUILD_BUG_ON macros.

So, I guess, if we introduce some kdat variable, that will get initialized
with sysconf() and use it everywhere, we will solve (1) problem and
even gain some free perf in places where page_size() is used now.
For (2), we can rename PAGE_SIZE to PAGE_SIZE_MIN or something,
so we keep all BUILD_BUG_ONs in places and review, where we
could use kdat var instead. Maybe even if there is a chance to rewrite
those build-checks without arch page size, we could remove this
macro completely.

With kdat var we also will fix page_size() on platforms where is just
returns PAGE_SIZE -- AFAIK, x86 also has optional huge pages.

Does that makes sence?

-- 
             Dmitry


More information about the CRIU mailing list