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

Cyrill Gorcunov gorcunov at gmail.com
Wed Oct 8 08:17:07 PDT 2014


On Wed, Oct 08, 2014 at 07:05:28PM +0400, Pavel Emelyanov wrote:
> >>
> >> 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?
> 
> I've grep-ed around all the '\[PAGE_SIZE' lines. It looks like there's only
> one place that requires a page -- in memory restorer. All other places just
> declare a buffer big enough to fit what it needs (log message, proc file line,
> etc.).  That said, yes I agree that we might need another set of constants
> for such cases, but in all but one of them has nothing to do with a page :)

So lets start with changing buffers size then. I think my ideal scenario
would be to

 - left PAGE_SIZE as a macro (constant for x86 and helper for other archs if needed)
 - in pie code pass PAGE_SIZE as argument (because we can't call for any libc from
   inside of parasite code)
 - for internal buffers which require compiletime sizes simply use PAGE_OR_LESS
   or something like that

iow the less new vars we're introdusing then better. I'm not sure how easy it
would be to implement though.


More information about the CRIU mailing list