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

Commit d2560a26 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Revert "mm/memblock: fix a race between search and remove""

parents be19bd22 168586e9
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -181,16 +181,13 @@ static void removed_region_fixup(struct removed_region *dma_mem, int index)
{
	unsigned long fixup_size;
	unsigned long base_pfn;
	unsigned long flags;

	if (index > dma_mem->nr_pages)
		return;

	/* carve-out */
	flags = memblock_region_resize_late_begin();
	memblock_free(dma_mem->base, dma_mem->nr_pages * PAGE_SIZE);
	memblock_remove(dma_mem->base, index * PAGE_SIZE);
	memblock_region_resize_late_end(flags);

	/* clear page-mappings */
	base_pfn = dma_mem->base >> PAGE_SHIFT;
+0 −2
Original line number Diff line number Diff line
@@ -90,8 +90,6 @@ int memblock_mark_mirror(phys_addr_t base, phys_addr_t size);
int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
ulong choose_memblock_flags(void);
unsigned long memblock_region_resize_late_begin(void);
void memblock_region_resize_late_end(unsigned long flags);

/* Low level functions */
int memblock_add_range(struct memblock_type *type,
+2 −51
Original line number Diff line number Diff line
@@ -19,9 +19,6 @@
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/memblock.h>
#include <linux/preempt.h>
#include <linux/seqlock.h>
#include <linux/irqflags.h>

#include <asm/sections.h>
#include <linux/io.h>
@@ -34,7 +31,6 @@ static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIO
static struct memblock_region memblock_physmem_init_regions[INIT_PHYSMEM_REGIONS] __initdata_memblock;
#endif

static seqcount_t memblock_seq;
struct memblock memblock __initdata_memblock = {
	.memory.regions		= memblock_memory_init_regions,
	.memory.cnt		= 1,	/* empty dummy entry */
@@ -1556,7 +1552,7 @@ void __init memblock_mem_limit_remove_map(phys_addr_t limit)
	memblock_cap_memory_range(0, max_addr);
}

static int __init_memblock __memblock_search(struct memblock_type *type,
static int __init_memblock memblock_search(struct memblock_type *type,
					phys_addr_t addr)
{
	unsigned int left = 0, right = type->cnt;
@@ -1575,20 +1571,6 @@ static int __init_memblock __memblock_search(struct memblock_type *type,
	return -1;
}

static int __init_memblock memblock_search(struct memblock_type *type,
					   phys_addr_t addr)
{
	int ret;
	unsigned long seq;

	do {
		seq = raw_read_seqcount_begin(&memblock_seq);
		ret = __memblock_search(type, addr);
	} while (unlikely(read_seqcount_retry(&memblock_seq, seq)));

	return ret;
}

bool __init memblock_is_reserved(phys_addr_t addr)
{
	return memblock_search(&memblock.reserved, addr) != -1;
@@ -1773,37 +1755,6 @@ void __init memblock_allow_resize(void)
	memblock_can_resize = 1;
}

static unsigned long __init_memblock
memblock_resize_late(int begin, unsigned long flags)
{
	static int memblock_can_resize_old;

	if (begin) {
		preempt_disable();
		local_irq_save(flags);
		memblock_can_resize_old = memblock_can_resize;
		memblock_can_resize = 0;
		raw_write_seqcount_begin(&memblock_seq);
	} else {
		raw_write_seqcount_end(&memblock_seq);
		memblock_can_resize = memblock_can_resize_old;
		local_irq_restore(flags);
		preempt_enable();
	}

	return flags;
}

unsigned long __init_memblock memblock_region_resize_late_begin(void)
{
	return memblock_resize_late(1, 0);
}

void __init_memblock memblock_region_resize_late_end(unsigned long flags)
{
	memblock_resize_late(0, flags);
}

static int __init early_memblock(char *p)
{
	if (p && strstr(p, "debug"))