On Thu 2009-10-08 18:33:39, Wu Zhangjin wrote:
> Hi,
>
> On Thu, 2009-10-08 at 11:29 +0200, Pavel Machek wrote:
> > On Thu 2009-10-08 16:57:32, Wu Zhangjin wrote:
> > > When CONFIG_FLAGMEM enabled, STD/Hiberation will fail on YeeLoong
> > > laptop, This patch fix it:
> > >
> > > if pfn is between min_low_pfn and max_mapnr, the old pfn_valid() will
> > > return TRUE, but in reality, if the memory is not continuous, it should
> > > be false. for example:
> > >
> > > $ cat /proc/iomem | grep "System RAM"
> > > 00000000-0fffffff : System RAM
> > > 90000000-bfffffff : System RAM
> > >
> > > as we can see, it is not continuous, so, some of the memory is not valid
> > > but regarded as valid by pfn_valid(), and at last make STD/Hibernate
> > > fail when shrinking a too large number of invalid memory.
> > >
> > > Here, we fix it via checking pfn is in the "System RAM" or not, if yes,
> > > return TRUE.
> >
> > "return FALSE"?
> >
> > > Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> >
> > Looks mostly ok, small comments below.
> >
> > > @@ -168,13 +168,10 @@ typedef struct { unsigned long pgprot; } pgprot_t;
> > >
> > > #ifdef CONFIG_FLATMEM
> > >
> > > -#define pfn_valid(pfn)
> > > \
> > > -({
> > > \
> > > - unsigned long __pfn = (pfn); \
> > > - /* avoid <linux/bootmem.h> include hell */ \
> > > - extern unsigned long min_low_pfn; \
> > > - \
> > > - __pfn >= min_low_pfn && __pfn < max_mapnr; \
> > > +#define pfn_valid(pfn) \
> > > +({ \
> > > + extern int is_pfn_valid(unsigned long); \
> > > + is_pfn_valid(pfn); \
> > > })
> >
> > "extern int pfn_valid here"
> >
> > ...and get away without the ugly macro?
> >
>
> Perhaps need to move the whole "#ifdef CONFIG_FLATMEM" to #ifndef
> ASSEMBLY, otherwise,
>
> "arch/mips/include/asm/page.h:170: Error: unrecognized opcode `extern
> int pfn_valid(unsigned long)'".
I guess so. pfn_valid() will not work from assembly, anywa, so...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures)
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
|