aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJin Dongming <jin.dongming@np.css.fujitsu.com>2010-11-24 15:38:11 +0900
committerAndi Kleen <ak@linux.intel.com>2010-11-24 11:35:44 +0100
commit6fffcb2d14bec37b745659f4ee95e9332865d4ef (patch)
treeecdcd012fb094ffd4a6bc30c2336cc176aa02946
parent9d10506c1149079cea6be266014fc4af6d0850d2 (diff)
downloadmce-test-6fffcb2d14bec37b745659f4ee95e9332865d4ef.tar.gz
Fix unsuitable avoid checking of write/read_hugepage().
The addr of write/read_hugepage() is the mapping address of file. So no matter how many hugepages are mapped, addr will be the head address of all hugepages. The avoid of write/read_hugepage() is the address which does not want to be touched. So it could be the head address of any hugepage. So addr == avoid in write/read_hugepage() is not equal always except the avoid is the address of the first hugepage. This patch fixed it. Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com> Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r--tsrc/hugepage.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/tsrc/hugepage.h b/tsrc/hugepage.h
index d44e5ac..cc26281 100644
--- a/tsrc/hugepage.h
+++ b/tsrc/hugepage.h
@@ -17,7 +17,7 @@ void write_hugepage(char *addr, int size, char *avoid)
{
int i, j;
for (i = 0; i < size; i++) {
- if (addr == avoid)
+ if ((addr + i * HPS) == avoid)
continue;
for (j = 0; j < HPS; j++) {
*(addr + i * HPS + j) = (char)('a' + ((i + j) % 26));
@@ -32,7 +32,7 @@ int read_hugepage(char *addr, int size, char *avoid)
int ret = 0;
for (i = 0; i < size; i++) {
- if (addr == avoid)
+ if ((addr + i * HPS) == avoid)
continue;
for (j = 0; j < HPS; j++) {
if (*(addr + i * HPS + j) != (char)('a' + ((i + j) % 26))) {