[CRIU] [PATCH 1/6] Replace PAGE_SIZE in vaddr_to_pfn

Christopher Covington cov at codeaurora.org
Wed Oct 8 05:13:36 PDT 2014


On 10/07/2014 05:15 AM, Cyrill Gorcunov wrote:
> On Tue, Oct 07, 2014 at 01:06:54PM +0400, Pavel Emelyanov wrote:
>> On 10/06/2014 10:50 PM, Christopher Covington wrote:
>>> On AArch64, pages may be 4K or 64K depending on kernel configuration.
>>> Instead of using the build time constant PAGE_SIZE, query the page
>>> size at run time using sysconf(_SC_PAGESIZE).
>>
>> AFAIK on x86 the PAGE_SIZE is always 4k (Cyrill?).
> 
> yes (on hw level it is not, but from software view PAGE_SIZE is always 4k)
> 
>> If this is true, can we have the vaddr_to_pfn() still operate on
>> a constant rather than the _sysconf() call for x86?
> 
> This kind of things should be wrapped with #ifdef depending on
> arch we're working on and for x86 it should remains 4k constant.

If the difference between this being a libc call and a macro significantly
impacts performance then maybe I should explore a templated approach. I'm
thinking it should be possible to essentially build the code, or parts of it,
once with -D PAGE_SIZE 4096 and again with -D PAGE_SIZE 65536 and then run the
appropriate version based on a single initial call to sysconf(). This might
also lay the foundation for a single binary, both for ARM and x86, that can
dump both 32-bit and 64-bit programs. Would this be worth exploring?

Thanks,
Christopher

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.


More information about the CRIU mailing list