* [PATCH] arm64: mm: mark alloc_init_p{m,u}d as __ref
@ 2015-01-29 11:31 Will Deacon
  2015-01-29 16:26 ` Catalin Marinas
  0 siblings, 1 reply; 2+ messages in thread
From: Will Deacon @ 2015-01-29 11:31 UTC (permalink / raw)
  To: linux-arm-kernel
Both alloc_init_pmd and alloc_init_pud refer to the __init function
early_alloc as part of a BUG_ON(alloc != early_alloc) statement.
This patch marks the functions as __ref to avoid the spurious section
mismatch.
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/mm/mmu.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 2eeac10aa0cf..611750b771c4 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -118,10 +118,10 @@ void split_pud(pud_t *old_pud, pmd_t *pmd)
 	} while (pmd++, i++, i < PTRS_PER_PMD);
 }
 
-static void alloc_init_pmd(struct mm_struct *mm, pud_t *pud,
-				  unsigned long addr, unsigned long end,
-				  phys_addr_t phys, pgprot_t prot,
-				  void *(*alloc)(unsigned long size))
+static void __ref alloc_init_pmd(struct mm_struct *mm, pud_t *pud,
+				 unsigned long addr, unsigned long end,
+				 phys_addr_t phys, pgprot_t prot,
+				 void *(*alloc)(unsigned long size))
 {
 	pmd_t *pmd;
 	unsigned long next;
@@ -183,10 +183,10 @@ static inline bool use_1G_block(unsigned long addr, unsigned long next,
 	return true;
 }
 
-static void alloc_init_pud(struct mm_struct *mm, pgd_t *pgd,
-				  unsigned long addr, unsigned long end,
-				  phys_addr_t phys, pgprot_t prot,
-				  void *(*alloc)(unsigned long size))
+static void __ref alloc_init_pud(struct mm_struct *mm, pgd_t *pgd,
+				 unsigned long addr, unsigned long end,
+				 phys_addr_t phys, pgprot_t prot,
+				 void *(*alloc)(unsigned long size))
 {
 	pud_t *pud;
 	unsigned long next;
-- 
2.1.4
^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [PATCH] arm64: mm: mark alloc_init_p{m,u}d as __ref
  2015-01-29 11:31 [PATCH] arm64: mm: mark alloc_init_p{m,u}d as __ref Will Deacon
@ 2015-01-29 16:26 ` Catalin Marinas
  0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2015-01-29 16:26 UTC (permalink / raw)
  To: linux-arm-kernel
On Thu, Jan 29, 2015 at 11:31:03AM +0000, Will Deacon wrote:
> Both alloc_init_pmd and alloc_init_pud refer to the __init function
> early_alloc as part of a BUG_ON(alloc != early_alloc) statement.
> 
> This patch marks the functions as __ref to avoid the spurious section
> mismatch.
Actually, I think it's better to do this:
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 2eeac10aa0cf..c6daaf6c6f97 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -26,6 +26,7 @@
 #include <linux/memblock.h>
 #include <linux/fs.h>
 #include <linux/io.h>
+#include <linux/slab.h>
 #include <linux/stop_machine.h>
 
 #include <asm/cputype.h>
@@ -159,8 +160,8 @@ static void alloc_init_pmd(struct mm_struct *mm, pud_t *pud,
 				flush_tlb_all();
 				if (pmd_table(old_pmd)) {
 					phys_addr_t table = __pa(pte_offset_map(&old_pmd, 0));
-					BUG_ON(alloc != early_alloc);
-					memblock_free(table, PAGE_SIZE);
+					if (!WARN_ON_ONCE(slab_is_available()))
+						memblock_free(table, PAGE_SIZE);
 				}
 			}
 		} else {
@@ -220,8 +221,8 @@ static void alloc_init_pud(struct mm_struct *mm, pgd_t *pgd,
 				flush_tlb_all();
 				if (pud_table(old_pud)) {
 					phys_addr_t table = __pa(pmd_offset(&old_pud, 0));
-					BUG_ON(alloc != early_alloc);
-					memblock_free(table, PAGE_SIZE);
+					if (!WARN_ON_ONCE(slab_is_available()))
+						memblock_free(table, PAGE_SIZE);
 				}
 			}
 		} else {
^ permalink raw reply related	[flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-29 16:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-29 11:31 [PATCH] arm64: mm: mark alloc_init_p{m,u}d as __ref Will Deacon
2015-01-29 16:26 ` Catalin Marinas
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).