Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 10: Filesystems without Persistent Storage


However, this value can be modified by issuing the following command (as root user):

wolfgang@meitner>echo "80" > /proc/sys/vm/swappiness
wolfgang@meitner>cat /proc/sys/vm/swappiness
80

As discussed in Chapter 18, the higher the swappinessvalue the more aggressively will the kernel swap
out pages; this can lead to better performance at certain system load levels.

Section 10.1.8 describes in detail the implementation used by the kernel to manipulate parameters in the
procfilesystem.

10.1.2 Data Structures


Once again there are a number of central data structures around which the code used to implement
the process data filesystem is built. These include the structures of the virtual filesystem discussed in
Chapter 8.procmakes generous use of these, simply because, as a filesystem itself, it must be integrated
into the VFS layer of the kernel.

There are alsoproc-specific data structures to organize the data provided in the kernel. An interface to the
subsystems of the kernel must also be made available to enable the kernel to extract required information
from its structures before it is supplied to userspace by means of/proc.

RepresentationofprocEntries


Each entry in theprocfilesystem is described by an instance ofproc_dir_entrywhose (abbreviated)
definition is as follows:

<proc_fs.h>
struct proc_dir_entry {
unsigned int low_ino;
unsigned short namelen;
const char *name;
mode_t mode;
nlink_t nlink;
uid_t uid;
gid_t gid;
loff_t size;
struct inode_operations * proc_iops;
const struct file_operations * proc_fops;
get_info_t *get_info;
struct module *owner;
struct proc_dir_entry *next, *parent, *subdir;
void *data;
read_proc_t *read_proc;
write_proc_t *write_proc;
...
};

Because each entry is given a filename, the kernel uses two elements of the structure to store the corre-
sponding information:nameis a pointer to the string in which the name is held, andnamelenspecifies
Free download pdf