linux/include/asm-arm
Badari Pulavarty f6b3ec238d [PATCH] madvise(MADV_REMOVE): remove pages from tmpfs shm backing store
Here is the patch to implement madvise(MADV_REMOVE) - which frees up a
given range of pages & its associated backing store.  Current
implementation supports only shmfs/tmpfs and other filesystems return
-ENOSYS.

"Some app allocates large tmpfs files, then when some task quits and some
client disconnect, some memory can be released.  However the only way to
release tmpfs-swap is to MADV_REMOVE". - Andrea Arcangeli

Databases want to use this feature to drop a section of their bufferpool
(shared memory segments) - without writing back to disk/swap space.

This feature is also useful for supporting hot-plug memory on UML.

Concerns raised by Andrew Morton:

- "We have no plan for holepunching!  If we _do_ have such a plan (or
  might in the future) then what would the API look like?  I think
  sys_holepunch(fd, start, len), so we should start out with that."

- Using madvise is very weird, because people will ask "why do I need to
  mmap my file before I can stick a hole in it?"

- None of the other madvise operations call into the filesystem in this
  manner.  A broad question is: is this capability an MM operation or a
  filesytem operation?  truncate, for example, is a filesystem operation
  which sometimes has MM side-effects.  madvise is an mm operation and with
  this patch, it gains FS side-effects, only they're really, really
  significant ones."

Comments:

- Andrea suggested the fs operation too but then it's more efficient to
  have it as a mm operation with fs side effects, because they don't
  immediatly know fd and physical offset of the range.  It's possible to
  fixup in userland and to use the fs operation but it's more expensive,
  the vmas are already in the kernel and we can use them.

Short term plan &  Future Direction:

- We seem to need this interface only for shmfs/tmpfs files in the short
  term.  We have to add hooks into the filesystem for correctness and
  completeness.  This is what this patch does.

- In the future, plan is to support both fs and mmap apis also.  This
  also involves (other) filesystem specific functions to be implemented.

