Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f691fa10 authored by Michael Ellerman's avatar Michael Ellerman
Browse files

powerpc: Replace mem_init_done with slab_is_available()



We have a powerpc specific global called mem_init_done which is "set on
boot once kmalloc can be called".

But that's not *quite* true. We set it at the bottom of mem_init(), and
rely on the fact that mm_init() calls kmem_cache_init() immediately
after that, and nothing is running in parallel.

So replace it with the generic and 100% correct slab_is_available().

Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 4f9c53c8
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
extern void ppc_printk_progress(char *s, unsigned short hex);

extern unsigned int rtas_data;
extern int mem_init_done;	/* set on boot once kmalloc can be called */
extern unsigned long long memory_limit;
extern unsigned long klimit;
extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
	list_add_tail(&phb->list_node, &hose_list);
	spin_unlock(&hose_spinlock);
	phb->dn = dev;
	phb->is_dynamic = mem_init_done;
	phb->is_dynamic = slab_is_available();
#ifdef CONFIG_PPC64
	if (dev) {
		int nid = of_node_to_nid(dev);
+2 −2
Original line number Diff line number Diff line
@@ -401,7 +401,7 @@ static char *__fetch_rtas_last_error(char *altbuf)
			buf = altbuf;
		} else {
			buf = rtas_err_buf;
			if (mem_init_done)
			if (slab_is_available())
				buf = kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC);
		}
		if (buf)
@@ -461,7 +461,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)

	if (buff_copy) {
		log_error(buff_copy, ERR_TYPE_RTAS_LOG, 0);
		if (mem_init_done)
		if (slab_is_available())
			kfree(buff_copy);
	}
	return ret;
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask)
{
	void *p;

	if (mem_init_done)
	if (slab_is_available())
		p = kzalloc(size, mask);
	else {
		p = memblock_virt_alloc(size, 0);
+0 −3
Original line number Diff line number Diff line
@@ -61,7 +61,6 @@
#define CPU_FTR_NOEXECUTE	0
#endif

int mem_init_done;
unsigned long long memory_limit;

#ifdef CONFIG_HIGHMEM
@@ -377,8 +376,6 @@ void __init mem_init(void)
	pr_info("  * 0x%08lx..0x%08lx  : vmalloc & ioremap\n",
		VMALLOC_START, VMALLOC_END);
#endif /* CONFIG_PPC32 */

	mem_init_done = 1;
}

void free_initmem(void)
Loading