The memory file-based system which is available as a configurable
product in HP-UX 11i v3 is more advanced when compared to the MemFS
on HP-UX 11iv2. A file system has the concept of disk layout, which
refers to how information such as the superblock, inodes and the data
blocks are organized on the disk. HP-UX 11iv3 MemFS has its own new
layout, which stores file data in the UFC (Unified File Cache) and
metadata in the kernel memory. It does not use the user process address
space as backing store for the files data, during memory pressure.
It has all the features needed for a basic file system. Some of the
more advanced file system features (e.g. journaling, un-buffered I/O)
that some of the contemporary file systems provide are neither required
nor relevant in the context of a memory file system.
A MemFS is created from a mount (1M) command. The mount operation
just creates the necessary data structures which are part of the new
layout. It neither pre-allocates the inodes or any memory as the backing
store for the file data. The following data structures are created
as part of the mount operation:
Directory entry hash table
The root directory of the mount instance
Subsequent to a mount, the MemFS can be used just like any other
file system, with the same commands and system calls, as used on other
file systems. From an application or user perspective there should
be nothing that differentiates it from any other file system, except
a better response time.
Internally, MemFS behaves differently from other file systems.
Its directory entries are organized in the Directory entry hash table,
for faster lookup. The syncer (1M)1 daemon, which periodically flushes
"dirty" file system pages to disk, does not have an effect on MemFS
pages, as MemFS pages are never added to the syncer dirty list - which
is processed periodically for flushing. The metadata of each MemFS
instance is allocated from the kernel memory which can not be swapped.
MemFS files data is store in UFC. The MemFS pages in UFC are not treated
specially from the pages of other file systems. Periodically, the
VM paging algorithm reallocates the less used pages including the
MemFS pages from the UFC. When VM paging algorithm decides to reallocate
MemFS pages during memory pressure, the MemFS files data will be written
directly to system swap device. When ever the files data is needed,
the data will be brought back to UFC directly from the system swap.
Though HP-UX 11iv3 does not support pageable kernel memory, MemFS
and UFC interact with each other to accomplish the above tasks. Thus
the HP-UX 11iv3 MemFS does not require the instance specific user
process address space for swapping the files data. The overview of
MemFS architecture is depicted in the figure shown below (see figure1).
A umount (1M) on the MemFS removes the file system and all its
data. As per the specifications, data cannot be recovered once a umount
(1M) happens.
MemFS uses two main resources: kernel memory and system swap
space. These resources are shared among all the kernel subsystems
and user applications. Thus there is a need to wisely use these shared
resources. MemFS provides the following tunables to limit the usage
exclusively by MemFS:
memfs_metamax
Tunable to limit the amount
of kernel memory used by MemFS
memfs_swapmax
Tunable to limit the amount
of swap space used by MemFS
For more details on these tunables, see Chapter 2: “Installing, Configuring, Tuning, and Removing HP-UX Memory
File System”.