[PATCH] proc: don't lock task_structs indefinitely
Eric W. Biederman authored

Every inode in /proc holds a reference to a struct task_struct.  If a
directory or file is opened and remains open after the the task exits this
pinning continues.  With 8K stacks on a 32bit machine the amount pinned per
file descriptor is about 10K.

Normally I would figure a reasonable per user process limit is about 100
processes.  With 80 processes, with a 1000 file descriptors each I can trigger
the 00M killer on a 32bit kernel, because I have pinned about 800MB of useless
data.

This patch replaces the struct task_struct pointer with a pointer to a struct
task_ref which has a struct task_struct pointer.  The so the pinning of dead
tasks does not happen.

The code now has to contend with the fact that the task may now exit at any
time.  Which is a little but not muh more complicated.

With this change it takes about 1000 processes each opening up 1000 file
descriptors before I can trigger the OOM killer.  Much better.

[mlp@google.com: task_mmu small fixes]
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Paul Jackson <pj@sgi.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Albert Cahalan <acahalan@gmail.com>
Signed-off-by: default avatarPrasanna Meda <mlp@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
99f89551
Name Last commit Last update
..
9p Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
adfs [PATCH] VFS: Permit filesystem to perform statfs with a known root dentry
affs [PATCH] fix %s in affs_fill_super()
afs [PATCH] fs: use list_move()
autofs [PATCH] VFS: Permit filesystem to override root dentry on mount
autofs4 [PATCH] fs: use list_move()
befs [PATCH] VFS: Permit filesystem to perform statfs with a known root dentry
bfs [PATCH] VFS: Permit filesystem to perform statfs with a known root dentry
cifs Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
coda [PATCH] use list_add_tail() instead of list_add()
configfs [PATCH] fs: use list_move()
cramfs [PATCH] read_mapping_page for address space
debugfs Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
devfs [PATCH] VFS: Permit filesystem to override root dentry on mount
devpts [PATCH] VFS: Permit filesystem to override root dentry on mount
efs [PATCH] VFS: Permit filesystem to perform statfs with a known root dentry
exportfs [PATCH] NFS server subtree_check returns dubious value
ext2 [PATCH] ext2: cleanup: put_page and comment fix
ext3 [PATCH] ext3: Add "-o bh" option
fat [PATCH] fs/fat/misc.c: unexport fat_sync_bhs
freevxfs [PATCH] fs/freevxfs: cleanup of spelling errors
fuse Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
hfs [PATCH] read_mapping_page for address space
hfsplus [PATCH] read_mapping_page for address space
hostfs [PATCH] VFS: Permit filesystem to perform statfs with a known root dentry
hpfs
hppfs
hugetlbfs
isofs
jbd
jffs
jffs2
jfs
lockd
minix
msdos
ncpfs
nfs
nfs_common
nfsd
nls
ntfs
ocfs2
openpromfs
partitions
proc
qnx4
ramfs
reiserfs
romfs
smbfs
sysfs
sysv
udf
ufs
vfat
xfs
Kconfig
Kconfig.binfmt
Makefile
aio.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio.c
block_dev.c
buffer.c
char_dev.c
compat.c
compat_ioctl.c
dcache.c
dcookies.c
direct-io.c
dnotify.c
dquot.c
drop_caches.c
eventpoll.c
exec.c
fcntl.c
fifo.c
file.c
file_table.c
filesystems.c
fs-writeback.c
inode.c
inotify.c
inotify_user.c
ioctl.c
ioprio.c
libfs.c
locks.c
mbcache.c
mpage.c
namei.c
namespace.c
nfsctl.c
open.c
pipe.c
pnode.c
pnode.h
posix_acl.c
quota.c
quota_v1.c
quota_v2.c
read_write.c
readdir.c
select.c
seq_file.c
splice.c
stat.c
super.c
sync.c
xattr.c
xattr_acl.c