were allocated for a file. The content of the file is ini-
tialized by creating a linked list of its blocks; thus, all
of the file’s blocks need to be allocated when created.
The allocation for main memory is done by simply
taking blocks out of the linked list.
The advantages of the indirect method are con-
trary to the direct method. The indirect method does
not depend on the implementation of a file system.
The provision of the XIP feature of a file system re-
quires the implementation of get_xip_mem() inter-
face. The interface converts a file offset to its block
address. By using this interface, the initialization of
a file used for main memory can be done indepen-
dently from the internal implementation of a file sys-
tem. The linked list of the free blocks also makes the
allocation cost independent from the internal imple-
mentation. Moreover, since the blocks used for main
memory are allocated for a file, they do not cause the
inconsistency of a file system when a system crashes.
The disadvantage is that the blocks of a file used for
main memory are preallocated; thus, their use is fixed
for main memory. It is desirable to adjust the size of
the preallocated file. While it is easy to extend the
file size as more blocks need to be allocated for main
memory, more work is necessary to shrink it.
4 EXPERIMENT RESULTS
This section first describes the evaluation method and
then shows the experiment result that measures the
allocation costs of main memory from file systems.
4.1 Evaluation Method
We employ the QEMU system emulator to construct
the target system described in Section 3.1. The ver-
sion of QEMU used for the evaluation is 1.0.1, and
QEMU emulates x86 64. QEMU was modified to
emulate NV memory that persists its contents across
the termination and rebooting of the emulator. A file
is used for the persistence of the NV memory. The
file is mapped into the physical address space emu-
lated by QEMU. The experiments described in this
section were performed on QEMU invoked with the
following options:
% qemu -m 128 -nvmemory \
file=nvmemory.img,physaddr=0x100000000
With the above options, QEMU is invoked with
128MB DRAM along with the NV memory mapped
from 0x100000000 of the physical address. The size
of the file emulating NV memory (nvmemory.img) is
4GB. While the size of DRAM is passed to the Linux
kernel through BIOS, the information of NV memory
is not passed in order to make their management sep-
arate.
The modified QEMU executes the Linux kernel
that includes the modifications of the proposed meth-
ods. The version of the Linux kernel modified and
used for the experiments is 3.4.
The evaluation of execution costs needs to mea-
sure execution times. Times counted by the interrupts
from a timer device are not accurate enough on sys-
tem emulators. Instead, the number of instructions
executed is used as the measure of execution costs.
The -icount 0 option of QEMU lets the TSC (time
stamp counter) register count the number of instruc-
tions executed. The RDTSC instruction reads the
value of TSC.
As described in Section 1, the following evalua-
tion results do not take into account the difference of
access latencies and treat DRAM and NV memory the
same.
4.2 Page Allocation Costs
This section shows the measurement results of the al-
location costs of main memory from file systems and
compares them with those that use the page swapping
mechanism. Integrating the main memory and file
system management on NV memory brings a large
amount of physical memory to processes; thus, such
integration should be able to remove the necessity of
the paging swapping and to improve the performance
to allocate a large amount of memory. In order to ver-
ify the effectiveness of the integration, we executed
a program that allocates a memory region by using
malloc() and performs writes to the beginning of the
page boundaries for the actual allocation of physical
memory pages.
The measurements were performed for several
cases, and Figure 3 shows the results. The figure com-
pares the eight cases. DRAM (w/o swap) and DRAM
(w/ swap) show the costs when only DRAM is used
as main memory without and with a swap device, re-
spectively. In these cases, a swap device for DRAM
is a ramdisk created on NV memory. PRAMFS NV
mem (direct) and PRAMFS NV mem (indirect) show
the costs when PRAMFS is constructed on NV mem-
ory and the direct and indirect methods are used for
main memory allocation from the file system, respec-
tively. PRAMFS swap file shows the cost when only
DRAM is used as main memory and a swap file cre-
ated on PRAMFS is used as a swap device. In the
cases of Ext2 NV mem (direct), Ext2 NV mem (indi-
rect), and Ext2 swap file, Ext2 was constructed on NV
memory.
UsingFileSystemsforNon-volatileMainMemoryManagement
211