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

Cyrill Gorcunov gorcunov at gmail.com
Wed Oct 8 06:29:46 PDT 2014


On Wed, Oct 08, 2014 at 09:11:46AM -0400, Christopher Covington wrote:
> >>
> >> or something like that.
> > 
> > But the intention was exactly to avoid compile-time PAGE_SIZE, thus
> > direct call to _sysconf on ARM looks more acceptable here.
> > 
> > As far as the performance is concerned. In the current set I see no
> > problems having one as a call, but we may someday have the PAGE_SIZE
> > get involved into some for() loop and making one call per iteration
> > would just produce unnecessary noise.
> > 
> > Can we "cache" the value in kerndat.c and always use the variable?
> 
> Sure, for v2 I'll try out page_size and task_size variables in kerndat.c.

Guys, guys, wait. Look, we have a generic definitions for PAGE_SIZE in
include/asm-generic/page.h

#ifndef __CR_ASM_GENERIC_PAGE_H__
#define __CR_ASM_GENERIC_PAGE_H__

#ifndef PAGE_SHIFT
# define PAGE_SHIFT12
#endif

#ifndef PAGE_SIZE
# define PAGE_SIZE(1UL << PAGE_SHIFT)
#endif

#ifndef PAGE_MASK
# define PAGE_MASK(~(PAGE_SIZE - 1))
#endif

#define PAGE_PFN(addr)addr((addr) / PAGE_SIZE)

#endif /* __CR_ASM_GENERIC_PAGE_H__ */

Why don't

#include "asm/page.h"

here and redefine PAGE_SIZE/SHIT and such there. IOW,
for ARM it could be

arch/arm/include/asm/page.h

#define PAGE_SIZE (sysconf(_PAGE_SIZE)))

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?


More information about the CRIU mailing list