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

Cyrill Gorcunov gorcunov at gmail.com
Wed Oct 8 07:58:46 PDT 2014


On Wed, Oct 08, 2014 at 10:42:29AM -0400, Christopher Covington wrote:
> > 
> > or something like that. SO we don't have to change PAGE_SIZE all over
> > the criu code at all, but in one place only. Hmm? What do you think?
> 
> I did try that and I'd like to end up with something mostly equivalent.
> However, some existing code assumes PAGE_SIZE is constant, using it for
> compile-time buffer sizes. My instinct is to not turn all of these into
> run-time allocations.
> 
> (As a brief aside, I it's a reasonable assumption to think PAGE_SIZE or
> ANY_MACRO_REALLY is a compile-time constant. In my opinion, using a function
> such as sysconf(_SC_PAGESIZE) or lowercase variable name such as page_size
> best communicates to those reading and writing the common code that the value
> cannot be relied upon to be a compile time constant across all systems.)
> 
> Here are the different possible uses of PAGE_SIZE and corresponding
> replacements that I came up with:
> 
> PAGE_OR_LESS -- (local) compile-time constant minimum page size, guaranteed to
> be less than or equal to one page but not necessarily page aligned
> 
> EXEC_PAGESIZE -- (libc) compile-time constant maximum page size, guaranteed to
> be greater than or equal to one page and page aligned
> 
> sysconf(_SC_PAGESIZE) or page_size -- (libc or local) run-time determined
> value of the current page size
> 
> (And maybe also something like BUFFER_SIZE, if I run into uses that really
> have no functional or performance connection to the page size:
> http://lists.busybox.net/pipermail/busybox/2011-June/075864.html)

I see. Indeed we've a number of places where PAGE_SIZE is assumed to be
a constant expanded at compile time. I like the idea of introducing
these variables. Pavel?


More information about the CRIU mailing list