- Current patch doesn't support VM_NONLINEAR - which can be addressed in
  the future.

Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Andrea Arcangeli <andrea@suse.de>
Cc: Michael Kerrisk <mtk-manpages@gmx.net>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:22 -08:00
..
arch-aaec2000 [ARM] 3060/1: allow constants found in asm/memory.h to be used in asm code 2005-10-29 21:44:55 +01:00
arch-cl7500 [ARM] 3060/1: allow constants found in asm/memory.h to be used in asm code 2005-10-29 21:44:55 +01:00
arch-clps711x [ARM] Include asm/hardware.h instead of asm/arch/hardware.h 2005-11-16 14:51:20 +00:00
arch-ebsa110 [ARM] ebsa110: __arch_ioremap should be 3 args 2005-11-21 15:26:52 +00:00
arch-ebsa285 [ARM] 3060/1: allow constants found in asm/memory.h to be used in asm code 2005-10-29 21:44:55 +01:00
arch-epxa10db [ARM] Include asm/hardware.h instead of asm/arch/hardware.h 2005-11-16 14:51:20 +00:00
arch-h720x [ARM] Include asm/hardware.h instead of asm/arch/hardware.h 2005-11-16 14:51:20 +00:00
arch-imx [ARM] Include asm/hardware.h instead of asm/arch/hardware.h 2005-11-16 14:51:20 +00:00
arch-integrator [ARM] Include asm/hardware.h instead of asm/arch/hardware.h 2005-11-16 14:51:20 +00:00
arch-iop3xx [ARM] 3173/1: Fix to allow 2.6.15-rc2 to compile for IOP3xx boards 2005-11-23 22:45:27 +00:00
arch-ixp4xx [ARM] 3171/1: To add missing QMGR region size for IXP4XX 2005-11-21 15:17:07 +00:00
arch-ixp2000 [ARM] 3086/1: ixp2xxx error irq handling 2005-11-04 17:15:44 +00:00
arch-l7200 [ARM] Include asm/hardware.h instead of asm/arch/hardware.h 2005-11-16 14:51:20 +00:00
arch-lh7a40x [ARM] 3060/1: allow constants found in asm/memory.h to be used in asm code 2005-10-29 21:44:55 +01:00
arch-omap [ARM] Include asm/hardware.h instead of asm/arch/hardware.h 2005-11-16 14:51:20 +00:00
arch-pxa [PATCH] USB: pxa27x OHCI - Separate platform code from main driver 2006-01-04 13:48:28 -08:00
arch-realview [ARM] Fix arch-realview/system.h to use __io_address() 2005-11-16 14:38:19 +00:00
arch-rpc [ARM] Include asm/hardware.h instead of asm/arch/hardware.h 2005-11-16 14:51:20 +00:00
arch-s3c2410 [ARM] 3178/1: S3C2400 - adds GPIO registers definitions to regs-gpio.h 2005-11-28 18:08:43 +00:00
arch-sa1100 [ARM] Remove asm/hardware.h include from SA1100 io.h 2005-11-25 15:33:12 +00:00
arch-shark [ARM] 3060/1: allow constants found in asm/memory.h to be used in asm code 2005-10-29 21:44:55 +01:00
arch-versatile [ARM] 3060/1: allow constants found in asm/memory.h to be used in asm code 2005-10-29 21:44:55 +01:00
hardware [SERIAL] Fix status reporting with PL011 serial driver 2005-11-19 11:10:35 +00:00
mach [ARM] 3057/1: Add memory control method to support OneNAND sync burst read 2005-11-09 15:15:10 +00:00
a.out.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
apm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
assembler.h [ARM] Clean up save_and_disable_irqs macro and allow use of ARMv6 CPSID 2005-11-09 15:04:22 +00:00
atomic.h [ARM] Use unsigned long not u32 in atomic_cmpxchg 2005-11-16 18:03:10 +00:00
auxvec.h [PATCH] auxiliary vector cleanups 2005-09-07 16:57:21 -07:00
bitops.h [FLS64]: generic version 2006-01-03 13:11:06 -08:00
bug.h [PATCH] qualifiers in return types - easy cases 2005-08-23 18:43:45 -07:00
bugs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
byteorder.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cache.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cacheflush.h [ARM] Fix ARMv6 VIPT cache >= 32K 2005-09-08 15:32:23 +01:00
checksum.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cpu-multi32.h [PATCH] qualifiers in return types - easy cases 2005-08-23 18:43:45 -07:00
cpu-single.h [PATCH] qualifiers in return types - easy cases 2005-08-23 18:43:45 -07:00
cpu.h [ARM SMP] Track CPU idle threads 2005-11-02 21:51:40 +00:00
cputime.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
current.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
delay.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
div64.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
dma-mapping.h [PATCH] gfp_t: dma-mapping (arm) 2005-10-28 08:16:47 -07:00
dma.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
domain.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ecard.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
elf.h [ARM] 3205/1: Handle new EABI relocations when loading kernel modules. 2005-12-14 22:04:22 +00:00
emergency-restart.h [PATCH] Add emergency_restart() 2005-07-26 14:35:41 -07:00
errno.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fcntl.h [PATCH] Clean up struct flock64 definitions 2005-09-07 16:57:38 -07:00
fiq.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
floppy.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
fpstate.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
futex.h [ARM] Fix warning in asm/futex.h 2005-09-18 21:11:08 +01:00
glue.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
hardirq.h [ARM SMP] Add core ARM support for local timers 2005-11-08 19:08:05 +00:00
hardware.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ide.h [PATCH] ARM: 2758/1: Fix comment in file header to read "ARM" instead i386 2005-06-27 15:58:39 +01:00
io.h [ARM] 3191/1: Mark I/O pointer as const in __raw_reads[bwl] 2005-12-05 10:54:59 +00:00
ioctl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ioctls.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ipcbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
irq.h [ARM SMP] Add hotplug CPU infrastructure 2005-11-02 22:24:33 +00:00
kmap_types.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
leds.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
limits.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
linkage.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
local.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
locks.h [ARM] 3019/1: fix wrong comments 2005-10-18 07:51:34 +01:00
mc146818rtc.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
memory.h [ARM] 3194/1: add pfn_to_kaddr macro for ARM take2 2005-12-05 10:55:00 +00:00
mman.h [PATCH] madvise(MADV_REMOVE): remove pages from tmpfs shm backing store 2006-01-06 08:33:22 -08:00
mmu_context.h [ARM] Add linux/compiler.h includes where required 2005-11-16 17:23:57 +00:00
mmu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mmzone.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
module.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
msgbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
mtd-xip.h [MTD] XIP cleanup 2005-07-07 16:50:16 +02:00
namei.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
numnodes.h [ARM] Add asm/memory.h to asm/numnodes.h 2005-11-21 15:26:18 +00:00
nwflash.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
page.h [PATCH] mm: consolidate get_order 2005-09-05 00:05:39 -07:00
param.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
parport.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pci.h [PATCH] Make sparc64 use setup-res.c 2005-09-08 14:57:25 -07:00
percpu.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pgalloc.h [PATCH] ARM: Factor out common pmd_populate functionality 2005-06-22 20:58:29 +01:00
pgtable.h [PATCH] vm: remove unused/broken page_pte[_prot] macros 2005-10-30 17:37:22 -08:00
poll.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
posix_types.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
proc-fns.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
processor.h [PATCH] ARM: Fix kernel stack offset calculations 2005-05-05 13:11:00 +01:00
procinfo.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ptrace.h [PATCH] ARM: showregs 2005-04-17 15:50:36 +01:00
resource.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rtc.h [PATCH] ARM: RTC: allow driver methods to return error 2005-04-30 12:19:28 +01:00
scatterlist.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sections.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
segment.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
semaphore-helper.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
semaphore.h [ARM] sema_count() removal 2005-12-01 20:58:01 +00:00
sembuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
serial.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
setup.h [ARM] 2925/3: earlyparam - postfix section with .init for make buildcheck 2005-09-20 16:25:12 +01:00
shmbuf.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
shmparam.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sigcontext.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
siginfo.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
signal.h [ARM] Remove SA_IRQNOMASK 2005-09-26 15:30:20 +01:00
sizes.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
smp.h [ARM SMP] Add core ARM support for local timers 2005-11-08 19:08:05 +00:00
socket.h [NET]: Introduce SO_{SND,RCV}BUFFORCE socket options 2005-08-29 15:31:35 -07:00
sockios.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
spinlock_types.h [PATCH] spinlock consolidation 2005-09-10 10:06:21 -07:00
spinlock.h [ARM SMP] Use event instructions for spinlocks 2005-12-01 15:47:24 +00:00
stat.h [PATCH] ARM: Fix new-ABI layout of struct stat64 2005-07-04 13:02:46 +01:00
statfs.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
string.h [PATCH] ARM: 2653/1: Fix memset and memzero macro double-reference of parameters 2005-04-25 23:40:05 +01:00
suspend.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
system.h [ARM] No need to include asm/proc-fns.h into asm/system.h 2005-11-16 18:36:49 +00:00
termbits.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
termios.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
therm.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
thread_info.h [ARM] Add linux/compiler.h includes where required 2005-11-16 17:23:57 +00:00
timex.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
tlb.h [PATCH] mm: tlb_finish_mmu forget rss 2005-10-29 21:40:37 -07:00
tlbflush.h [PATCH] ARM SMP: TLB implementations only affect local CPU 2005-06-28 13:40:39 +01:00
topology.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
traps.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
types.h [PATCH] sab: consolidate kmem_bufctl_t 2005-09-05 00:05:48 -07:00
uaccess.h [ARM] Fix get_user when passed a const pointer 2005-11-18 14:22:03 +00:00
ucontext.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
unaligned.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
unistd.h [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
user.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vfp.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vfpmacros.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
vga.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xor.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00