* Re: [PATCH 19/34] m68k: handle pgtable_page_ctor() fail [not found] ` <1381428359-14843-20-git-send-email-kirill.shutemov@linux.intel.com> @ 2013-10-16 8:07 ` Geert Uytterhoeven 2013-10-16 9:56 ` Kirill A. Shutemov 0 siblings, 1 reply; 3+ messages in thread From: Geert Uytterhoeven @ 2013-10-16 8:07 UTC (permalink / raw) To: Kirill A. Shutemov Cc: Andrew Morton, Peter Zijlstra, Ingo Molnar, linux-kernel@vger.kernel.org, Linux MM, Linux-Arch, Linux/m68k On Thu, Oct 10, 2013 at 8:05 PM, Kirill A. Shutemov <kirill.shutemov@linux.intel.com> wrote: > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> > Cc: Geert Uytterhoeven <geert@linux-m68k.org> > --- > 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()? > + return NULL; > + } > return page; > } > > diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h > index 48d80d5a66..f868506e33 100644 > --- a/arch/m68k/include/asm/sun3_pgalloc.h > +++ b/arch/m68k/include/asm/sun3_pgalloc.h > @@ -59,7 +59,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, > return NULL; > > clear_highpage(page); > - pgtable_page_ctor(page); > + if (!pgtable_page_ctor(page)) { > + __free_page(page); > + return NULL; > + } > return page; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 19/34] m68k: handle pgtable_page_ctor() fail 2013-10-16 8:07 ` [PATCH 19/34] m68k: handle pgtable_page_ctor() fail Geert Uytterhoeven @ 2013-10-16 9:56 ` Kirill A. Shutemov 2013-10-16 10:29 ` Kirill A. Shutemov 0 siblings, 1 reply; 3+ messages in thread From: Kirill A. Shutemov @ 2013-10-16 9:56 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Kirill A. Shutemov, Andrew Morton, Peter Zijlstra, Ingo Molnar, linux-kernel@vger.kernel.org, Linux MM, Linux-Arch, Linux/m68k Geert Uytterhoeven wrote: > On Thu, Oct 10, 2013 at 8:05 PM, Kirill A. Shutemov > <kirill.shutemov@linux.intel.com> wrote: > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> > > Cc: Geert Uytterhoeven <geert@linux-m68k.org> > > --- > > 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. >From 2f9dce7982e4459e91cd49e38256c24d69786f8b Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Date: Wed, 9 Oct 2013 03:58:39 +0300 Subject: [PATCHv2] m68k: handle pgtable_page_ctor() fail Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> --- arch/m68k/include/asm/motorola_pgalloc.h | 8 ++++++-- arch/m68k/include/asm/sun3_pgalloc.h | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h index 2f02f264e6..24bcba496c 100644 --- a/arch/m68k/include/asm/motorola_pgalloc.h +++ b/arch/m68k/include/asm/motorola_pgalloc.h @@ -29,18 +29,22 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) { - struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); + struct page *page; pte_t *pte; + page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); if(!page) return NULL; + if (!pgtable_page_ctor(page)) { + __free_page(page); + return NULL; + } pte = kmap(page); __flush_page_to_ram(pte); flush_tlb_kernel_page(pte); nocache_page(pte); kunmap(page); - pgtable_page_ctor(page); return page; } diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index 48d80d5a66..f868506e33 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h @@ -59,7 +59,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, return NULL; clear_highpage(page); - pgtable_page_ctor(page); + if (!pgtable_page_ctor(page)) { + __free_page(page); + return NULL; + } return page; } -- Kirill A. Shutemov -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 19/34] m68k: handle pgtable_page_ctor() fail 2013-10-16 9:56 ` Kirill A. Shutemov @ 2013-10-16 10:29 ` Kirill A. Shutemov 0 siblings, 0 replies; 3+ messages in thread From: Kirill A. Shutemov @ 2013-10-16 10:29 UTC (permalink / raw) Cc: Geert Uytterhoeven, Kirill A. Shutemov, Andrew Morton, Peter Zijlstra, Ingo Molnar, linux-kernel@vger.kernel.org, Linux MM, Linux-Arch, Linux/m68k Kirill A. Shutemov wrote: > Geert Uytterhoeven wrote: > > On Thu, Oct 10, 2013 at 8:05 PM, Kirill A. Shutemov > > <kirill.shutemov@linux.intel.com> wrote: > > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> > > > Cc: Geert Uytterhoeven <geert@linux-m68k.org> > > > --- > > > 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. I also noticed that one of pte_alloc_one didn't have the constructor at all. New patch revision bellow. >From 22109077ef31ea28bbfe6b72902854214285bc0c Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Date: Wed, 9 Oct 2013 03:58:39 +0300 Subject: [PATCHv3] m68k: handle pgtable_page_ctor() fail Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> --- arch/m68k/include/asm/mcf_pgalloc.h | 4 ++++ arch/m68k/include/asm/motorola_pgalloc.h | 8 ++++++-- arch/m68k/include/asm/sun3_pgalloc.h | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h index 313f3dd23c..f9924fbcfe 100644 --- a/arch/m68k/include/asm/mcf_pgalloc.h +++ b/arch/m68k/include/asm/mcf_pgalloc.h @@ -56,6 +56,10 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, if (!page) return NULL; + if (!pgtable_page_ctor(page)) { + __free_page(page); + return NULL; + } pte = kmap(page); if (pte) { diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h index 2f02f264e6..24bcba496c 100644 --- a/arch/m68k/include/asm/motorola_pgalloc.h +++ b/arch/m68k/include/asm/motorola_pgalloc.h @@ -29,18 +29,22 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) { - struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); + struct page *page; pte_t *pte; + page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); if(!page) return NULL; + if (!pgtable_page_ctor(page)) { + __free_page(page); + return NULL; + } pte = kmap(page); __flush_page_to_ram(pte); flush_tlb_kernel_page(pte); nocache_page(pte); kunmap(page); - pgtable_page_ctor(page); return page; } diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index 48d80d5a66..f868506e33 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h @@ -59,7 +59,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm, return NULL; clear_highpage(page); - pgtable_page_ctor(page); + if (!pgtable_page_ctor(page)) { + __free_page(page); + return NULL; + } return page; } -- Kirill A. Shutemov ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-16 10:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1381428359-14843-1-git-send-email-kirill.shutemov@linux.intel.com>
[not found] ` <1381428359-14843-20-git-send-email-kirill.shutemov@linux.intel.com>
2013-10-16 8:07 ` [PATCH 19/34] m68k: handle pgtable_page_ctor() fail Geert Uytterhoeven
2013-10-16 9:56 ` Kirill A. Shutemov
2013-10-16 10:29 ` Kirill A. Shutemov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox