lkml.org 
[lkml]   [2014]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[RFC PATCH] memory driver: make phys_index/end_phys_index reflect the start/end section number
From
Date
I noticed the phys_index and end_phys_index under 
/sys/devices/system/memory/memoryXXX/ have the same value, e.g.
(for the test machine, one memory block has 8 sections, that is
sections_per_block equals 8)

# cd /sys/devices/system/memory/memory100/
# cat phys_index end_phys_index
00000064
00000064

Seems they should reflect the start/end section number respectively, which
also matches what is said in Documentation/memory-hotplug.txt

This patch tries to modify that so the two files could show the start/end
section number of the memory block.

After this change, output of the above example looks like:

# cat phys_index end_phys_index
00000320
00000327

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
drivers/base/memory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index bece691..b10f2fa 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -114,7 +114,7 @@ static ssize_t show_mem_start_phys_index(struct device *dev,
struct memory_block *mem = to_memory_block(dev);
unsigned long phys_index;

- phys_index = mem->start_section_nr / sections_per_block;
+ phys_index = mem->start_section_nr;
return sprintf(buf, "%08lx\n", phys_index);
}

@@ -124,7 +124,7 @@ static ssize_t show_mem_end_phys_index(struct device *dev,
struct memory_block *mem = to_memory_block(dev);
unsigned long phys_index;

- phys_index = mem->end_section_nr / sections_per_block;
+ phys_index = mem->end_section_nr;
return sprintf(buf, "%08lx\n", phys_index);
}




\
 
 \ /
  Last update: 2014-04-02 11:41    [W:0.136 / U:6.952 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site