kernel-ark/drivers/char
Nick Piggin 557ed1fa26 remove ZERO_PAGE
The commit b5810039a5 contains the note

  A last caveat: the ZERO_PAGE is now refcounted and managed with rmap
  (and thus mapcounted and count towards shared rss).  These writes to
  the struct page could cause excessive cacheline bouncing on big
  systems.  There are a number of ways this could be addressed if it is
  an issue.

And indeed this cacheline bouncing has shown up on large SGI systems.
There was a situation where an Altix system was essentially livelocked
tearing down ZERO_PAGE pagetables when an HPC app aborted during startup.
This situation can be avoided in userspace, but it does highlight the
potential scalability problem with refcounting ZERO_PAGE, and corner
cases where it can really hurt (we don't want the system to livelock!).

There are several broad ways to fix this problem:
1. add back some special casing to avoid refcounting ZERO_PAGE
2. per-node or per-cpu ZERO_PAGES
3. remove the ZERO_PAGE completely

I will argue for 3. The others should also fix the problem, but they
result in more complex code than does 3, with little or no real benefit
that I can see.

Why? Inserting a ZERO_PAGE for anonymous read faults appears to be a
false optimisation: if an application is performance critical, it would
not be doing many read faults of new memory, or at least it could be
expected to write to that memory soon afterwards. If cache or memory use
is critical, it should not be working with a significant number of
ZERO_PAGEs anyway (a more compact representation of zeroes should be
used).

As a sanity check -- mesuring on my desktop system, there are never many
mappings to the ZERO_PAGE (eg. 2 or 3), thus memory usage here should not
increase much without it.

When running a make -j4 kernel compile on my dual core system, there are
about 1,000 mappings to the ZERO_PAGE created per second, but about 1,000
ZERO_PAGE COW faults per second (less than 1 ZERO_PAGE mapping per second
is torn down without being COWed). So removing ZERO_PAGE will save 1,000
page faults per second when running kbuild, while keeping it only saves
less than 1 page clearing operation per second. 1 page clear is cheaper
than a thousand faults, presumably, so there isn't an obvious loss.

Neither the logical argument nor these basic tests give a guarantee of no
regressions. However, this is a reasonable opportunity to try to remove
the ZERO_PAGE from the pagefault path. If it is found to cause regressions,
we can reintroduce it and just avoid refcounting it.

The /dev/zero ZERO_PAGE usage and TLB tricks also get nuked.  I don't see
much use to them except on benchmarks.  All other users of ZERO_PAGE are
converted just to use ZERO_PAGE(0) for simplicity. We can look at
replacing them all and maybe ripping out ZERO_PAGE completely when we are
more satisfied with this solution.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus "snif" Torvalds <torvalds@linux-foundation.org>
2007-10-16 09:42:53 -07:00
..
agp fix use after free in amd create gatt pages 2007-10-15 10:32:15 +10:00
drm via invalid device ids removal 2007-10-15 11:09:35 +10:00
hw_random
ip2 Convert from class_device to device in drivers/char 2007-10-12 14:51:04 -07:00
ipmi signedness: module_param_array nump argument 2007-10-14 12:41:52 -07:00
mwave
pcmcia Convert from class_device to device in drivers/char 2007-10-12 14:51:04 -07:00
rio long vs. unsigned long - low-hanging fruits in drivers 2007-10-14 12:41:51 -07:00
tpm tpmdd maintainers 2007-08-22 19:52:44 -07:00
watchdog mpc5200_wdt: __user annotations 2007-10-14 12:41:51 -07:00
.gitignore
amiserial.c
apm-emulation.c
applicom.c
applicom.h
briq_panel.c
cd1865.h
ChangeLog
consolemap.c
cp437.uni
cs5535_gpio.c
cyclades.c
defkeymap.c_shipped
defkeymap.map
digi1.h
digiFep1.h
digiPCI.h
ds1286.c
ds1302.c
ds1620.c
dsp56k.c long vs. unsigned long - low-hanging fruits in drivers 2007-10-14 12:41:51 -07:00
dtlk.c
efirtc.c
epca.c
epca.h
epcaconfig.h
esp.c
generic_nvram.c
generic_serial.c
genrtc.c
hangcheck-timer.c
hpet.c Silent drivers/char/hpet.c build warnings on i386 2007-09-26 09:22:04 -07:00
hvc_beat.c [POWERPC] Init markings for hvc_beat 2007-08-17 11:01:50 +10:00
hvc_console.c
hvc_console.h
hvc_iseries.c
hvc_lguest.c lguest files should explicitly include asm/paravirt.h 2007-08-11 15:47:42 -07:00
hvc_rtas.c
hvc_vio.c
hvc_xen.c
hvcs.c
hvsi.c
i8k.c drivers/firmware: const-ify DMI API and internals 2007-10-09 20:22:20 -04:00
ip27-rtc.c
isicom.c
istallion.c Convert from class_device to device in drivers/char 2007-10-12 14:51:04 -07:00
Kconfig Char: cyclades, select FW_LOADER 2007-07-26 11:35:19 -07:00
keyboard.c m68k/mac: Make mac_hid_mouse_emulate_buttons() declaration visible 2007-08-22 19:52:45 -07:00
lcd.c [MIPS] Delete duplicate inclusion of <linux/delay.h>. 2007-08-27 02:16:59 +01:00
lcd.h
lp.c Convert from class_device to device in drivers/char 2007-10-12 14:51:04 -07:00
Makefile Correct Makefile rule for generating custom keymap 2007-10-08 16:06:51 -07:00
mbcs.c
mbcs.h
mem.c remove ZERO_PAGE 2007-10-16 09:42:53 -07:00
misc.c
mmtimer.c Remove fs.h from mm.h 2007-07-29 17:09:29 -07:00
moxa.c
mspec.c fix "mspec: handle shrinking virtual memory areas" 2007-09-25 08:51:04 -07:00
mxser_new.c
mxser_new.h
mxser.c
mxser.h
n_hdlc.c
n_r3964.c
n_tty.c
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
ppdev.c
ps3flash.c
pty.c PTY: add kernel parameter to overwrite legacy pty count 2007-10-12 14:51:09 -07:00
random.c [TCP]: secure_tcp_sequence_number() should not use a too fast clock 2007-10-01 21:01:24 -07:00
raw.c cdev: remove unneeded setting of cdev names 2007-10-12 14:51:02 -07:00
riscom8_reg.h
riscom8.c
riscom8.h long vs. unsigned long - low-hanging fruits in drivers 2007-10-14 12:41:51 -07:00
rocket_int.h
rocket.c
rocket.h
rtc.c
scc.h
scx200_gpio.c
selection.c
ser_a2232.c
ser_a2232.h
ser_a2232fw.ax
ser_a2232fw.h
serial167.c
snsc_event.c
snsc.c Convert from class_device to device in drivers/char 2007-10-12 14:51:04 -07:00
snsc.h
sonypi.c ACPI: Schedule /proc/acpi/event for removal 2007-08-23 15:20:26 -04:00
specialix_io8.h
specialix.c
stallion.c Convert from class_device to device in drivers/char 2007-10-12 14:51:04 -07:00
sx.c
sx.h long vs. unsigned long - low-hanging fruits in drivers 2007-10-14 12:41:51 -07:00
sxboards.h
sxwindow.h
synclink_gt.c synclink_gt endianness annotations 2007-10-14 12:41:51 -07:00
synclink.c
synclinkmp.c
sysrq.c
tb0219.c
tipar.c Convert from class_device to device in drivers/char 2007-10-12 14:51:04 -07:00
tlclk.c
toshiba.c
tty_audit.c
tty_io.c tty: dont needlessly cast kmalloc() return value 2007-08-23 21:39:41 -07:00
tty_ioctl.c sparc64 (and others): fix tty_ioctl.c build 2007-09-15 08:18:30 -07:00
vc_screen.c
viocons.c
viotape.c Convert from class_device to device in drivers/char 2007-10-12 14:51:04 -07:00
vme_scc.c
vr41xx_giu.c
vt_ioctl.c VT_WAITACTIVE: Avoid returning EINTR when not necessary 2007-10-07 16:02:55 -07:00
vt.c