Recent changes (master)

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

 



The following changes since commit 99db656470de6175c85d21f55aaf0a30337aa011:

  fusion-aw: make configure and compile actually work (2013-01-14 19:33:40 +0100)

are available in the git repository at:
  git://git.kernel.dk/fio.git master

Shaohua Li (1):
      Make hugetlbfs maping work

 memory.c  |   15 +++++++++++----
 options.c |    7 +------
 2 files changed, 12 insertions(+), 10 deletions(-)

---

Diff of recent changes:

diff --git a/memory.c b/memory.c
index 4a9dc4a..3759c8c 100644
--- a/memory.c
+++ b/memory.c
@@ -119,14 +119,16 @@ static void free_mem_shm(struct thread_data *td)
 
 static int alloc_mem_mmap(struct thread_data *td, size_t total_mem)
 {
-	int flags = MAP_PRIVATE;
+	int flags = 0;
 
 	td->mmapfd = 1;
 
 	if (td->o.mem_type == MEM_MMAPHUGE) {
 		unsigned long mask = td->o.hugepage_size - 1;
 
-		flags |= MAP_HUGETLB;
+		/* TODO: make sure the file is a real hugetlbfs file */
+		if (!td->mmapfile)
+			flags |= MAP_HUGETLB;
 		total_mem = (total_mem + mask) & ~mask;
 	}
 
@@ -138,13 +140,18 @@ static int alloc_mem_mmap(struct thread_data *td, size_t total_mem)
 			td->orig_buffer = NULL;
 			return 1;
 		}
-		if (ftruncate(td->mmapfd, total_mem) < 0) {
+		if (td->o.mem_type != MEM_MMAPHUGE &&
+		    ftruncate(td->mmapfd, total_mem) < 0) {
 			td_verror(td, errno, "truncate mmap file");
 			td->orig_buffer = NULL;
 			return 1;
 		}
+		if (td->o.mem_type == MEM_MMAPHUGE)
+			flags |= MAP_SHARED;
+		else
+			flags |= MAP_PRIVATE;
 	} else
-		flags |= OS_MAP_ANON;
+		flags |= OS_MAP_ANON | MAP_PRIVATE;
 
 	td->orig_buffer = mmap(NULL, total_mem, PROT_READ | PROT_WRITE, flags,
 				td->mmapfd, 0);
diff --git a/options.c b/options.c
index 1760762..8d460be 100644
--- a/options.c
+++ b/options.c
@@ -342,13 +342,8 @@ static int str_mem_cb(void *data, const char *mem)
 {
 	struct thread_data *td = data;
 
-	if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
+	if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
 		td->mmapfile = get_opt_postfix(mem);
-		if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
-			log_err("fio: mmaphuge:/path/to/file\n");
-			return 1;
-		}
-	}
 
 	return 0;
 }
--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux