kernel-fxtec-pro1x/Documentation/filesystems
Mauricio Lin e070ad49f3 [PATCH] add /proc/pid/smaps
Add a "smaps" entry to /proc/pid: show howmuch memory is resident in each
mapping.

People that want to perform a memory consumption analysing can use it
mainly if someone needs to figure out which libraries can be reduced for
embedded systems.  So the new features are the physical size of shared and
clean [or dirty]; private and clean [or dirty].

Take a look the example below:

# cat /proc/4576/smaps

08048000-080dc000 r-xp /bin/bash
Size:               592 KB
Rss:                500 KB
Shared_Clean:       500 KB
Shared_Dirty:         0 KB
Private_Clean:        0 KB
Private_Dirty:        0 KB
080dc000-080e2000 rw-p /bin/bash
Size:                24 KB
Rss:                 24 KB
Shared_Clean:         0 KB
Shared_Dirty:         0 KB
Private_Clean:        0 KB
Private_Dirty:       24 KB
080e2000-08116000 rw-p
Size:               208 KB
Rss:                208 KB
Shared_Clean:         0 KB
Shared_Dirty:         0 KB
Private_Clean:        0 KB
Private_Dirty:      208 KB
b7e2b000-b7e34000 r-xp /lib/tls/libnss_files-2.3.2.so
Size:                36 KB
Rss:                 12 KB
Shared_Clean:        12 KB
Shared_Dirty:         0 KB
Private_Clean:        0 KB
Private_Dirty:        0 KB
...

(Includes a cleanup from "Richard Purdie" <rpurdie@rpsys.net>)

From: Torsten Foertsch <torsten.foertsch@gmx.net>

show_smap calls first show_map and then prints its additional information to
the seq_file.  show_map checks if all it has to print fits into the buffer and
if yes marks the current vma as written.  While that is correct for show_map
it is not for show_smap.  Here the vma should be marked as written only after
the additional information is also written.

The attached patch cures the problem.  It moves the functionality of the
show_map function to a new function show_map_internal that is called with an
additional struct mem_size_stats* argument.  Then show_map calls
show_map_internal with NULL as struct mem_size_stats* whereas show_smap calls
it with a real pointer.  Now the final

	if (m->count < m->size)  /* vma is copied successfully */
		m->version = (vma != get_gate_vma(task))? vma->vm_start: 0;

is done only if the whole entry fits into the buffer.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-05 00:05:49 -07:00
..
devfs
00-INDEX
adfs.txt
affs.txt
afs.txt
automount-support.txt
befs.txt
bfs.txt
cifs.txt
coda.txt
cramfs.txt
directory-locking
Exporting
ext2.txt [PATCH] xip: description 2005-06-24 00:06:42 -07:00
ext3.txt
hfs.txt
hpfs.txt
inotify.txt [PATCH] inotify: documentation update 2005-07-15 09:54:51 -07:00
isofs.txt [PATCH] isofs: show hidden files, add granularity for assoc/hidden files flags 2005-06-21 19:07:38 -07:00
jfs.txt
Locking
ncpfs.txt
ntfs.txt NTFS: Fix a nasty deadlock that appeared in recent kernels. 2005-06-26 22:12:02 +01:00
porting
proc.txt [PATCH] add /proc/pid/smaps 2005-09-05 00:05:49 -07:00
romfs.txt
smbfs.txt
sysfs-pci.txt [PATCH] Driver Core: remove driver model detach_state 2005-05-17 14:54:55 -07:00
sysfs.txt [PATCH] Driver core: Documentation: update device attribute callbacks 2005-06-20 15:15:32 -07:00
sysv-fs.txt
tmpfs.txt [PATCH] shmem: restore superblock info 2005-06-21 18:46:18 -07:00
udf.txt
ufs.txt
vfat.txt
vfs.txt
xfs.txt
xip.txt [PATCH] xip: description 2005-06-24 00:06:42 -07:00