Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213476
b: refs/heads/master
c: 0768121
h: refs/heads/master
v: v3
  • Loading branch information
Nathan Fontenot authored and Greg Kroah-Hartman committed Oct 22, 2010
1 parent 5e1ac3f commit 91605c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2938ffbd466d2811a6012609684a2298eef35065
refs/heads/master: 07681215975e05a1454b0afdeef07deb0db626ee
17 changes: 11 additions & 6 deletions trunk/drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ static int add_memory_block(int nid, struct mem_section *section,

mem->phys_index = __section_nr(section);
mem->state = state;
mem->section_count++;
mutex_init(&mem->state_mutex);
start_pfn = section_nr_to_pfn(mem->phys_index);
mem->phys_device = arch_get_memory_phys_device(start_pfn);
Expand Down Expand Up @@ -519,12 +520,16 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section,

mutex_lock(&mem_sysfs_mutex);
mem = find_memory_block(section);
unregister_mem_sect_under_nodes(mem);
mem_remove_simple_file(mem, phys_index);
mem_remove_simple_file(mem, state);
mem_remove_simple_file(mem, phys_device);
mem_remove_simple_file(mem, removable);
unregister_memory(mem, section);

mem->section_count--;
if (mem->section_count == 0) {
unregister_mem_sect_under_nodes(mem);
mem_remove_simple_file(mem, phys_index);
mem_remove_simple_file(mem, state);
mem_remove_simple_file(mem, phys_device);
mem_remove_simple_file(mem, removable);
unregister_memory(mem, section);
}

mutex_unlock(&mem_sysfs_mutex);
return 0;
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
struct memory_block {
unsigned long phys_index;
unsigned long state;
int section_count;

/*
* This serializes all state change requests. It isn't
* held during creation because the control files are
Expand Down

0 comments on commit 91605c5

Please sign in to comment.