From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>,
Linux-Arch <linux-arch@vger.kernel.org>,
Linux/m68k <linux-m68k@vger.kernel.org>
Subject: Re: [PATCH 19/34] m68k: handle pgtable_page_ctor() fail
Date: Wed, 16 Oct 2013 13:29:39 +0300 (EEST) [thread overview]
Message-ID: <20131016102939.DC0D0E0090@blue.fi.intel.com> (raw)
In-Reply-To: <20131016095612.34707E0090@blue.fi.intel.com>
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
WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Andrew Morton <akpm@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>,
Linux-Arch <linux-arch@vger.kernel.org>,
Linux/m68k <linux-m68k@vger.kernel.org>
Subject: Re: [PATCH 19/34] m68k: handle pgtable_page_ctor() fail
Date: Wed, 16 Oct 2013 13:29:39 +0300 (EEST) [thread overview]
Message-ID: <20131016102939.DC0D0E0090@blue.fi.intel.com> (raw)
Message-ID: <20131016102939.N8WPsMLhriiJbx235ZUBsRzMyAXPpSaO5J6vtAaBFQY@z> (raw)
In-Reply-To: <20131016095612.34707E0090@blue.fi.intel.com>
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
next prev parent reply other threads:[~2013-10-16 10:29 UTC|newest]
Thread overview: 117+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 18:05 [PATCH 00/34] dynamically allocate split ptl if it cannot be embedded to struct page Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 01/34] x86: add missed pgtable_pmd_page_ctor/dtor calls for preallocated pmds Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-11 5:50 ` Ingo Molnar
2013-10-11 5:50 ` Ingo Molnar
2013-10-10 18:05 ` [PATCH 02/34] cris: fix potential NULL-pointer dereference Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-11 9:58 ` Jesper Nilsson
2013-10-11 9:58 ` Jesper Nilsson
2013-10-10 18:05 ` [PATCH 03/34] m32r: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 04/34] xtensa: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 05/34] mm: allow pgtable_page_ctor() to fail Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 06/34] microblaze: add missing pgtable_page_ctor/dtor calls Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 07/34] mn10300: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 08/34] openrisc: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 09/34] alpha: handle pgtable_page_ctor() fail Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 10/34] arc: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-16 7:55 ` Vineet Gupta
2013-10-10 18:05 ` [PATCH 11/34] arm: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 20:18 ` Russell King - ARM Linux
2013-10-10 21:53 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 12/34] arm64: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 13/34] avr32: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 19:14 ` Hans-Christian Egtvedt
2013-10-10 19:14 ` Hans-Christian Egtvedt
2013-10-10 18:05 ` [PATCH 14/34] cris: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-11 9:57 ` Jesper Nilsson
2013-10-11 9:57 ` Jesper Nilsson
2013-10-10 18:05 ` [PATCH 15/34] frv: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 16/34] hexagon: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 17/34] ia64: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 18/34] m32r: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 19/34] m68k: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-16 8:07 ` Geert Uytterhoeven
2013-10-16 8:07 ` Geert Uytterhoeven
2013-10-16 9:56 ` Kirill A. Shutemov
2013-10-16 9:56 ` Kirill A. Shutemov
2013-10-16 10:29 ` Kirill A. Shutemov [this message]
2013-10-16 10:29 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 20/34] metag: " Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 21/34] mips: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 22/34] parisc: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 23/34] powerpc: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 24/34] s390: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 25/34] score: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-13 10:07 ` Lennox Wu
2013-10-10 18:05 ` [PATCH 26/34] sh: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 27/34] sparc: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:33 ` David Miller
2013-10-10 18:05 ` [PATCH 28/34] tile: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 19:50 ` Chris Metcalf
2013-10-10 19:50 ` Chris Metcalf
2013-10-10 18:05 ` [PATCH 29/34] um: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 30/34] unicore32: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 31/34] x86: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 32/34] xtensa: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 18:05 ` [PATCH 33/34] iommu/arm-smmu: " Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-11 10:26 ` Will Deacon
2013-10-11 10:26 ` Will Deacon
2013-10-10 18:05 ` [PATCH 34/34] mm: dynamically allocate page->ptl if it cannot be embedded to struct page Kirill A. Shutemov
2013-10-10 18:05 ` Kirill A. Shutemov
2013-10-10 20:00 ` Christoph Lameter
2013-10-10 20:09 ` Kirill A. Shutemov
2013-10-10 20:09 ` Kirill A. Shutemov
2013-10-11 14:01 ` Christoph Lameter
2013-10-11 14:01 ` Christoph Lameter
2013-10-14 9:04 ` Kirill A. Shutemov
2013-10-14 19:04 ` Christoph Lameter
2013-10-14 19:04 ` Christoph Lameter
2013-10-14 21:25 ` Kirill A. Shutemov
2013-10-14 22:13 ` Christoph Lameter
2013-10-14 22:13 ` Christoph Lameter
2013-10-14 22:26 ` Kirill A. Shutemov
2013-11-20 8:44 ` Andrey Wagin
2013-11-20 8:44 ` Andrey Wagin
2013-11-20 12:53 ` Kirill A. Shutemov
2013-11-20 12:56 ` Andrey Wagin
2013-11-20 12:56 ` Andrey Wagin
2013-11-20 13:06 ` Kirill A. Shutemov
2013-11-20 13:06 ` Kirill A. Shutemov
2013-11-20 13:29 ` Andrey Wagin
2013-10-10 19:47 ` [PATCH 00/34] dynamically allocate split ptl " Peter Zijlstra
2013-10-11 16:30 ` [PATCH 15/34] frv: handle pgtable_page_ctor() fail David Howells
2013-10-11 16:30 ` David Howells
2013-10-14 9:12 ` Kirill A. Shutemov
2013-10-14 9:12 ` Kirill A. Shutemov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131016102939.DC0D0E0090@blue.fi.intel.com \
--to=kirill.shutemov@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=geert@linux-m68k.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).