kernel_optimize_test/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 Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
00-INDEX Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
adfs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
affs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
afs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
automount-support.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
befs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bfs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cifs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
coda.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cramfs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
directory-locking Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Exporting Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ext2.txt [PATCH] xip: description 2005-06-24 00:06:42 -07:00
ext3.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hfs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hpfs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
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 Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Locking [PATCH] doc: Locking update 2005-05-01 08:58:37 -07:00
ncpfs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ntfs.txt NTFS: Fix a nasty deadlock that appeared in recent kernels. 2005-06-26 22:12:02 +01:00
porting Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
proc.txt [PATCH] add /proc/pid/smaps 2005-09-05 00:05:49 -07:00
romfs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
smbfs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
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 Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tmpfs.txt [PATCH] shmem: restore superblock info 2005-06-21 18:46:18 -07:00
udf.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ufs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vfat.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vfs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xfs.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xip.txt [PATCH] xip: description 2005-06-24 00:06:42 -07:00