Commit ff2bdcb0 authored by Paul Mackerras's avatar Paul Mackerras

Merge samba.org:/home/paulus/kernel/linux-2.5

into samba.org:/home/paulus/kernel/for-linus-ppc
parents 5b27e42c 6a1caddf
...@@ -37,13 +37,13 @@ How It Works ...@@ -37,13 +37,13 @@ How It Works
The overcommit is based on the following rules The overcommit is based on the following rules
For a file backed map For a file backed map
SHARED or READ only - 0 cost (the file is the map not swap) SHARED or READ-only - 0 cost (the file is the map not swap)
PRIVATE WRITABLE - size of mapping per instance
WRITABLE SHARED - size of mapping per instance For an anonymous or /dev/zero map
SHARED - size of mapping
For a direct map PRIVATE READ-only - 0 cost (but of little use)
SHARED or READ only - size of mapping PRIVATE WRITABLE - size of mapping per instance
PRIVATE WRITEABLE - size of mapping per instance
Additional accounting Additional accounting
Pages made writable copies by mmap Pages made writable copies by mmap
...@@ -66,5 +66,3 @@ o Implement actual limit enforcement ...@@ -66,5 +66,3 @@ o Implement actual limit enforcement
To Do To Do
----- -----
o Account ptrace pages (this is hard) o Account ptrace pages (this is hard)
o Account for shared anonymous mappings properly
- right now we account them per instance
...@@ -1081,8 +1081,8 @@ sys_call_table: ...@@ -1081,8 +1081,8 @@ sys_call_table:
.quad sys_pciconfig_write .quad sys_pciconfig_write
.quad sys_query_module .quad sys_query_module
.quad sys_prctl .quad sys_prctl
.quad sys_pread .quad sys_pread64
.quad sys_pwrite /* 350 */ .quad sys_pwrite64 /* 350 */
.quad sys_rt_sigreturn .quad sys_rt_sigreturn
.quad sys_rt_sigaction .quad sys_rt_sigaction
.quad sys_rt_sigprocmask .quad sys_rt_sigprocmask
......
...@@ -194,8 +194,8 @@ __syscall_start: ...@@ -194,8 +194,8 @@ __syscall_start:
.long sys_rt_sigtimedwait .long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo .long sys_rt_sigqueueinfo
.long sys_rt_sigsuspend_wrapper .long sys_rt_sigsuspend_wrapper
/* 180 */ .long sys_pread /* 180 */ .long sys_pread64
.long sys_pwrite .long sys_pwrite64
.long sys_chown16 .long sys_chown16
.long sys_getcwd .long sys_getcwd
.long sys_capget .long sys_capget
......
...@@ -689,8 +689,8 @@ ENTRY(sys_call_table) ...@@ -689,8 +689,8 @@ ENTRY(sys_call_table)
.long sys_rt_sigtimedwait .long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo .long sys_rt_sigqueueinfo
.long sys_rt_sigsuspend .long sys_rt_sigsuspend
.long sys_pread /* 180 */ .long sys_pread64 /* 180 */
.long sys_pwrite .long sys_pwrite64
.long sys_chown16 .long sys_chown16
.long sys_getcwd .long sys_getcwd
.long sys_capget .long sys_capget
......
...@@ -3648,15 +3648,15 @@ sys32_sched_rr_get_interval (pid_t pid, struct timespec32 *interval) ...@@ -3648,15 +3648,15 @@ sys32_sched_rr_get_interval (pid_t pid, struct timespec32 *interval)
asmlinkage long asmlinkage long
sys32_pread (unsigned int fd, void *buf, unsigned int count, u32 pos_lo, u32 pos_hi) sys32_pread (unsigned int fd, void *buf, unsigned int count, u32 pos_lo, u32 pos_hi)
{ {
extern asmlinkage long sys_pread (unsigned int, char *, size_t, loff_t); extern asmlinkage long sys_pread64 (unsigned int, char *, size_t, loff_t);
return sys_pread(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo); return sys_pread64(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo);
} }
asmlinkage long asmlinkage long
sys32_pwrite (unsigned int fd, void *buf, unsigned int count, u32 pos_lo, u32 pos_hi) sys32_pwrite (unsigned int fd, void *buf, unsigned int count, u32 pos_lo, u32 pos_hi)
{ {
extern asmlinkage long sys_pwrite (unsigned int, const char *, size_t, loff_t); extern asmlinkage long sys_pwrite64 (unsigned int, const char *, size_t, loff_t);
return sys_pwrite(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo); return sys_pwrite64(fd, buf, count, ((unsigned long) pos_hi << 32) | pos_lo);
} }
asmlinkage long asmlinkage long
......
...@@ -1134,8 +1134,8 @@ sys_call_table: ...@@ -1134,8 +1134,8 @@ sys_call_table:
data8 sys_flock // 1145 data8 sys_flock // 1145
data8 sys_readv data8 sys_readv
data8 sys_writev data8 sys_writev
data8 sys_pread data8 sys_pread64
data8 sys_pwrite data8 sys_pwrite64
data8 sys_sysctl // 1150 data8 sys_sysctl // 1150
data8 sys_mmap data8 sys_mmap
data8 sys_munmap data8 sys_munmap
......
...@@ -608,8 +608,8 @@ sys_call_table: ...@@ -608,8 +608,8 @@ sys_call_table:
.long sys_rt_sigtimedwait .long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo .long sys_rt_sigqueueinfo
.long sys_rt_sigsuspend .long sys_rt_sigsuspend
.long sys_pread /* 180 */ .long sys_pread64 /* 180 */
.long sys_pwrite .long sys_pwrite64
.long sys_lchown16; .long sys_lchown16;
.long sys_getcwd .long sys_getcwd
.long sys_capget .long sys_capget
......
...@@ -333,8 +333,8 @@ sys_call_table: ...@@ -333,8 +333,8 @@ sys_call_table:
PTR sys_rt_sigtimedwait PTR sys_rt_sigtimedwait
PTR sys_rt_sigqueueinfo PTR sys_rt_sigqueueinfo
PTR sys_rt_sigsuspend PTR sys_rt_sigsuspend
PTR sys_pread /* 5200 */ PTR sys_pread64 /* 5200 */
PTR sys_pwrite PTR sys_pwrite64
PTR sys_chown PTR sys_chown
PTR sys_getcwd PTR sys_getcwd
PTR sys_capget PTR sys_capget
......
...@@ -1251,8 +1251,8 @@ _GLOBAL(sys_call_table) ...@@ -1251,8 +1251,8 @@ _GLOBAL(sys_call_table)
.long sys_rt_sigtimedwait .long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo .long sys_rt_sigqueueinfo
.long ppc_rt_sigsuspend .long ppc_rt_sigsuspend
.long sys_pread .long sys_pread64
.long sys_pwrite /* 180 */ .long sys_pwrite64 /* 180 */
.long sys_chown .long sys_chown
.long sys_getcwd .long sys_getcwd
.long sys_capget .long sys_capget
......
...@@ -916,8 +916,8 @@ _GLOBAL(sys_call_table) ...@@ -916,8 +916,8 @@ _GLOBAL(sys_call_table)
.llong .sys_rt_sigtimedwait .llong .sys_rt_sigtimedwait
.llong .sys_rt_sigqueueinfo .llong .sys_rt_sigqueueinfo
.llong .sys_rt_sigsuspend .llong .sys_rt_sigsuspend
.llong .sys_pread .llong .sys_pread64
.llong .sys_pwrite /* 180 */ .llong .sys_pwrite64 /* 180 */
.llong .sys_chown .llong .sys_chown
.llong .sys_getcwd .llong .sys_getcwd
.llong .sys_capget .llong .sys_capget
......
...@@ -520,8 +520,8 @@ sys_call_table: ...@@ -520,8 +520,8 @@ sys_call_table:
.long sys_rt_sigtimedwait .long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo .long sys_rt_sigqueueinfo
.long sys_rt_sigsuspend_glue .long sys_rt_sigsuspend_glue
.long sys_pread /* 180 */ .long sys_pread64 /* 180 */
.long sys_pwrite .long sys_pwrite64
.long sys_chown16 .long sys_chown16
.long sys_getcwd .long sys_getcwd
.long sys_capget .long sys_capget
......
...@@ -3980,10 +3980,10 @@ asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5) ...@@ -3980,10 +3980,10 @@ asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
} }
extern asmlinkage ssize_t sys_pread(unsigned int fd, char * buf, extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf,
size_t count, loff_t pos); size_t count, loff_t pos);
extern asmlinkage ssize_t sys_pwrite(unsigned int fd, const char * buf, extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf,
size_t count, loff_t pos); size_t count, loff_t pos);
typedef __kernel_ssize_t32 ssize_t32; typedef __kernel_ssize_t32 ssize_t32;
...@@ -3991,13 +3991,13 @@ typedef __kernel_ssize_t32 ssize_t32; ...@@ -3991,13 +3991,13 @@ typedef __kernel_ssize_t32 ssize_t32;
asmlinkage ssize_t32 sys32_pread(unsigned int fd, char *ubuf, asmlinkage ssize_t32 sys32_pread(unsigned int fd, char *ubuf,
__kernel_size_t32 count, u32 poshi, u32 poslo) __kernel_size_t32 count, u32 poshi, u32 poslo)
{ {
return sys_pread(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
} }
asmlinkage ssize_t32 sys32_pwrite(unsigned int fd, char *ubuf, asmlinkage ssize_t32 sys32_pwrite(unsigned int fd, char *ubuf,
__kernel_size_t32 count, u32 poshi, u32 poslo) __kernel_size_t32 count, u32 poshi, u32 poslo)
{ {
return sys_pwrite(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
} }
extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count);
......
...@@ -31,7 +31,7 @@ sys_call_table: ...@@ -31,7 +31,7 @@ sys_call_table:
/*50*/ .long sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys_ioctl /*50*/ .long sys_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys_ioctl
/*55*/ .long sys_reboot, sys_mmap2, sys_symlink, sys_readlink, sys_execve /*55*/ .long sys_reboot, sys_mmap2, sys_symlink, sys_readlink, sys_execve
/*60*/ .long sys_umask, sys_chroot, sys_newfstat, sys_fstat64, sys_getpagesize /*60*/ .long sys_umask, sys_chroot, sys_newfstat, sys_fstat64, sys_getpagesize
/*65*/ .long sys_msync, sys_vfork, sys_pread, sys_pwrite, sys_geteuid /*65*/ .long sys_msync, sys_vfork, sys_pread64, sys_pwrite64, sys_geteuid
/*70*/ .long sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect /*70*/ .long sys_getegid, sys_mmap, sys_setreuid, sys_munmap, sys_mprotect
/*75*/ .long sys_madvise, sys_vhangup, sys_truncate64, sys_mincore, sys_getgroups16 /*75*/ .long sys_madvise, sys_vhangup, sys_truncate64, sys_mincore, sys_getgroups16
/*80*/ .long sys_setgroups16, sys_getpgrp, sys_setgroups, sys_setitimer, sys_ftruncate64 /*80*/ .long sys_setgroups16, sys_getpgrp, sys_setgroups, sys_setitimer, sys_ftruncate64
......
...@@ -3878,10 +3878,10 @@ asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5) ...@@ -3878,10 +3878,10 @@ asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
} }
extern asmlinkage ssize_t sys_pread(unsigned int fd, char * buf, extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf,
size_t count, loff_t pos); size_t count, loff_t pos);
extern asmlinkage ssize_t sys_pwrite(unsigned int fd, const char * buf, extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf,
size_t count, loff_t pos); size_t count, loff_t pos);
typedef __kernel_ssize_t32 ssize_t32; typedef __kernel_ssize_t32 ssize_t32;
...@@ -3889,13 +3889,13 @@ typedef __kernel_ssize_t32 ssize_t32; ...@@ -3889,13 +3889,13 @@ typedef __kernel_ssize_t32 ssize_t32;
asmlinkage ssize_t32 sys32_pread(unsigned int fd, char *ubuf, asmlinkage ssize_t32 sys32_pread(unsigned int fd, char *ubuf,
__kernel_size_t32 count, u32 poshi, u32 poslo) __kernel_size_t32 count, u32 poshi, u32 poslo)
{ {
return sys_pread(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
} }
asmlinkage ssize_t32 sys32_pwrite(unsigned int fd, char *ubuf, asmlinkage ssize_t32 sys32_pwrite(unsigned int fd, char *ubuf,
__kernel_size_t32 count, u32 poshi, u32 poslo) __kernel_size_t32 count, u32 poshi, u32 poslo)
{ {
return sys_pwrite(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
} }
extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count);
......
...@@ -32,7 +32,7 @@ sys_call_table32: ...@@ -32,7 +32,7 @@ sys_call_table32:
/*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys32_ioctl /*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys32_ioctl
.word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve .word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve
/*60*/ .word sys_umask, sys_chroot, sys32_newfstat, sys_fstat64, sys_getpagesize /*60*/ .word sys_umask, sys_chroot, sys32_newfstat, sys_fstat64, sys_getpagesize
.word sys_msync, sys_vfork, sys32_pread, sys32_pwrite, sys_geteuid .word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
/*70*/ .word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect /*70*/ .word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect
.word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16 .word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16
/*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, sys32_setitimer, sys32_ftruncate64 /*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, sys32_setitimer, sys32_ftruncate64
......
...@@ -1948,10 +1948,10 @@ sys32_newuname(struct new_utsname * name) ...@@ -1948,10 +1948,10 @@ sys32_newuname(struct new_utsname * name)
return ret; return ret;
} }
extern asmlinkage ssize_t sys_pread(unsigned int fd, char * buf, extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf,
size_t count, loff_t pos); size_t count, loff_t pos);
extern asmlinkage ssize_t sys_pwrite(unsigned int fd, const char * buf, extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf,
size_t count, loff_t pos); size_t count, loff_t pos);
typedef __kernel_ssize_t32 ssize_t32; typedef __kernel_ssize_t32 ssize_t32;
...@@ -1961,7 +1961,7 @@ asmlinkage ssize_t32 ...@@ -1961,7 +1961,7 @@ asmlinkage ssize_t32
sys32_pread(unsigned int fd, char *ubuf, __kernel_size_t32 count, sys32_pread(unsigned int fd, char *ubuf, __kernel_size_t32 count,
u32 poslo, u32 poshi) u32 poslo, u32 poshi)
{ {
return sys_pread(fd, ubuf, count, return sys_pread64(fd, ubuf, count,
((loff_t)AA(poshi) << 32) | AA(poslo)); ((loff_t)AA(poshi) << 32) | AA(poslo));
} }
...@@ -1969,7 +1969,7 @@ asmlinkage ssize_t32 ...@@ -1969,7 +1969,7 @@ asmlinkage ssize_t32
sys32_pwrite(unsigned int fd, char *ubuf, __kernel_size_t32 count, sys32_pwrite(unsigned int fd, char *ubuf, __kernel_size_t32 count,
u32 poslo, u32 poshi) u32 poslo, u32 poshi)
{ {
return sys_pwrite(fd, ubuf, count, return sys_pwrite64(fd, ubuf, count,
((loff_t)AA(poshi) << 32) | AA(poslo)); ((loff_t)AA(poshi) << 32) | AA(poslo));
} }
......
...@@ -1699,7 +1699,7 @@ e1000_irq_disable(struct e1000_adapter *adapter) ...@@ -1699,7 +1699,7 @@ e1000_irq_disable(struct e1000_adapter *adapter)
{ {
atomic_inc(&adapter->irq_sem); atomic_inc(&adapter->irq_sem);
E1000_WRITE_REG(&adapter->hw, IMC, ~0); E1000_WRITE_REG(&adapter->hw, IMC, ~0);
synchronize_irq(); synchronize_irq(adapter->netdev->irq);
} }
/** /**
......
...@@ -185,8 +185,6 @@ ssize_t vfs_read(struct file *file, char *buf, size_t count, loff_t *pos) ...@@ -185,8 +185,6 @@ ssize_t vfs_read(struct file *file, char *buf, size_t count, loff_t *pos)
return -EBADF; return -EBADF;
if (!file->f_op || !file->f_op->read) if (!file->f_op || !file->f_op->read)
return -EINVAL; return -EINVAL;
if (pos < 0)
return -EINVAL;
ret = locks_verify_area(FLOCK_VERIFY_READ, inode, file, *pos, count); ret = locks_verify_area(FLOCK_VERIFY_READ, inode, file, *pos, count);
if (!ret) { if (!ret) {
...@@ -210,8 +208,6 @@ ssize_t vfs_write(struct file *file, const char *buf, size_t count, loff_t *pos) ...@@ -210,8 +208,6 @@ ssize_t vfs_write(struct file *file, const char *buf, size_t count, loff_t *pos)
return -EBADF; return -EBADF;
if (!file->f_op || !file->f_op->write) if (!file->f_op || !file->f_op->write)
return -EINVAL; return -EINVAL;
if (pos < 0)
return -EINVAL;
ret = locks_verify_area(FLOCK_VERIFY_WRITE, inode, file, *pos, count); ret = locks_verify_area(FLOCK_VERIFY_WRITE, inode, file, *pos, count);
if (!ret) { if (!ret) {
...@@ -254,12 +250,15 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count) ...@@ -254,12 +250,15 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count)
return ret; return ret;
} }
asmlinkage ssize_t sys_pread(unsigned int fd, char *buf, asmlinkage ssize_t sys_pread64(unsigned int fd, char *buf,
size_t count, loff_t pos) size_t count, loff_t pos)
{ {
struct file *file; struct file *file;
ssize_t ret = -EBADF; ssize_t ret = -EBADF;
if (pos < 0)
return -EINVAL;
file = fget(fd); file = fget(fd);
if (file) { if (file) {
ret = vfs_read(file, buf, count, &pos); ret = vfs_read(file, buf, count, &pos);
...@@ -269,12 +268,15 @@ asmlinkage ssize_t sys_pread(unsigned int fd, char *buf, ...@@ -269,12 +268,15 @@ asmlinkage ssize_t sys_pread(unsigned int fd, char *buf,
return ret; return ret;
} }
asmlinkage ssize_t sys_pwrite(unsigned int fd, const char *buf, asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char *buf,
size_t count, loff_t pos) size_t count, loff_t pos)
{ {
struct file *file; struct file *file;
ssize_t ret = -EBADF; ssize_t ret = -EBADF;
if (pos < 0)
return -EINVAL;
file = fget(fd); file = fget(fd);
if (file) { if (file) {
ret = vfs_write(file, buf, count, &pos); ret = vfs_write(file, buf, count, &pos);
......
...@@ -286,8 +286,8 @@ ...@@ -286,8 +286,8 @@
#define __NR_pciconfig_write 346 #define __NR_pciconfig_write 346
#define __NR_query_module 347 #define __NR_query_module 347
#define __NR_prctl 348 #define __NR_prctl 348
#define __NR_pread 349 #define __NR_pread64 349
#define __NR_pwrite 350 #define __NR_pwrite64 350
#define __NR_rt_sigreturn 351 #define __NR_rt_sigreturn 351
#define __NR_rt_sigaction 352 #define __NR_rt_sigaction 352
#define __NR_rt_sigprocmask 353 #define __NR_rt_sigprocmask 353
......
...@@ -200,8 +200,8 @@ ...@@ -200,8 +200,8 @@
#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE+177) #define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE+177)
#define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE+178) #define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE+178)
#define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179) #define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179)
#define __NR_pread (__NR_SYSCALL_BASE+180) #define __NR_pread64 (__NR_SYSCALL_BASE+180)
#define __NR_pwrite (__NR_SYSCALL_BASE+181) #define __NR_pwrite64 (__NR_SYSCALL_BASE+181)
#define __NR_chown (__NR_SYSCALL_BASE+182) #define __NR_chown (__NR_SYSCALL_BASE+182)
#define __NR_getcwd (__NR_SYSCALL_BASE+183) #define __NR_getcwd (__NR_SYSCALL_BASE+183)
#define __NR_capget (__NR_SYSCALL_BASE+184) #define __NR_capget (__NR_SYSCALL_BASE+184)
......
...@@ -185,8 +185,8 @@ ...@@ -185,8 +185,8 @@
#define __NR_rt_sigtimedwait 177 #define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178 #define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179 #define __NR_rt_sigsuspend 179
#define __NR_pread 180 #define __NR_pread64 180
#define __NR_pwrite 181 #define __NR_pwrite64 181
#define __NR_chown 182 #define __NR_chown 182
#define __NR_getcwd 183 #define __NR_getcwd 183
#define __NR_capget 184 #define __NR_capget 184
......
...@@ -184,8 +184,8 @@ ...@@ -184,8 +184,8 @@
#define __NR_rt_sigtimedwait 177 #define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178 #define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179 #define __NR_rt_sigsuspend 179
#define __NR_pread 180 #define __NR_pread64 180
#define __NR_pwrite 181 #define __NR_pwrite64 181
#define __NR_chown 182 #define __NR_chown 182
#define __NR_getcwd 183 #define __NR_getcwd 183
#define __NR_capget 184 #define __NR_capget 184
......
...@@ -137,8 +137,8 @@ ...@@ -137,8 +137,8 @@
#define __NR_flock 1145 #define __NR_flock 1145
#define __NR_readv 1146 #define __NR_readv 1146
#define __NR_writev 1147 #define __NR_writev 1147
#define __NR_pread 1148 #define __NR_pread64 1148
#define __NR_pwrite 1149 #define __NR_pwrite64 1149
#define __NR__sysctl 1150 #define __NR__sysctl 1150
#define __NR_mmap 1151 #define __NR_mmap 1151
#define __NR_munmap 1152 #define __NR_munmap 1152
......
...@@ -184,8 +184,8 @@ ...@@ -184,8 +184,8 @@
#define __NR_rt_sigtimedwait 177 #define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178 #define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179 #define __NR_rt_sigsuspend 179
#define __NR_pread 180 #define __NR_pread64 180
#define __NR_pwrite 181 #define __NR_pwrite64 181
#define __NR_lchown 182 #define __NR_lchown 182
#define __NR_getcwd 183 #define __NR_getcwd 183
#define __NR_capget 184 #define __NR_capget 184
......
...@@ -212,8 +212,8 @@ ...@@ -212,8 +212,8 @@
#define __NR_rt_sigtimedwait (__NR_Linux + 197) #define __NR_rt_sigtimedwait (__NR_Linux + 197)
#define __NR_rt_sigqueueinfo (__NR_Linux + 198) #define __NR_rt_sigqueueinfo (__NR_Linux + 198)
#define __NR_rt_sigsuspend (__NR_Linux + 199) #define __NR_rt_sigsuspend (__NR_Linux + 199)
#define __NR_pread (__NR_Linux + 200) #define __NR_pread64 (__NR_Linux + 200)
#define __NR_pwrite (__NR_Linux + 201) #define __NR_pwrite64 (__NR_Linux + 201)
#define __NR_chown (__NR_Linux + 202) #define __NR_chown (__NR_Linux + 202)
#define __NR_getcwd (__NR_Linux + 203) #define __NR_getcwd (__NR_Linux + 203)
#define __NR_capget (__NR_Linux + 204) #define __NR_capget (__NR_Linux + 204)
......
...@@ -447,8 +447,8 @@ ...@@ -447,8 +447,8 @@
#define __NR_rt_sigtimedwait (__NR_Linux + 197) #define __NR_rt_sigtimedwait (__NR_Linux + 197)
#define __NR_rt_sigqueueinfo (__NR_Linux + 198) #define __NR_rt_sigqueueinfo (__NR_Linux + 198)
#define __NR_rt_sigsuspend (__NR_Linux + 199) #define __NR_rt_sigsuspend (__NR_Linux + 199)
#define __NR_pread (__NR_Linux + 200) #define __NR_pread64 (__NR_Linux + 200)
#define __NR_pwrite (__NR_Linux + 201) #define __NR_pwrite64 (__NR_Linux + 201)
#define __NR_chown (__NR_Linux + 202) #define __NR_chown (__NR_Linux + 202)
#define __NR_getcwd (__NR_Linux + 203) #define __NR_getcwd (__NR_Linux + 203)
#define __NR_capget (__NR_Linux + 204) #define __NR_capget (__NR_Linux + 204)
......
...@@ -598,8 +598,8 @@ ...@@ -598,8 +598,8 @@
#define __NR_getitimer (__NR_Linux + 105) #define __NR_getitimer (__NR_Linux + 105)
#define __NR_capget (__NR_Linux + 106) #define __NR_capget (__NR_Linux + 106)
#define __NR_capset (__NR_Linux + 107) #define __NR_capset (__NR_Linux + 107)
#define __NR_pread (__NR_Linux + 108) #define __NR_pread64 (__NR_Linux + 108)
#define __NR_pwrite (__NR_Linux + 109) #define __NR_pwrite64 (__NR_Linux + 109)
#define __NR_getcwd (__NR_Linux + 110) #define __NR_getcwd (__NR_Linux + 110)
#define __NR_vhangup (__NR_Linux + 111) #define __NR_vhangup (__NR_Linux + 111)
#define __NR_idle (__NR_Linux + 112) #define __NR_idle (__NR_Linux + 112)
......
...@@ -186,8 +186,8 @@ ...@@ -186,8 +186,8 @@
#define __NR_rt_sigtimedwait 176 #define __NR_rt_sigtimedwait 176
#define __NR_rt_sigqueueinfo 177 #define __NR_rt_sigqueueinfo 177
#define __NR_rt_sigsuspend 178 #define __NR_rt_sigsuspend 178
#define __NR_pread 179 #define __NR_pread64 179
#define __NR_pwrite 180 #define __NR_pwrite64 180
#define __NR_chown 181 #define __NR_chown 181
#define __NR_getcwd 182 #define __NR_getcwd 182
#define __NR_capget 183 #define __NR_capget 183
......
...@@ -188,8 +188,8 @@ ...@@ -188,8 +188,8 @@
#define __NR_rt_sigtimedwait 176 #define __NR_rt_sigtimedwait 176
#define __NR_rt_sigqueueinfo 177 #define __NR_rt_sigqueueinfo 177
#define __NR_rt_sigsuspend 178 #define __NR_rt_sigsuspend 178
#define __NR_pread 179 #define __NR_pread64 179
#define __NR_pwrite 180 #define __NR_pwrite64 180
#define __NR_chown 181 #define __NR_chown 181
#define __NR_getcwd 182 #define __NR_getcwd 182
#define __NR_capget 183 #define __NR_capget 183
......
...@@ -170,8 +170,8 @@ ...@@ -170,8 +170,8 @@
#define __NR_rt_sigtimedwait 177 #define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178 #define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179 #define __NR_rt_sigsuspend 179
#define __NR_pread 180 #define __NR_pread64 180
#define __NR_pwrite 181 #define __NR_pwrite64 181
#define __NR_chown 182 #define __NR_chown 182
#define __NR_getcwd 183 #define __NR_getcwd 183
#define __NR_capget 184 #define __NR_capget 184
......
...@@ -147,8 +147,8 @@ ...@@ -147,8 +147,8 @@
#define __NR_rt_sigtimedwait 177 #define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178 #define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179 #define __NR_rt_sigsuspend 179
#define __NR_pread 180 #define __NR_pread64 180
#define __NR_pwrite 181 #define __NR_pwrite64 181
#define __NR_getcwd 183 #define __NR_getcwd 183
#define __NR_capget 184 #define __NR_capget 184
#define __NR_capset 185 #define __NR_capset 185
......
...@@ -189,8 +189,8 @@ ...@@ -189,8 +189,8 @@
#define __NR_rt_sigtimedwait 177 #define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178 #define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179 #define __NR_rt_sigsuspend 179
#define __NR_pread 180 #define __NR_pread64 180
#define __NR_pwrite 181 #define __NR_pwrite64 181
#define __NR_chown 182 #define __NR_chown 182
#define __NR_getcwd 183 #define __NR_getcwd 183
#define __NR_capget 184 #define __NR_capget 184
......
...@@ -82,8 +82,8 @@ ...@@ -82,8 +82,8 @@
#define __NR_getpagesize 64 /* Common */ #define __NR_getpagesize 64 /* Common */
#define __NR_msync 65 /* Common in newer 1.3.x revs... */ #define __NR_msync 65 /* Common in newer 1.3.x revs... */
#define __NR_vfork 66 /* Common */ #define __NR_vfork 66 /* Common */
#define __NR_pread 67 /* Linux Specific */ #define __NR_pread64 67 /* Linux Specific */
#define __NR_pwrite 68 /* Linux Specific */ #define __NR_pwrite64 68 /* Linux Specific */
#define __NR_geteuid32 69 /* Linux sparc32, sbrk under SunOS */ #define __NR_geteuid32 69 /* Linux sparc32, sbrk under SunOS */
#define __NR_getegid32 70 /* Linux sparc32, sstk under SunOS */ #define __NR_getegid32 70 /* Linux sparc32, sstk under SunOS */
#define __NR_mmap 71 /* Common */ #define __NR_mmap 71 /* Common */
......
...@@ -82,8 +82,8 @@ ...@@ -82,8 +82,8 @@
#define __NR_getpagesize 64 /* Common */ #define __NR_getpagesize 64 /* Common */
#define __NR_msync 65 /* Common in newer 1.3.x revs... */ #define __NR_msync 65 /* Common in newer 1.3.x revs... */
#define __NR_vfork 66 /* Common */ #define __NR_vfork 66 /* Common */
#define __NR_pread 67 /* Linux Specific */ #define __NR_pread64 67 /* Linux Specific */
#define __NR_pwrite 68 /* Linux Specific */ #define __NR_pwrite64 68 /* Linux Specific */
/* #define __NR_geteuid32 69 Linux sparc32, sbrk under SunOS */ /* #define __NR_geteuid32 69 Linux sparc32, sbrk under SunOS */
/* #define __NR_getegid32 70 Linux sparc32, sstk under SunOS */ /* #define __NR_getegid32 70 Linux sparc32, sstk under SunOS */
#define __NR_mmap 71 /* Common */ #define __NR_mmap 71 /* Common */
......
...@@ -48,10 +48,10 @@ __SYSCALL(__NR_rt_sigreturn, stub_rt_sigreturn) ...@@ -48,10 +48,10 @@ __SYSCALL(__NR_rt_sigreturn, stub_rt_sigreturn)
#define __NR_ioctl 16 #define __NR_ioctl 16
__SYSCALL(__NR_ioctl, sys_ioctl) __SYSCALL(__NR_ioctl, sys_ioctl)
#define __NR_pread 17 #define __NR_pread64 17
__SYSCALL(__NR_pread, sys_pread) __SYSCALL(__NR_pread64, sys_pread64)
#define __NR_pwrite 18 #define __NR_pwrite64 18
__SYSCALL(__NR_pwrite, sys_pwrite) __SYSCALL(__NR_pwrite64, sys_pwrite64)
#define __NR_readv 19 #define __NR_readv 19
__SYSCALL(__NR_readv, sys_readv) __SYSCALL(__NR_readv, sys_readv)
#define __NR_writev 20 #define __NR_writev 20
......
...@@ -331,7 +331,7 @@ extern void show_free_areas(void); ...@@ -331,7 +331,7 @@ extern void show_free_areas(void);
extern int fail_writepage(struct page *); extern int fail_writepage(struct page *);
struct page * shmem_nopage(struct vm_area_struct * vma, unsigned long address, int unused); struct page * shmem_nopage(struct vm_area_struct * vma, unsigned long address, int unused);
struct file *shmem_file_setup(char * name, loff_t size); struct file *shmem_file_setup(char * name, loff_t size, unsigned long flags);
extern void shmem_lock(struct file * file, int lock); extern void shmem_lock(struct file * file, int lock);
extern int shmem_zero_setup(struct vm_area_struct *); extern int shmem_zero_setup(struct vm_area_struct *);
...@@ -430,7 +430,7 @@ static inline unsigned long do_mmap(struct file *file, unsigned long addr, ...@@ -430,7 +430,7 @@ static inline unsigned long do_mmap(struct file *file, unsigned long addr,
return ret; return ret;
} }
extern int do_munmap(struct mm_struct *, unsigned long, size_t, int); extern int do_munmap(struct mm_struct *, unsigned long, size_t);
extern unsigned long do_brk(unsigned long, unsigned long); extern unsigned long do_brk(unsigned long, unsigned long);
......
...@@ -16,7 +16,7 @@ struct shmem_inode_info { ...@@ -16,7 +16,7 @@ struct shmem_inode_info {
swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* for the first blocks */ swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* for the first blocks */
void **i_indirect; /* indirect blocks */ void **i_indirect; /* indirect blocks */
unsigned long swapped; unsigned long swapped;
int locked; /* into memory */ unsigned long flags;
struct list_head list; struct list_head list;
struct inode vfs_inode; struct inode vfs_inode;
}; };
......
...@@ -57,6 +57,7 @@ extern int kmem_cache_destroy(kmem_cache_t *); ...@@ -57,6 +57,7 @@ extern int kmem_cache_destroy(kmem_cache_t *);
extern int kmem_cache_shrink(kmem_cache_t *); extern int kmem_cache_shrink(kmem_cache_t *);
extern void *kmem_cache_alloc(kmem_cache_t *, int); extern void *kmem_cache_alloc(kmem_cache_t *, int);
extern void kmem_cache_free(kmem_cache_t *, void *); extern void kmem_cache_free(kmem_cache_t *, void *);
extern unsigned int kmem_cache_size(kmem_cache_t *);
extern void *kmalloc(size_t, int); extern void *kmalloc(size_t, int);
extern void kfree(const void *); extern void kfree(const void *);
......
...@@ -186,7 +186,7 @@ static int newseg (key_t key, int shmflg, size_t size) ...@@ -186,7 +186,7 @@ static int newseg (key_t key, int shmflg, size_t size)
shp->shm_flags = (shmflg & S_IRWXUGO); shp->shm_flags = (shmflg & S_IRWXUGO);
sprintf (name, "SYSV%08x", key); sprintf (name, "SYSV%08x", key);
file = shmem_file_setup(name, size); file = shmem_file_setup(name, size, VM_ACCOUNT);
error = PTR_ERR(file); error = PTR_ERR(file);
if (IS_ERR(file)) if (IS_ERR(file))
goto no_file; goto no_file;
...@@ -671,7 +671,7 @@ asmlinkage long sys_shmdt (char *shmaddr) ...@@ -671,7 +671,7 @@ asmlinkage long sys_shmdt (char *shmaddr)
shmdnext = shmd->vm_next; shmdnext = shmd->vm_next;
if (shmd->vm_ops == &shm_vm_ops if (shmd->vm_ops == &shm_vm_ops
&& shmd->vm_start - (shmd->vm_pgoff << PAGE_SHIFT) == (ulong) shmaddr) { && shmd->vm_start - (shmd->vm_pgoff << PAGE_SHIFT) == (ulong) shmaddr) {
do_munmap(mm, shmd->vm_start, shmd->vm_end - shmd->vm_start, 1); do_munmap(mm, shmd->vm_start, shmd->vm_end - shmd->vm_start);
retval = 0; retval = 0;
} }
} }
......
...@@ -210,17 +210,12 @@ static inline int dup_mmap(struct mm_struct * mm) ...@@ -210,17 +210,12 @@ static inline int dup_mmap(struct mm_struct * mm)
retval = -ENOMEM; retval = -ENOMEM;
if(mpnt->vm_flags & VM_DONTCOPY) if(mpnt->vm_flags & VM_DONTCOPY)
continue; continue;
/*
* FIXME: shared writable map accounting should be one off
*/
if (mpnt->vm_flags & VM_ACCOUNT) { if (mpnt->vm_flags & VM_ACCOUNT) {
unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT; unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
if (!vm_enough_memory(len)) if (!vm_enough_memory(len))
goto fail_nomem; goto fail_nomem;
charge += len; charge += len;
} }
tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
if (!tmp) if (!tmp)
goto fail_nomem; goto fail_nomem;
......
...@@ -105,6 +105,7 @@ EXPORT_SYMBOL(kmem_cache_destroy); ...@@ -105,6 +105,7 @@ EXPORT_SYMBOL(kmem_cache_destroy);
EXPORT_SYMBOL(kmem_cache_shrink); EXPORT_SYMBOL(kmem_cache_shrink);
EXPORT_SYMBOL(kmem_cache_alloc); EXPORT_SYMBOL(kmem_cache_alloc);
EXPORT_SYMBOL(kmem_cache_free); EXPORT_SYMBOL(kmem_cache_free);
EXPORT_SYMBOL(kmem_cache_size);
EXPORT_SYMBOL(kmalloc); EXPORT_SYMBOL(kmalloc);
EXPORT_SYMBOL(kfree); EXPORT_SYMBOL(kfree);
EXPORT_SYMBOL(vfree); EXPORT_SYMBOL(vfree);
......
...@@ -1096,23 +1096,20 @@ int vmtruncate(struct inode * inode, loff_t offset) ...@@ -1096,23 +1096,20 @@ int vmtruncate(struct inode * inode, loff_t offset)
do_expand: do_expand:
limit = current->rlim[RLIMIT_FSIZE].rlim_cur; limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
if (limit != RLIM_INFINITY) { if (limit != RLIM_INFINITY && offset > limit)
if (inode->i_size >= limit) { goto out_sig;
send_sig(SIGXFSZ, current, 0); if (offset > inode->i_sb->s_maxbytes)
goto out; goto out;
}
if (offset > limit) {
send_sig(SIGXFSZ, current, 0);
offset = limit;
}
}
inode->i_size = offset; inode->i_size = offset;
out_truncate: out_truncate:
if (inode->i_op && inode->i_op->truncate) if (inode->i_op && inode->i_op->truncate)
inode->i_op->truncate(inode); inode->i_op->truncate(inode);
out:
return 0; return 0;
out_sig:
send_sig(SIGXFSZ, current, 0);
out:
return -EFBIG;
} }
/* /*
......
...@@ -131,13 +131,6 @@ int vm_enough_memory(long pages) ...@@ -131,13 +131,6 @@ int vm_enough_memory(long pages)
return 0; return 0;
} }
void vm_unacct_vma(struct vm_area_struct *vma)
{
int len = vma->vm_end - vma->vm_start;
if (vma->vm_flags & VM_ACCOUNT)
vm_unacct_memory(len >> PAGE_SHIFT);
}
/* Remove one vm structure from the inode's i_mapping address space. */ /* Remove one vm structure from the inode's i_mapping address space. */
static inline void __remove_shared_vm_struct(struct vm_area_struct *vma) static inline void __remove_shared_vm_struct(struct vm_area_struct *vma)
{ {
...@@ -204,7 +197,7 @@ asmlinkage unsigned long sys_brk(unsigned long brk) ...@@ -204,7 +197,7 @@ asmlinkage unsigned long sys_brk(unsigned long brk)
/* Always allow shrinking brk. */ /* Always allow shrinking brk. */
if (brk <= mm->brk) { if (brk <= mm->brk) {
if (!do_munmap(mm, newbrk, oldbrk-newbrk, 1)) if (!do_munmap(mm, newbrk, oldbrk-newbrk))
goto set_brk; goto set_brk;
goto out; goto out;
} }
...@@ -524,7 +517,7 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, ...@@ -524,7 +517,7 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
munmap_back: munmap_back:
vma = find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent); vma = find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent);
if (vma && vma->vm_start < addr + len) { if (vma && vma->vm_start < addr + len) {
if (do_munmap(mm, addr, len, 1)) if (do_munmap(mm, addr, len))
return -ENOMEM; return -ENOMEM;
goto munmap_back; goto munmap_back;
} }
...@@ -534,16 +527,17 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, ...@@ -534,16 +527,17 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
> current->rlim[RLIMIT_AS].rlim_cur) > current->rlim[RLIMIT_AS].rlim_cur)
return -ENOMEM; return -ENOMEM;
if (sysctl_overcommit_memory > 1) if (!(flags & MAP_NORESERVE) || sysctl_overcommit_memory > 1) {
vm_flags &= ~MAP_NORESERVE; if (vm_flags & VM_SHARED) {
/* Check memory availability in shmem_file_setup? */
/* Private writable mapping? Check memory availability.. */ vm_flags |= VM_ACCOUNT;
if ((((vm_flags & (VM_SHARED | VM_WRITE)) == VM_WRITE) || } else if (vm_flags & VM_WRITE) {
(file == NULL)) && !(flags & MAP_NORESERVE)) { /* Private writable mapping: check memory availability */
charged = len >> PAGE_SHIFT; charged = len >> PAGE_SHIFT;
if (!vm_enough_memory(charged)) if (!vm_enough_memory(charged))
return -ENOMEM; return -ENOMEM;
vm_flags |= VM_ACCOUNT; vm_flags |= VM_ACCOUNT;
}
} }
/* Can we just expand an old anonymous mapping? */ /* Can we just expand an old anonymous mapping? */
...@@ -586,12 +580,20 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, ...@@ -586,12 +580,20 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
error = file->f_op->mmap(file, vma); error = file->f_op->mmap(file, vma);
if (error) if (error)
goto unmap_and_free_vma; goto unmap_and_free_vma;
} else if (flags & MAP_SHARED) { } else if (vm_flags & VM_SHARED) {
error = shmem_zero_setup(vma); error = shmem_zero_setup(vma);
if (error) if (error)
goto free_vma; goto free_vma;
} }
/* We set VM_ACCOUNT in a shared mapping's vm_flags, to inform
* shmem_zero_setup (perhaps called through /dev/zero's ->mmap)
* that memory reservation must be checked; but that reservation
* belongs to shared memory object, not to vma: so now clear it.
*/
if ((vm_flags & (VM_SHARED|VM_ACCOUNT)) == (VM_SHARED|VM_ACCOUNT))
vma->vm_flags &= ~VM_ACCOUNT;
/* Can addr have changed?? /* Can addr have changed??
* *
* Answer: Yes, several device drivers can do it in their * Answer: Yes, several device drivers can do it in their
...@@ -943,8 +945,7 @@ static void unmap_region(struct mm_struct *mm, ...@@ -943,8 +945,7 @@ static void unmap_region(struct mm_struct *mm,
struct vm_area_struct *mpnt, struct vm_area_struct *mpnt,
struct vm_area_struct *prev, struct vm_area_struct *prev,
unsigned long start, unsigned long start,
unsigned long end, unsigned long end)
int acct)
{ {
mmu_gather_t *tlb; mmu_gather_t *tlb;
...@@ -958,7 +959,7 @@ static void unmap_region(struct mm_struct *mm, ...@@ -958,7 +959,7 @@ static void unmap_region(struct mm_struct *mm,
unmap_page_range(tlb, mpnt, from, to); unmap_page_range(tlb, mpnt, from, to);
if (acct && (mpnt->vm_flags & VM_ACCOUNT)) { if (mpnt->vm_flags & VM_ACCOUNT) {
len = to - from; len = to - from;
vm_unacct_memory(len >> PAGE_SHIFT); vm_unacct_memory(len >> PAGE_SHIFT);
} }
...@@ -1039,7 +1040,7 @@ static int splitvma(struct mm_struct *mm, struct vm_area_struct *mpnt, unsigned ...@@ -1039,7 +1040,7 @@ static int splitvma(struct mm_struct *mm, struct vm_area_struct *mpnt, unsigned
* work. This now handles partial unmappings. * work. This now handles partial unmappings.
* Jeremy Fitzhardine <jeremy@sw.oz.au> * Jeremy Fitzhardine <jeremy@sw.oz.au>
*/ */
int do_munmap(struct mm_struct *mm, unsigned long start, size_t len, int acct) int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
{ {
unsigned long end; unsigned long end;
struct vm_area_struct *mpnt, *prev, *last; struct vm_area_struct *mpnt, *prev, *last;
...@@ -1083,7 +1084,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len, int acct) ...@@ -1083,7 +1084,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len, int acct)
*/ */
spin_lock(&mm->page_table_lock); spin_lock(&mm->page_table_lock);
mpnt = touched_by_munmap(mm, mpnt, prev, end); mpnt = touched_by_munmap(mm, mpnt, prev, end);
unmap_region(mm, mpnt, prev, start, end, acct); unmap_region(mm, mpnt, prev, start, end);
spin_unlock(&mm->page_table_lock); spin_unlock(&mm->page_table_lock);
/* Fix up all other VM information */ /* Fix up all other VM information */
...@@ -1098,7 +1099,7 @@ asmlinkage long sys_munmap(unsigned long addr, size_t len) ...@@ -1098,7 +1099,7 @@ asmlinkage long sys_munmap(unsigned long addr, size_t len)
struct mm_struct *mm = current->mm; struct mm_struct *mm = current->mm;
down_write(&mm->mmap_sem); down_write(&mm->mmap_sem);
ret = do_munmap(mm, addr, len, 1); ret = do_munmap(mm, addr, len);
up_write(&mm->mmap_sem); up_write(&mm->mmap_sem);
return ret; return ret;
} }
...@@ -1135,7 +1136,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len) ...@@ -1135,7 +1136,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
munmap_back: munmap_back:
vma = find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent); vma = find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent);
if (vma && vma->vm_start < addr + len) { if (vma && vma->vm_start < addr + len) {
if (do_munmap(mm, addr, len, 1)) if (do_munmap(mm, addr, len))
return -ENOMEM; return -ENOMEM;
goto munmap_back; goto munmap_back;
} }
...@@ -1225,7 +1226,7 @@ void exit_mmap(struct mm_struct * mm) ...@@ -1225,7 +1226,7 @@ void exit_mmap(struct mm_struct * mm)
* removal * removal
*/ */
if (mpnt->vm_flags & VM_ACCOUNT) if (mpnt->vm_flags & VM_ACCOUNT)
vm_unacct_vma(mpnt); vm_unacct_memory((end - start) >> PAGE_SHIFT);
mm->map_count--; mm->map_count--;
unmap_page_range(tlb, mpnt, start, end); unmap_page_range(tlb, mpnt, start, end);
......
...@@ -257,6 +257,22 @@ static int mprotect_fixup(struct vm_area_struct * vma, struct vm_area_struct ** ...@@ -257,6 +257,22 @@ static int mprotect_fixup(struct vm_area_struct * vma, struct vm_area_struct **
*pprev = vma; *pprev = vma;
return 0; return 0;
} }
/*
* If we make a private mapping writable we increase our commit;
* but (without finer accounting) cannot reduce our commit if we
* make it unwritable again.
*
* FIXME? We haven't defined a VM_NORESERVE flag, so mprotecting
* a MAP_NORESERVE private mapping to writable will now reserve.
*/
if ((newflags & VM_WRITE) &&
!(vma->vm_flags & (VM_ACCOUNT|VM_WRITE|VM_SHARED))) {
charged = (end - start) >> PAGE_SHIFT;
if (!vm_enough_memory(charged))
return -ENOMEM;
newflags |= VM_ACCOUNT;
}
newprot = protection_map[newflags & 0xf]; newprot = protection_map[newflags & 0xf];
if (start == vma->vm_start) { if (start == vma->vm_start) {
if (end == vma->vm_end) if (end == vma->vm_end)
...@@ -267,19 +283,10 @@ static int mprotect_fixup(struct vm_area_struct * vma, struct vm_area_struct ** ...@@ -267,19 +283,10 @@ static int mprotect_fixup(struct vm_area_struct * vma, struct vm_area_struct **
error = mprotect_fixup_end(vma, pprev, start, newflags, newprot); error = mprotect_fixup_end(vma, pprev, start, newflags, newprot);
else else
error = mprotect_fixup_middle(vma, pprev, start, end, newflags, newprot); error = mprotect_fixup_middle(vma, pprev, start, end, newflags, newprot);
if (error) { if (error) {
if (newflags & PROT_WRITE) vm_unacct_memory(charged);
vm_unacct_memory(charged);
return error; return error;
} }
/*
* Delayed accounting for reduction of memory use - done last to
* avoid allocation races
*/
if (charged && !(newflags & PROT_WRITE))
vm_unacct_memory(charged);
change_protection(vma, start, end, newprot); change_protection(vma, start, end, newprot);
return 0; return 0;
} }
......
...@@ -150,6 +150,7 @@ static inline unsigned long move_vma(struct vm_area_struct * vma, ...@@ -150,6 +150,7 @@ static inline unsigned long move_vma(struct vm_area_struct * vma,
struct mm_struct * mm = vma->vm_mm; struct mm_struct * mm = vma->vm_mm;
struct vm_area_struct * new_vma, * next, * prev; struct vm_area_struct * new_vma, * next, * prev;
int allocated_vma; int allocated_vma;
int split = 0;
new_vma = NULL; new_vma = NULL;
next = find_vma_prev(mm, new_addr, &prev); next = find_vma_prev(mm, new_addr, &prev);
...@@ -210,11 +211,26 @@ static inline unsigned long move_vma(struct vm_area_struct * vma, ...@@ -210,11 +211,26 @@ static inline unsigned long move_vma(struct vm_area_struct * vma,
new_vma->vm_ops->open(new_vma); new_vma->vm_ops->open(new_vma);
insert_vm_struct(current->mm, new_vma); insert_vm_struct(current->mm, new_vma);
} }
/*
* The old VMA has been accounted for, /* Conceal VM_ACCOUNT so old reservation is not undone */
* don't double account if (vma->vm_flags & VM_ACCOUNT) {
*/ vma->vm_flags &= ~VM_ACCOUNT;
do_munmap(current->mm, addr, old_len, 0); if (addr > vma->vm_start) {
if (addr + old_len < vma->vm_end)
split = 1;
} else if (addr + old_len == vma->vm_end)
vma = NULL; /* it will be removed */
} else
vma = NULL; /* nothing more to do */
do_munmap(current->mm, addr, old_len);
/* Restore VM_ACCOUNT if one or two pieces of vma left */
if (vma) {
vma->vm_flags |= VM_ACCOUNT;
if (split)
vma->vm_next->vm_flags |= VM_ACCOUNT;
}
current->mm->total_vm += new_len >> PAGE_SHIFT; current->mm->total_vm += new_len >> PAGE_SHIFT;
if (new_vma->vm_flags & VM_LOCKED) { if (new_vma->vm_flags & VM_LOCKED) {
current->mm->locked_vm += new_len >> PAGE_SHIFT; current->mm->locked_vm += new_len >> PAGE_SHIFT;
...@@ -229,8 +245,6 @@ static inline unsigned long move_vma(struct vm_area_struct * vma, ...@@ -229,8 +245,6 @@ static inline unsigned long move_vma(struct vm_area_struct * vma,
return -ENOMEM; return -ENOMEM;
} }
extern int sysctl_overcommit_memory; /* FIXME!! */
/* /*
* Expand (or shrink) an existing mapping, potentially moving it at the * Expand (or shrink) an existing mapping, potentially moving it at the
* same time (controlled by the MREMAP_MAYMOVE flag and available VM space) * same time (controlled by the MREMAP_MAYMOVE flag and available VM space)
...@@ -274,7 +288,7 @@ unsigned long do_mremap(unsigned long addr, ...@@ -274,7 +288,7 @@ unsigned long do_mremap(unsigned long addr,
if ((addr <= new_addr) && (addr+old_len) > new_addr) if ((addr <= new_addr) && (addr+old_len) > new_addr)
goto out; goto out;
do_munmap(current->mm, new_addr, new_len, 1); do_munmap(current->mm, new_addr, new_len);
} }
/* /*
...@@ -284,9 +298,10 @@ unsigned long do_mremap(unsigned long addr, ...@@ -284,9 +298,10 @@ unsigned long do_mremap(unsigned long addr,
*/ */
ret = addr; ret = addr;
if (old_len >= new_len) { if (old_len >= new_len) {
do_munmap(current->mm, addr+new_len, old_len - new_len, 1); do_munmap(current->mm, addr+new_len, old_len - new_len);
if (!(flags & MREMAP_FIXED) || (new_addr == addr)) if (!(flags & MREMAP_FIXED) || (new_addr == addr))
goto out; goto out;
old_len = new_len;
} }
/* /*
...@@ -315,8 +330,6 @@ unsigned long do_mremap(unsigned long addr, ...@@ -315,8 +330,6 @@ unsigned long do_mremap(unsigned long addr,
> current->rlim[RLIMIT_AS].rlim_cur) > current->rlim[RLIMIT_AS].rlim_cur)
goto out; goto out;
if (sysctl_overcommit_memory > 1)
flags &= ~MAP_NORESERVE;
if (vma->vm_flags & VM_ACCOUNT) { if (vma->vm_flags & VM_ACCOUNT) {
charged = (new_len - old_len) >> PAGE_SHIFT; charged = (new_len - old_len) >> PAGE_SHIFT;
if (!vm_enough_memory(charged)) if (!vm_enough_memory(charged))
......
...@@ -37,6 +37,12 @@ ...@@ -37,6 +37,12 @@
#define TMPFS_MAGIC 0x01021994 #define TMPFS_MAGIC 0x01021994
#define ENTRIES_PER_PAGE (PAGE_CACHE_SIZE/sizeof(unsigned long)) #define ENTRIES_PER_PAGE (PAGE_CACHE_SIZE/sizeof(unsigned long))
#define BLOCKS_PER_PAGE (PAGE_CACHE_SIZE/512)
#define SHMEM_MAX_INDEX (SHMEM_NR_DIRECT + ENTRIES_PER_PAGE * (ENTRIES_PER_PAGE/2) * (ENTRIES_PER_PAGE+1))
#define SHMEM_MAX_BYTES ((unsigned long long)SHMEM_MAX_INDEX << PAGE_CACHE_SHIFT)
#define VM_ACCT(size) (((size) + PAGE_CACHE_SIZE - 1) >> PAGE_SHIFT)
static inline struct shmem_sb_info *SHMEM_SB(struct super_block *sb) static inline struct shmem_sb_info *SHMEM_SB(struct super_block *sb)
{ {
...@@ -56,8 +62,6 @@ atomic_t shmem_nrpages = ATOMIC_INIT(0); /* Not used right now */ ...@@ -56,8 +62,6 @@ atomic_t shmem_nrpages = ATOMIC_INIT(0); /* Not used right now */
static struct page *shmem_getpage_locked(struct shmem_inode_info *, struct inode *, unsigned long); static struct page *shmem_getpage_locked(struct shmem_inode_info *, struct inode *, unsigned long);
#define BLOCKS_PER_PAGE (PAGE_CACHE_SIZE/512)
/* /*
* shmem_recalc_inode - recalculate the size of an inode * shmem_recalc_inode - recalculate the size of an inode
* *
...@@ -133,9 +137,6 @@ static void shmem_recalc_inode(struct inode * inode) ...@@ -133,9 +137,6 @@ static void shmem_recalc_inode(struct inode * inode)
* +-> 48-51 * +-> 48-51
* +-> 52-55 * +-> 52-55
*/ */
#define SHMEM_MAX_BLOCKS (SHMEM_NR_DIRECT + ENTRIES_PER_PAGE * ENTRIES_PER_PAGE/2*(ENTRIES_PER_PAGE+1))
static swp_entry_t * shmem_swp_entry (struct shmem_inode_info *info, unsigned long index, unsigned long page) static swp_entry_t * shmem_swp_entry (struct shmem_inode_info *info, unsigned long index, unsigned long page)
{ {
unsigned long offset; unsigned long offset;
...@@ -188,7 +189,7 @@ static inline swp_entry_t * shmem_alloc_entry (struct shmem_inode_info *info, un ...@@ -188,7 +189,7 @@ static inline swp_entry_t * shmem_alloc_entry (struct shmem_inode_info *info, un
unsigned long page = 0; unsigned long page = 0;
swp_entry_t * res; swp_entry_t * res;
if (index >= SHMEM_MAX_BLOCKS) if (index >= SHMEM_MAX_INDEX)
return ERR_PTR(-EFBIG); return ERR_PTR(-EFBIG);
if (info->next_index <= index) if (info->next_index <= index)
...@@ -363,18 +364,16 @@ static void shmem_truncate (struct inode * inode) ...@@ -363,18 +364,16 @@ static void shmem_truncate (struct inode * inode)
static int shmem_notify_change(struct dentry * dentry, struct iattr *attr) static int shmem_notify_change(struct dentry * dentry, struct iattr *attr)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
long change = 0;
int error; int error;
if (attr->ia_valid & ATTR_SIZE) { if ((attr->ia_valid & ATTR_SIZE) && (attr->ia_size <= SHMEM_MAX_BYTES)) {
/* /*
* Account swap file usage based on new file size * Account swap file usage based on new file size,
* but just let vmtruncate fail on out-of-range sizes.
*/ */
long change; change = VM_ACCT(attr->ia_size) - VM_ACCT(inode->i_size);
if (change > 0) {
change = ((attr->ia_size + PAGE_SIZE - 1) >> PAGE_SHIFT) -
((inode->i_size + PAGE_SIZE - 1 ) >> PAGE_SHIFT);
if (attr->ia_size > inode->i_size) {
if (!vm_enough_memory(change)) if (!vm_enough_memory(change))
return -ENOMEM; return -ENOMEM;
} else } else
...@@ -384,7 +383,8 @@ static int shmem_notify_change(struct dentry * dentry, struct iattr *attr) ...@@ -384,7 +383,8 @@ static int shmem_notify_change(struct dentry * dentry, struct iattr *attr)
error = inode_change_ok(inode, attr); error = inode_change_ok(inode, attr);
if (!error) if (!error)
error = inode_setattr(inode, attr); error = inode_setattr(inode, attr);
if (error)
vm_unacct_memory(change);
return error; return error;
} }
...@@ -392,14 +392,15 @@ static int shmem_notify_change(struct dentry * dentry, struct iattr *attr) ...@@ -392,14 +392,15 @@ static int shmem_notify_change(struct dentry * dentry, struct iattr *attr)
static void shmem_delete_inode(struct inode * inode) static void shmem_delete_inode(struct inode * inode)
{ {
struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
struct shmem_inode_info *info = SHMEM_I(inode);
vm_unacct_memory((inode->i_size) >> PAGE_SHIFT); if (inode->i_op->truncate == shmem_truncate) {
spin_lock(&shmem_ilock);
inode->i_size = 0; list_del(&info->list);
if (inode->i_op->truncate == shmem_truncate){ spin_unlock(&shmem_ilock);
spin_lock (&shmem_ilock); if (info->flags & VM_ACCOUNT)
list_del (&SHMEM_I(inode)->list); vm_unacct_memory(VM_ACCT(inode->i_size));
spin_unlock (&shmem_ilock); inode->i_size = 0;
shmem_truncate (inode); shmem_truncate (inode);
} }
spin_lock (&sbinfo->stat_lock); spin_lock (&sbinfo->stat_lock);
...@@ -527,7 +528,7 @@ static int shmem_writepage(struct page * page) ...@@ -527,7 +528,7 @@ static int shmem_writepage(struct page * page)
index = page->index; index = page->index;
inode = mapping->host; inode = mapping->host;
info = SHMEM_I(inode); info = SHMEM_I(inode);
if (info->locked) if (info->flags & VM_LOCKED)
return fail_writepage(page); return fail_writepage(page);
swap = get_swap_page(); swap = get_swap_page();
if (!swap.val) if (!swap.val)
...@@ -744,9 +745,12 @@ void shmem_lock(struct file * file, int lock) ...@@ -744,9 +745,12 @@ void shmem_lock(struct file * file, int lock)
struct inode * inode = file->f_dentry->d_inode; struct inode * inode = file->f_dentry->d_inode;
struct shmem_inode_info * info = SHMEM_I(inode); struct shmem_inode_info * info = SHMEM_I(inode);
down(&info->sem); spin_lock(&info->lock);
info->locked = lock; if (lock)
up(&info->sem); info->flags |= VM_LOCKED;
else
info->flags &= ~VM_LOCKED;
spin_unlock(&info->lock);
} }
static int shmem_mmap(struct file * file, struct vm_area_struct * vma) static int shmem_mmap(struct file * file, struct vm_area_struct * vma)
...@@ -793,7 +797,7 @@ struct inode *shmem_get_inode(struct super_block *sb, int mode, int dev) ...@@ -793,7 +797,7 @@ struct inode *shmem_get_inode(struct super_block *sb, int mode, int dev)
memset (info->i_direct, 0, sizeof(info->i_direct)); memset (info->i_direct, 0, sizeof(info->i_direct));
info->i_indirect = NULL; info->i_indirect = NULL;
info->swapped = 0; info->swapped = 0;
info->locked = 0; info->flags = VM_ACCOUNT;
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
default: default:
init_special_inode(inode, mode, dev); init_special_inode(inode, mode, dev);
...@@ -886,7 +890,9 @@ shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos) ...@@ -886,7 +890,9 @@ shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
maxpos = inode->i_size; maxpos = inode->i_size;
if (pos + count > inode->i_size) { if (pos + count > inode->i_size) {
maxpos = pos + count; maxpos = pos + count;
if (!vm_enough_memory((maxpos - inode->i_size) >> PAGE_SHIFT)) { if (maxpos > SHMEM_MAX_BYTES)
maxpos = SHMEM_MAX_BYTES;
if (!vm_enough_memory(VM_ACCT(maxpos) - VM_ACCT(inode->i_size))) {
err = -ENOMEM; err = -ENOMEM;
goto out_nc; goto out_nc;
} }
...@@ -983,7 +989,7 @@ shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos) ...@@ -983,7 +989,7 @@ shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
out: out:
/* Short writes give back address space */ /* Short writes give back address space */
if (inode->i_size != maxpos) if (inode->i_size != maxpos)
vm_unacct_memory((maxpos - inode->i_size) >> PAGE_SHIFT); vm_unacct_memory(VM_ACCT(maxpos) - VM_ACCT(inode->i_size));
out_nc: out_nc:
up(&inode->i_sem); up(&inode->i_sem);
return err; return err;
...@@ -1238,10 +1244,15 @@ static int shmem_symlink(struct inode * dir, struct dentry *dentry, const char * ...@@ -1238,10 +1244,15 @@ static int shmem_symlink(struct inode * dir, struct dentry *dentry, const char *
memcpy(info, symname, len); memcpy(info, symname, len);
inode->i_op = &shmem_symlink_inline_operations; inode->i_op = &shmem_symlink_inline_operations;
} else { } else {
if (!vm_enough_memory(VM_ACCT(1))) {
iput(inode);
return -ENOMEM;
}
down(&info->sem); down(&info->sem);
page = shmem_getpage_locked(info, inode, 0); page = shmem_getpage_locked(info, inode, 0);
if (IS_ERR(page)) { if (IS_ERR(page)) {
up(&info->sem); up(&info->sem);
vm_unacct_memory(VM_ACCT(1));
iput(inode); iput(inode);
return PTR_ERR(page); return PTR_ERR(page);
} }
...@@ -1430,7 +1441,7 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent) ...@@ -1430,7 +1441,7 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
sbinfo->free_blocks = blocks; sbinfo->free_blocks = blocks;
sbinfo->max_inodes = inodes; sbinfo->max_inodes = inodes;
sbinfo->free_inodes = inodes; sbinfo->free_inodes = inodes;
sb->s_maxbytes = (unsigned long long) SHMEM_MAX_BLOCKS << PAGE_CACHE_SHIFT; sb->s_maxbytes = SHMEM_MAX_BYTES;
sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize = PAGE_CACHE_SIZE;
sb->s_blocksize_bits = PAGE_CACHE_SHIFT; sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
sb->s_magic = TMPFS_MAGIC; sb->s_magic = TMPFS_MAGIC;
...@@ -1646,20 +1657,21 @@ module_exit(exit_shmem_fs) ...@@ -1646,20 +1657,21 @@ module_exit(exit_shmem_fs)
* @size: size to be set for the file * @size: size to be set for the file
* *
*/ */
struct file *shmem_file_setup(char * name, loff_t size) struct file *shmem_file_setup(char * name, loff_t size, unsigned long flags)
{ {
int error = -ENOMEM; int error;
struct file *file; struct file *file;
struct inode * inode; struct inode * inode;
struct dentry *dentry, *root; struct dentry *dentry, *root;
struct qstr this; struct qstr this;
if (size > (unsigned long long) SHMEM_MAX_BLOCKS << PAGE_CACHE_SHIFT) if (size > SHMEM_MAX_BYTES)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (!vm_enough_memory((size) >> PAGE_CACHE_SHIFT)) if ((flags & VM_ACCOUNT) && !vm_enough_memory(VM_ACCT(size)))
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
error = -ENOMEM;
this.name = name; this.name = name;
this.len = strlen(name); this.len = strlen(name);
this.hash = 0; /* will go */ this.hash = 0; /* will go */
...@@ -1678,14 +1690,14 @@ struct file *shmem_file_setup(char * name, loff_t size) ...@@ -1678,14 +1690,14 @@ struct file *shmem_file_setup(char * name, loff_t size)
if (!inode) if (!inode)
goto close_file; goto close_file;
SHMEM_I(inode)->flags &= flags;
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
dentry->d_inode->i_size = size; inode->i_size = size;
shmem_truncate(inode); inode->i_nlink = 0; /* It is unlinked */
file->f_vfsmnt = mntget(shm_mnt); file->f_vfsmnt = mntget(shm_mnt);
file->f_dentry = dentry; file->f_dentry = dentry;
file->f_op = &shmem_file_operations; file->f_op = &shmem_file_operations;
file->f_mode = FMODE_WRITE | FMODE_READ; file->f_mode = FMODE_WRITE | FMODE_READ;
inode->i_nlink = 0; /* It is unlinked */
return(file); return(file);
close_file: close_file:
...@@ -1693,9 +1705,11 @@ struct file *shmem_file_setup(char * name, loff_t size) ...@@ -1693,9 +1705,11 @@ struct file *shmem_file_setup(char * name, loff_t size)
put_dentry: put_dentry:
dput (dentry); dput (dentry);
put_memory: put_memory:
vm_unacct_memory((size) >> PAGE_CACHE_SHIFT); if (flags & VM_ACCOUNT)
vm_unacct_memory(VM_ACCT(size));
return ERR_PTR(error); return ERR_PTR(error);
} }
/* /*
* shmem_zero_setup - setup a shared anonymous mapping * shmem_zero_setup - setup a shared anonymous mapping
* *
...@@ -1706,7 +1720,7 @@ int shmem_zero_setup(struct vm_area_struct *vma) ...@@ -1706,7 +1720,7 @@ int shmem_zero_setup(struct vm_area_struct *vma)
struct file *file; struct file *file;
loff_t size = vma->vm_end - vma->vm_start; loff_t size = vma->vm_end - vma->vm_start;
file = shmem_file_setup("dev/zero", size); file = shmem_file_setup("dev/zero", size, vma->vm_flags);
if (IS_ERR(file)) if (IS_ERR(file))
return PTR_ERR(file); return PTR_ERR(file);
......
...@@ -1647,6 +1647,15 @@ void kfree (const void *objp) ...@@ -1647,6 +1647,15 @@ void kfree (const void *objp)
local_irq_restore(flags); local_irq_restore(flags);
} }
unsigned int kmem_cache_size(kmem_cache_t *cachep)
{
#if DEBUG
if (cachep->flags & SLAB_RED_ZONE)
return (cachep->objsize - 2*BYTES_PER_WORD);
#endif
return cachep->objsize;
}
kmem_cache_t * kmem_find_general_cachep (size_t size, int gfpflags) kmem_cache_t * kmem_find_general_cachep (size_t size, int gfpflags)
{ {
cache_sizes_t *csizep = cache_sizes; cache_sizes_t *csizep = cache_sizes;
......
...@@ -464,7 +464,7 @@ static int cap_file_mprotect (struct vm_area_struct *vma, unsigned long prot) ...@@ -464,7 +464,7 @@ static int cap_file_mprotect (struct vm_area_struct *vma, unsigned long prot)
return 0; return 0;
} }
static int cap_file_lock (struct file *file, unsigned int cmd, int blocking) static int cap_file_lock (struct file *file, unsigned int cmd)
{ {
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment