android_kernel_samsung_univ.../Documentation
Davide Libenzi 7ef9964e6d epoll: introduce resource usage limits
It has been thought that the per-user file descriptors limit would also
limit the resources that a normal user can request via the epoll
interface.  Vegard Nossum reported a very simple program (a modified
version attached) that can make a normal user to request a pretty large
amount of kernel memory, well within the its maximum number of fds.  To
solve such problem, default limits are now imposed, and /proc based
configuration has been introduced.  A new directory has been created,
named /proc/sys/fs/epoll/ and inside there, there are two configuration
points:

  max_user_instances = Maximum number of devices - per user

  max_user_watches   = Maximum number of "watched" fds - per user

The current default for "max_user_watches" limits the memory used by epoll
to store "watches", to 1/32 of the amount of the low RAM.  As example, a
256MB 32bit machine, will have "max_user_watches" set to roughly 90000.
That should be enough to not break existing heavy epoll users.  The
default value for "max_user_instances" is set to 128, that should be
enough too.

This also changes the userspace, because a new error code can now come out
from EPOLL_CTL_ADD (-ENOSPC).  The EMFILE from epoll_create() was already
listed, so that should be ok.

[akpm@linux-foundation.org: use get_current_user()]
Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: <stable@kernel.org>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Reported-by: Vegard Nossum <vegardno@ifi.uio.no>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-12-01 19:55:24 -08:00
..
ABI Add c2 port support 2008-11-12 17:17:18 -08:00
accounting
acpi ACPI: update debug parameter documentation 2008-11-07 21:45:29 -05:00
aoe
arm
auxdisplay
blackfin
block
blockdev Create/use more directory structure in the Documentation/ tree. 2008-11-14 17:28:53 +00:00
cdrom
cgroups freezer_cg: disable writing freezer.state of root cgroup 2008-11-12 17:17:16 -08:00
connector
console
controllers
cpu-freq [CPUFREQ] Documentation: Add Blackfin to list of supported processors 2008-11-25 13:38:29 -05:00
cpuidle
cris
crypto
development-process
device-mapper
DocBook
driver-model
dvb
early-userspace
fault-injection
fb
filesystems epoll: introduce resource usage limits 2008-12-01 19:55:24 -08:00
firmware_class
frv
hwmon adt7462: new hwmon driver 2008-11-12 17:17:17 -08:00
i2c
i2o
ia64
ide
infiniband
input Input: fix the example of an input device driver 2008-11-11 11:41:49 -05:00
ioctl Create/use more directory structure in the Documentation/ tree. 2008-11-14 17:28:53 +00:00
isdn
ja_JP
kbuild
kdump
ko_KR
laptops
lguest
m68k
make
mips
mn10300
mtd
namespaces
netlabel
networking phylib: fix phy name example in documentation 2008-11-19 15:38:24 -08:00
parisc
PCI Create/use more directory structure in the Documentation/ tree. 2008-11-14 17:28:53 +00:00
pcmcia
power
powerpc powerpc: Repair device bindings documentation 2008-11-10 15:17:52 -06:00
prctl
RCU
s390
scheduler
scsi
serial Create/use more directory structure in the Documentation/ tree. 2008-11-14 17:28:53 +00:00
sh
sound Merge branch 'topic/fix/hda' into for-linus 2008-11-25 17:21:32 +01:00
sparc
spi spi documentation: use __initdata on struct 2008-12-01 19:55:24 -08:00
sysctl
telephony
thermal
timers
tracers tracing, doc: update mmiotrace documentation 2008-11-23 20:33:24 +01:00
uml
usb
video4linux V4L/DVB (9482): Documentation, especially regarding audio and informational links 2008-11-11 08:11:24 -02:00
vm
w1 hdq: documentation for OMAP HDQ 2008-11-12 17:17:18 -08:00
watchdog
x86
zh_CN
00-INDEX Merge branch 'doc-subdirs' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap/linux-docs 2008-11-15 11:51:03 -08:00
applying-patches.txt
atomic_ops.txt
basic_profiling.txt
binfmt_misc.txt
braille-console.txt
bt8xxgpio.txt
BUG-HUNTING
c2port.txt Add c2 port support 2008-11-12 17:17:18 -08:00
cachetlb.txt
Changes
CodingStyle
cpu-hotplug.txt
cpu-load.txt
cpusets.txt
cputopology.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
devices.txt
DMA-API.txt
DMA-attributes.txt
DMA-ISA-LPC.txt
DMA-mapping.txt
dontdiff
edac.txt
eisa.txt
email-clients.txt
exception.txt
feature-removal-schedule.txt V4L/DVB (9337b): remove tuner-3036 and dpc7146 drivers from feature-removal-schedule.txt 2008-11-11 08:09:44 -02:00
ftrace.txt
gpio.txt
highuid.txt
HOWTO
hw_random.txt
ics932s401 ics932s401: new clock generator chip driver 2008-11-12 17:17:18 -08:00
initrd.txt
Intel-IOMMU.txt
io_ordering.txt
io-mapping.txt
IO-mapping.txt
iostats.txt
IPMI.txt
IRQ-affinity.txt
IRQ.txt
irqflags-tracing.txt
isapnp.txt
java.txt
kernel-doc-nano-HOWTO.txt
kernel-docs.txt
kernel-parameters.txt Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2008-11-19 18:51:56 -08:00
keys-request-key.txt
keys.txt
kobject.txt
kprobes.txt
kref.txt
ldm.txt
leds-class.txt
local_ops.txt
lockdep-design.txt
lockstat.txt
logo.gif
logo.txt
magic-number.txt
Makefile
ManagementStyle
markers.txt
mca.txt
md.txt
memory-barriers.txt
memory-hotplug.txt
memory.txt
mono.txt
mutex-design.txt
nmi_watchdog.txt
nommu-mmap.txt
numastat.txt
oops-tracing.txt
parport-lowlevel.txt
parport.txt
pi-futex.txt
pnp.txt
preempt-locking.txt
printk-formats.txt DOC: add printk-formats.txt 2008-11-12 17:17:17 -08:00
prio_tree.txt
rbtree.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rt-mutex-design.txt
rt-mutex.txt
rtc.txt
SAK.txt
SecurityBugs
SELinux.txt
serial-console.txt
sgi-ioc4.txt
sgi-visws.txt
SM501.txt
Smack.txt
sparse.txt
spinlocks.txt
stable_api_nonsense.txt
stable_kernel_rules.txt
SubmitChecklist
SubmittingDrivers
SubmittingPatches
svga.txt
sysfs-rules.txt
sysrq.txt
tracepoints.txt
unaligned-memory-access.txt
unicode.txt
unshare.txt
VGA-softcursor.txt
video-output.txt
volatile-considered-harmful.txt
voyager.txt
zorro.txt