Skip to content

Commit

Permalink
x86: Move init_gbpages() to setup_arch()
Browse files Browse the repository at this point in the history
The init_gbpages() function is conditionally called from
init_memory_mapping() function. There are two call-sites where
this 'after_bootmem' condition can be true: setup_arch() and
mem_init() via pci_iommu_alloc().

Therefore, it's safe to move the call to init_gbpages() to
setup_arch() as it's always called before mem_init().

This removes an after_bootmem use - paving the way to remove
all uses of that state variable.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <Pine.LNX.4.64.0906221731210.19474@melkki.cs.Helsinki.FI>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Pekka J Enberg authored and Ingo Molnar committed Jun 23, 2009
1 parent b7f797c commit 854c879
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
16 changes: 16 additions & 0 deletions arch/x86/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,20 @@ void * __init extend_brk(size_t size, size_t align)
return ret;
}

#ifdef CONFIG_X86_64
static void __init init_gbpages(void)
{
if (direct_gbpages && cpu_has_gbpages)
printk(KERN_INFO "Using GB pages for direct mapping\n");
else
direct_gbpages = 0;
}
#else
static inline void init_gbpages(void)
{
}
#endif

static void __init reserve_brk(void)
{
if (_brk_end > _brk_start)
Expand Down Expand Up @@ -871,6 +885,8 @@ void __init setup_arch(char **cmdline_p)

reserve_brk();

init_gbpages();

/* max_pfn_mapped is updated here */
max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
max_pfn_mapped = max_low_pfn_mapped;
Expand Down
17 changes: 0 additions & 17 deletions arch/x86/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,6 @@ static int __meminit save_mr(struct map_range *mr, int nr_range,
return nr_range;
}

#ifdef CONFIG_X86_64
static void __init init_gbpages(void)
{
if (direct_gbpages && cpu_has_gbpages)
printk(KERN_INFO "Using GB pages for direct mapping\n");
else
direct_gbpages = 0;
}
#else
static inline void init_gbpages(void)
{
}
#endif

/*
* Setup the direct mapping of the physical memory at PAGE_OFFSET.
* This runs before bootmem is initialized and gets pages directly from
Expand All @@ -210,9 +196,6 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,

printk(KERN_INFO "init_memory_mapping: %016lx-%016lx\n", start, end);

if (!after_bootmem)
init_gbpages();

#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
/*
* For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
Expand Down

0 comments on commit 854c879

Please sign in to comment.