Re: [PATCH 19/34] m68k: handle pgtable_page_ctor() fail

From: Kirill A. Shutemov
Date: Wed Oct 16 2013 - 05:56:45 EST


Geert Uytterhoeven wrote:
> On Thu, Oct 10, 2013 at 8:05 PM, Kirill A. Shutemov
> <kirill.shutemov@xxxxxxxxxxxxxxx> wrote:
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> > Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> > ---
> > arch/m68k/include/asm/motorola_pgalloc.h | 5 ++++-
> > arch/m68k/include/asm/sun3_pgalloc.h | 5 ++++-
> > 2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h
> > index 2f02f264e6..dd254eeb03 100644
> > --- a/arch/m68k/include/asm/motorola_pgalloc.h
> > +++ b/arch/m68k/include/asm/motorola_pgalloc.h
> > @@ -40,7 +40,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addres
> > flush_tlb_kernel_page(pte);
> > nocache_page(pte);
> ^^^^^^^^^^^^^^^^^^
> > kunmap(page);
> > - pgtable_page_ctor(page);
> > + if (!pgtable_page_ctor(page)) {
> > + __free_page(page);
>
> Shouldn't you mark the page cacheable again, like is done in pte_free()?

Hm. You're right. Updated patch below.

BTW, what's the point of playing with kmap()/kunmap() there? Looks like
m68k doesn't support highmem.

And even if it will support, code in pte_alloc_one() doesn't make any
sense: kmap() creates temporary mapping for highmem page and it
nocache_page() sets flags in pte which will be destroyed by kunmap().

It think kmap() should be replaced by page_address() and kunmap() should
be dropped.