[PATCH 3/3] mm/sparse: remove index_init_lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Apart from call to sparse_index_init() during boot stage, the function
is mainly used for hotplug case as follows and protected by hotplug
mutex "mem_hotplug_mutex". So we needn't the spinlock in sparse_index_init().

	sparse_index_init
	sparse_add_one_section
	__add_section
	__add_pages
	arch_add_memory
	add_memory

Signed-off-by: Gavin Shan <shangw@xxxxxxxxxxxxxxxxxx>
---
 mm/sparse.c |   14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 8b8edfb..4437c6c 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -77,7 +77,6 @@ static struct mem_section noinline __init_refok *sparse_index_alloc(int nid)
 
 static int __meminit sparse_index_init(unsigned long section_nr, int nid)
 {
-	static DEFINE_SPINLOCK(index_init_lock);
 	unsigned long root = SECTION_NR_TO_ROOT(section_nr);
 	struct mem_section *section;
 	int ret = 0;
@@ -88,20 +87,9 @@ static int __meminit sparse_index_init(unsigned long section_nr, int nid)
 	section = sparse_index_alloc(nid);
 	if (!section)
 		return -ENOMEM;
-	/*
-	 * This lock keeps two different sections from
-	 * reallocating for the same index
-	 */
-	spin_lock(&index_init_lock);
-
-	if (mem_section[root]) {
-		ret = -EEXIST;
-		goto out;
-	}
 
 	mem_section[root] = section;
-out:
-	spin_unlock(&index_init_lock);
+
 	return ret;
 }
 #else /* !SPARSEMEM_EXTREME */
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]