Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
ff2bdcb0
Commit
ff2bdcb0
authored
Jul 31, 2002
by
Paul Mackerras
Browse files
Options
Browse Files
Download
Plain Diff
Merge samba.org:/home/paulus/kernel/linux-2.5
into samba.org:/home/paulus/kernel/for-linus-ppc
parents
5b27e42c
6a1caddf
Changes
48
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
235 additions
and
197 deletions
+235
-197
Documentation/vm/overcommit-accounting
Documentation/vm/overcommit-accounting
+6
-8
arch/alpha/kernel/entry.S
arch/alpha/kernel/entry.S
+2
-2
arch/arm/kernel/calls.S
arch/arm/kernel/calls.S
+2
-2
arch/i386/kernel/entry.S
arch/i386/kernel/entry.S
+2
-2
arch/ia64/ia32/sys_ia32.c
arch/ia64/ia32/sys_ia32.c
+4
-4
arch/ia64/kernel/entry.S
arch/ia64/kernel/entry.S
+2
-2
arch/m68k/kernel/entry.S
arch/m68k/kernel/entry.S
+2
-2
arch/mips64/kernel/scall_64.S
arch/mips64/kernel/scall_64.S
+2
-2
arch/ppc/kernel/misc.S
arch/ppc/kernel/misc.S
+2
-2
arch/ppc64/kernel/misc.S
arch/ppc64/kernel/misc.S
+2
-2
arch/s390/kernel/entry.S
arch/s390/kernel/entry.S
+2
-2
arch/s390x/kernel/linux32.c
arch/s390x/kernel/linux32.c
+4
-4
arch/sparc/kernel/systbls.S
arch/sparc/kernel/systbls.S
+1
-1
arch/sparc64/kernel/sys_sparc32.c
arch/sparc64/kernel/sys_sparc32.c
+4
-4
arch/sparc64/kernel/systbls.S
arch/sparc64/kernel/systbls.S
+1
-1
arch/x86_64/ia32/sys_ia32.c
arch/x86_64/ia32/sys_ia32.c
+4
-4
drivers/net/e1000/e1000_main.c
drivers/net/e1000/e1000_main.c
+1
-1
fs/read_write.c
fs/read_write.c
+8
-6
include/asm-alpha/unistd.h
include/asm-alpha/unistd.h
+2
-2
include/asm-arm/unistd.h
include/asm-arm/unistd.h
+2
-2
include/asm-cris/unistd.h
include/asm-cris/unistd.h
+2
-2
include/asm-i386/unistd.h
include/asm-i386/unistd.h
+2
-2
include/asm-ia64/unistd.h
include/asm-ia64/unistd.h
+2
-2
include/asm-m68k/unistd.h
include/asm-m68k/unistd.h
+2
-2
include/asm-mips/unistd.h
include/asm-mips/unistd.h
+2
-2
include/asm-mips64/unistd.h
include/asm-mips64/unistd.h
+2
-2
include/asm-parisc/unistd.h
include/asm-parisc/unistd.h
+2
-2
include/asm-ppc/unistd.h
include/asm-ppc/unistd.h
+2
-2
include/asm-ppc64/unistd.h
include/asm-ppc64/unistd.h
+2
-2
include/asm-s390/unistd.h
include/asm-s390/unistd.h
+2
-2
include/asm-s390x/unistd.h
include/asm-s390x/unistd.h
+2
-2
include/asm-sh/unistd.h
include/asm-sh/unistd.h
+2
-2
include/asm-sparc/unistd.h
include/asm-sparc/unistd.h
+2
-2
include/asm-sparc64/unistd.h
include/asm-sparc64/unistd.h
+2
-2
include/asm-x86_64/unistd.h
include/asm-x86_64/unistd.h
+4
-4
include/linux/mm.h
include/linux/mm.h
+2
-2
include/linux/shmem_fs.h
include/linux/shmem_fs.h
+1
-1
include/linux/slab.h
include/linux/slab.h
+1
-0
ipc/shm.c
ipc/shm.c
+2
-2
kernel/fork.c
kernel/fork.c
+0
-5
kernel/ksyms.c
kernel/ksyms.c
+1
-0
mm/memory.c
mm/memory.c
+8
-11
mm/mmap.c
mm/mmap.c
+29
-28
mm/mprotect.c
mm/mprotect.c
+17
-10
mm/mremap.c
mm/mremap.c
+24
-11
mm/shmem.c
mm/shmem.c
+53
-39
mm/slab.c
mm/slab.c
+9
-0
security/capability.c
security/capability.c
+1
-1
No files found.
Documentation/vm/overcommit-accounting
View file @
ff2bdcb0
...
...
@@ -37,13 +37,13 @@ How It Works
The overcommit is based on the following rules
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 a direct map
SHARED or READ only - size of mapping
PRIVATE WRITEABLE - size of mapping per instance
For an anonymous or /dev/zero map
SHARED - size of mapping
PRIVATE READ-only - 0 cost (but of little use)
PRIVATE WRITABLE - size of mapping per instance
Additional accounting
Pages made writable copies by mmap
...
...
@@ -66,5 +66,3 @@ o Implement actual limit enforcement
To Do
-----
o Account ptrace pages (this is hard)
o Account for shared anonymous mappings properly
- right now we account them per instance
arch/alpha/kernel/entry.S
View file @
ff2bdcb0
...
...
@@ -1081,8 +1081,8 @@ sys_call_table:
.
quad
sys_pciconfig_write
.
quad
sys_query_module
.
quad
sys_prctl
.
quad
sys_pread
.
quad
sys_pwrite
/*
350
*/
.
quad
sys_pread
64
.
quad
sys_pwrite
64
/*
350
*/
.
quad
sys_rt_sigreturn
.
quad
sys_rt_sigaction
.
quad
sys_rt_sigprocmask
...
...
arch/arm/kernel/calls.S
View file @
ff2bdcb0
...
...
@@ -194,8 +194,8 @@ __syscall_start:
.
long
sys_rt_sigtimedwait
.
long
sys_rt_sigqueueinfo
.
long
sys_rt_sigsuspend_wrapper
/*
180
*/
.
long
sys_pread
.
long
sys_pwrite
/*
180
*/
.
long
sys_pread
64
.
long
sys_pwrite
64
.
long
sys_chown16
.
long
sys_getcwd
.
long
sys_capget
...
...
arch/i386/kernel/entry.S
View file @
ff2bdcb0
...
...
@@ -689,8 +689,8 @@ ENTRY(sys_call_table)
.
long
sys_rt_sigtimedwait
.
long
sys_rt_sigqueueinfo
.
long
sys_rt_sigsuspend
.
long
sys_pread
/*
180
*/
.
long
sys_pwrite
.
long
sys_pread
64
/*
180
*/
.
long
sys_pwrite
64
.
long
sys_chown16
.
long
sys_getcwd
.
long
sys_capget
...
...
arch/ia64/ia32/sys_ia32.c
View file @
ff2bdcb0
...
...
@@ -3648,15 +3648,15 @@ sys32_sched_rr_get_interval (pid_t pid, struct timespec32 *interval)
asmlinkage
long
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
);
return
sys_pread
(
fd
,
buf
,
count
,
((
unsigned
long
)
pos_hi
<<
32
)
|
pos_lo
);
extern
asmlinkage
long
sys_pread
64
(
unsigned
int
,
char
*
,
size_t
,
loff_t
);
return
sys_pread
64
(
fd
,
buf
,
count
,
((
unsigned
long
)
pos_hi
<<
32
)
|
pos_lo
);
}
asmlinkage
long
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
);
return
sys_pwrite
(
fd
,
buf
,
count
,
((
unsigned
long
)
pos_hi
<<
32
)
|
pos_lo
);
extern
asmlinkage
long
sys_pwrite
64
(
unsigned
int
,
const
char
*
,
size_t
,
loff_t
);
return
sys_pwrite
64
(
fd
,
buf
,
count
,
((
unsigned
long
)
pos_hi
<<
32
)
|
pos_lo
);
}
asmlinkage
long
...
...
arch/ia64/kernel/entry.S
View file @
ff2bdcb0
...
...
@@ -1134,8 +1134,8 @@ sys_call_table:
data8
sys_flock
//
1145
data8
sys_readv
data8
sys_writev
data8
sys_pread
data8
sys_pwrite
data8
sys_pread
64
data8
sys_pwrite
64
data8
sys_sysctl
//
1150
data8
sys_mmap
data8
sys_munmap
...
...
arch/m68k/kernel/entry.S
View file @
ff2bdcb0
...
...
@@ -608,8 +608,8 @@ sys_call_table:
.
long
sys_rt_sigtimedwait
.
long
sys_rt_sigqueueinfo
.
long
sys_rt_sigsuspend
.
long
sys_pread
/*
180
*/
.
long
sys_pwrite
.
long
sys_pread
64
/*
180
*/
.
long
sys_pwrite
64
.
long
sys_lchown16
;
.
long
sys_getcwd
.
long
sys_capget
...
...
arch/mips64/kernel/scall_64.S
View file @
ff2bdcb0
...
...
@@ -333,8 +333,8 @@ sys_call_table:
PTR
sys_rt_sigtimedwait
PTR
sys_rt_sigqueueinfo
PTR
sys_rt_sigsuspend
PTR
sys_pread
/*
5200
*/
PTR
sys_pwrite
PTR
sys_pread
64
/*
5200
*/
PTR
sys_pwrite
64
PTR
sys_chown
PTR
sys_getcwd
PTR
sys_capget
...
...
arch/ppc/kernel/misc.S
View file @
ff2bdcb0
...
...
@@ -1251,8 +1251,8 @@ _GLOBAL(sys_call_table)
.
long
sys_rt_sigtimedwait
.
long
sys_rt_sigqueueinfo
.
long
ppc_rt_sigsuspend
.
long
sys_pread
.
long
sys_pwrite
/*
180
*/
.
long
sys_pread
64
.
long
sys_pwrite
64
/*
180
*/
.
long
sys_chown
.
long
sys_getcwd
.
long
sys_capget
...
...
arch/ppc64/kernel/misc.S
View file @
ff2bdcb0
...
...
@@ -916,8 +916,8 @@ _GLOBAL(sys_call_table)
.
llong
.
sys_rt_sigtimedwait
.
llong
.
sys_rt_sigqueueinfo
.
llong
.
sys_rt_sigsuspend
.
llong
.
sys_pread
.
llong
.
sys_pwrite
/*
180
*/
.
llong
.
sys_pread
64
.
llong
.
sys_pwrite
64
/*
180
*/
.
llong
.
sys_chown
.
llong
.
sys_getcwd
.
llong
.
sys_capget
...
...
arch/s390/kernel/entry.S
View file @
ff2bdcb0
...
...
@@ -520,8 +520,8 @@ sys_call_table:
.
long
sys_rt_sigtimedwait
.
long
sys_rt_sigqueueinfo
.
long
sys_rt_sigsuspend_glue
.
long
sys_pread
/*
180
*/
.
long
sys_pwrite
.
long
sys_pread
64
/*
180
*/
.
long
sys_pwrite
64
.
long
sys_chown16
.
long
sys_getcwd
.
long
sys_capget
...
...
arch/s390x/kernel/linux32.c
View file @
ff2bdcb0
...
...
@@ -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_pread
64
(
unsigned
int
fd
,
char
*
buf
,
size_t
count
,
loff_t
pos
);
extern
asmlinkage
ssize_t
sys_pwrite
(
unsigned
int
fd
,
const
char
*
buf
,
extern
asmlinkage
ssize_t
sys_pwrite
64
(
unsigned
int
fd
,
const
char
*
buf
,
size_t
count
,
loff_t
pos
);
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
,
__kernel_size_t32
count
,
u32
poshi
,
u32
poslo
)
{
return
sys_pread
(
fd
,
ubuf
,
count
,
((
loff_t
)
AA
(
poshi
)
<<
32
)
|
AA
(
poslo
));
return
sys_pread
64
(
fd
,
ubuf
,
count
,
((
loff_t
)
AA
(
poshi
)
<<
32
)
|
AA
(
poslo
));
}
asmlinkage
ssize_t32
sys32_pwrite
(
unsigned
int
fd
,
char
*
ubuf
,
__kernel_size_t32
count
,
u32
poshi
,
u32
poslo
)
{
return
sys_pwrite
(
fd
,
ubuf
,
count
,
((
loff_t
)
AA
(
poshi
)
<<
32
)
|
AA
(
poslo
));
return
sys_pwrite
64
(
fd
,
ubuf
,
count
,
((
loff_t
)
AA
(
poshi
)
<<
32
)
|
AA
(
poslo
));
}
extern
asmlinkage
ssize_t
sys_readahead
(
int
fd
,
loff_t
offset
,
size_t
count
);
...
...
arch/sparc/kernel/systbls.S
View file @
ff2bdcb0
...
...
@@ -31,7 +31,7 @@ sys_call_table:
/*
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
/*
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_pread
64
,
sys_pwrite64
,
sys_geteuid
/*
70
*/
.
long
sys_getegid
,
sys_mmap
,
sys_setreuid
,
sys_munmap
,
sys_mprotect
/*
75
*/
.
long
sys_madvise
,
sys_vhangup
,
sys_truncate64
,
sys_mincore
,
sys_getgroups16
/*
80
*/
.
long
sys_setgroups16
,
sys_getpgrp
,
sys_setgroups
,
sys_setitimer
,
sys_ftruncate64
...
...
arch/sparc64/kernel/sys_sparc32.c
View file @
ff2bdcb0
...
...
@@ -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_pread
64
(
unsigned
int
fd
,
char
*
buf
,
size_t
count
,
loff_t
pos
);
extern
asmlinkage
ssize_t
sys_pwrite
(
unsigned
int
fd
,
const
char
*
buf
,
extern
asmlinkage
ssize_t
sys_pwrite
64
(
unsigned
int
fd
,
const
char
*
buf
,
size_t
count
,
loff_t
pos
);
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
,
__kernel_size_t32
count
,
u32
poshi
,
u32
poslo
)
{
return
sys_pread
(
fd
,
ubuf
,
count
,
((
loff_t
)
AA
(
poshi
)
<<
32
)
|
AA
(
poslo
));
return
sys_pread
64
(
fd
,
ubuf
,
count
,
((
loff_t
)
AA
(
poshi
)
<<
32
)
|
AA
(
poslo
));
}
asmlinkage
ssize_t32
sys32_pwrite
(
unsigned
int
fd
,
char
*
ubuf
,
__kernel_size_t32
count
,
u32
poshi
,
u32
poslo
)
{
return
sys_pwrite
(
fd
,
ubuf
,
count
,
((
loff_t
)
AA
(
poshi
)
<<
32
)
|
AA
(
poslo
));
return
sys_pwrite
64
(
fd
,
ubuf
,
count
,
((
loff_t
)
AA
(
poshi
)
<<
32
)
|
AA
(
poslo
));
}
extern
asmlinkage
ssize_t
sys_readahead
(
int
fd
,
loff_t
offset
,
size_t
count
);
...
...
arch/sparc64/kernel/systbls.S
View file @
ff2bdcb0
...
...
@@ -32,7 +32,7 @@ sys_call_table32:
/*
50
*/
.
word
sys32_getegid16
,
sys_acct
,
sys_nis_syscall
,
sys_getgid
,
sys32_ioctl
.
word
sys_reboot
,
sys32_mmap2
,
sys_symlink
,
sys_readlink
,
sys32_execve
/*
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_pread
64
,
sys32_pwrite64
,
sys_geteuid
/*
70
*/
.
word
sys_getegid
,
sys32_mmap
,
sys_setreuid
,
sys_munmap
,
sys_mprotect
.
word
sys_madvise
,
sys_vhangup
,
sys32_truncate64
,
sys_mincore
,
sys32_getgroups16
/*
80
*/
.
word
sys32_setgroups16
,
sys_getpgrp
,
sys_setgroups
,
sys32_setitimer
,
sys32_ftruncate64
...
...
arch/x86_64/ia32/sys_ia32.c
View file @
ff2bdcb0
...
...
@@ -1948,10 +1948,10 @@ sys32_newuname(struct new_utsname * name)
return
ret
;
}
extern
asmlinkage
ssize_t
sys_pread
(
unsigned
int
fd
,
char
*
buf
,
extern
asmlinkage
ssize_t
sys_pread
64
(
unsigned
int
fd
,
char
*
buf
,
size_t
count
,
loff_t
pos
);
extern
asmlinkage
ssize_t
sys_pwrite
(
unsigned
int
fd
,
const
char
*
buf
,
extern
asmlinkage
ssize_t
sys_pwrite
64
(
unsigned
int
fd
,
const
char
*
buf
,
size_t
count
,
loff_t
pos
);
typedef
__kernel_ssize_t32
ssize_t32
;
...
...
@@ -1961,7 +1961,7 @@ asmlinkage ssize_t32
sys32_pread
(
unsigned
int
fd
,
char
*
ubuf
,
__kernel_size_t32
count
,
u32
poslo
,
u32
poshi
)
{
return
sys_pread
(
fd
,
ubuf
,
count
,
return
sys_pread
64
(
fd
,
ubuf
,
count
,
((
loff_t
)
AA
(
poshi
)
<<
32
)
|
AA
(
poslo
));
}
...
...
@@ -1969,7 +1969,7 @@ asmlinkage ssize_t32
sys32_pwrite
(
unsigned
int
fd
,
char
*
ubuf
,
__kernel_size_t32
count
,
u32
poslo
,
u32
poshi
)
{
return
sys_pwrite
(
fd
,
ubuf
,
count
,
return
sys_pwrite
64
(
fd
,
ubuf
,
count
,
((
loff_t
)
AA
(
poshi
)
<<
32
)
|
AA
(
poslo
));
}
...
...
drivers/net/e1000/e1000_main.c
View file @
ff2bdcb0
...
...
@@ -1699,7 +1699,7 @@ e1000_irq_disable(struct e1000_adapter *adapter)
{
atomic_inc
(
&
adapter
->
irq_sem
);
E1000_WRITE_REG
(
&
adapter
->
hw
,
IMC
,
~
0
);
synchronize_irq
();
synchronize_irq
(
adapter
->
netdev
->
irq
);
}
/**
...
...
fs/read_write.c
View file @
ff2bdcb0
...
...
@@ -185,8 +185,6 @@ ssize_t vfs_read(struct file *file, char *buf, size_t count, loff_t *pos)
return
-
EBADF
;
if
(
!
file
->
f_op
||
!
file
->
f_op
->
read
)
return
-
EINVAL
;
if
(
pos
<
0
)
return
-
EINVAL
;
ret
=
locks_verify_area
(
FLOCK_VERIFY_READ
,
inode
,
file
,
*
pos
,
count
);
if
(
!
ret
)
{
...
...
@@ -210,8 +208,6 @@ ssize_t vfs_write(struct file *file, const char *buf, size_t count, loff_t *pos)
return
-
EBADF
;
if
(
!
file
->
f_op
||
!
file
->
f_op
->
write
)
return
-
EINVAL
;
if
(
pos
<
0
)
return
-
EINVAL
;
ret
=
locks_verify_area
(
FLOCK_VERIFY_WRITE
,
inode
,
file
,
*
pos
,
count
);
if
(
!
ret
)
{
...
...
@@ -254,12 +250,15 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count)
return
ret
;
}
asmlinkage
ssize_t
sys_pread
(
unsigned
int
fd
,
char
*
buf
,
asmlinkage
ssize_t
sys_pread
64
(
unsigned
int
fd
,
char
*
buf
,
size_t
count
,
loff_t
pos
)
{
struct
file
*
file
;
ssize_t
ret
=
-
EBADF
;
if
(
pos
<
0
)
return
-
EINVAL
;
file
=
fget
(
fd
);
if
(
file
)
{
ret
=
vfs_read
(
file
,
buf
,
count
,
&
pos
);
...
...
@@ -269,12 +268,15 @@ asmlinkage ssize_t sys_pread(unsigned int fd, char *buf,
return
ret
;
}
asmlinkage
ssize_t
sys_pwrite
(
unsigned
int
fd
,
const
char
*
buf
,
asmlinkage
ssize_t
sys_pwrite
64
(
unsigned
int
fd
,
const
char
*
buf
,
size_t
count
,
loff_t
pos
)
{
struct
file
*
file
;
ssize_t
ret
=
-
EBADF
;
if
(
pos
<
0
)
return
-
EINVAL
;
file
=
fget
(
fd
);
if
(
file
)
{
ret
=
vfs_write
(
file
,
buf
,
count
,
&
pos
);
...
...
include/asm-alpha/unistd.h
View file @
ff2bdcb0
...
...
@@ -286,8 +286,8 @@
#define __NR_pciconfig_write 346
#define __NR_query_module 347
#define __NR_prctl 348
#define __NR_pread 349
#define __NR_pwrite 350
#define __NR_pread
64
349
#define __NR_pwrite
64
350
#define __NR_rt_sigreturn 351
#define __NR_rt_sigaction 352
#define __NR_rt_sigprocmask 353
...
...
include/asm-arm/unistd.h
View file @
ff2bdcb0
...
...
@@ -200,8 +200,8 @@
#define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE+177)
#define __NR_rt_sigqueueinfo (__NR_SYSCALL_BASE+178)
#define __NR_rt_sigsuspend (__NR_SYSCALL_BASE+179)
#define __NR_pread (__NR_SYSCALL_BASE+180)
#define __NR_pwrite (__NR_SYSCALL_BASE+181)
#define __NR_pread
64
(__NR_SYSCALL_BASE+180)
#define __NR_pwrite
64
(__NR_SYSCALL_BASE+181)
#define __NR_chown (__NR_SYSCALL_BASE+182)
#define __NR_getcwd (__NR_SYSCALL_BASE+183)
#define __NR_capget (__NR_SYSCALL_BASE+184)
...
...
include/asm-cris/unistd.h
View file @
ff2bdcb0
...
...
@@ -185,8 +185,8 @@
#define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179
#define __NR_pread 180
#define __NR_pwrite 181
#define __NR_pread
64
180
#define __NR_pwrite
64
181
#define __NR_chown 182
#define __NR_getcwd 183
#define __NR_capget 184
...
...
include/asm-i386/unistd.h
View file @
ff2bdcb0
...
...
@@ -184,8 +184,8 @@
#define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179
#define __NR_pread 180
#define __NR_pwrite 181
#define __NR_pread
64
180
#define __NR_pwrite
64
181
#define __NR_chown 182
#define __NR_getcwd 183
#define __NR_capget 184
...
...
include/asm-ia64/unistd.h
View file @
ff2bdcb0
...
...
@@ -137,8 +137,8 @@
#define __NR_flock 1145
#define __NR_readv 1146
#define __NR_writev 1147
#define __NR_pread 1148
#define __NR_pwrite 1149
#define __NR_pread
64
1148
#define __NR_pwrite
64
1149
#define __NR__sysctl 1150
#define __NR_mmap 1151
#define __NR_munmap 1152
...
...
include/asm-m68k/unistd.h
View file @
ff2bdcb0
...
...
@@ -184,8 +184,8 @@
#define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179
#define __NR_pread 180
#define __NR_pwrite 181
#define __NR_pread
64
180
#define __NR_pwrite
64
181
#define __NR_lchown 182
#define __NR_getcwd 183
#define __NR_capget 184
...
...
include/asm-mips/unistd.h
View file @
ff2bdcb0
...
...
@@ -212,8 +212,8 @@
#define __NR_rt_sigtimedwait (__NR_Linux + 197)
#define __NR_rt_sigqueueinfo (__NR_Linux + 198)
#define __NR_rt_sigsuspend (__NR_Linux + 199)
#define __NR_pread (__NR_Linux + 200)
#define __NR_pwrite (__NR_Linux + 201)
#define __NR_pread
64
(__NR_Linux + 200)
#define __NR_pwrite
64
(__NR_Linux + 201)
#define __NR_chown (__NR_Linux + 202)
#define __NR_getcwd (__NR_Linux + 203)
#define __NR_capget (__NR_Linux + 204)
...
...
include/asm-mips64/unistd.h
View file @
ff2bdcb0
...
...
@@ -447,8 +447,8 @@
#define __NR_rt_sigtimedwait (__NR_Linux + 197)
#define __NR_rt_sigqueueinfo (__NR_Linux + 198)
#define __NR_rt_sigsuspend (__NR_Linux + 199)
#define __NR_pread (__NR_Linux + 200)
#define __NR_pwrite (__NR_Linux + 201)
#define __NR_pread
64
(__NR_Linux + 200)
#define __NR_pwrite
64
(__NR_Linux + 201)
#define __NR_chown (__NR_Linux + 202)
#define __NR_getcwd (__NR_Linux + 203)
#define __NR_capget (__NR_Linux + 204)
...
...
include/asm-parisc/unistd.h
View file @
ff2bdcb0
...
...
@@ -598,8 +598,8 @@
#define __NR_getitimer (__NR_Linux + 105)
#define __NR_capget (__NR_Linux + 106)
#define __NR_capset (__NR_Linux + 107)
#define __NR_pread
(__NR_Linux + 108)
#define __NR_pwrite
(__NR_Linux + 109)
#define __NR_pread
64
(__NR_Linux + 108)
#define __NR_pwrite
64
(__NR_Linux + 109)
#define __NR_getcwd (__NR_Linux + 110)
#define __NR_vhangup (__NR_Linux + 111)
#define __NR_idle (__NR_Linux + 112)
...
...
include/asm-ppc/unistd.h
View file @
ff2bdcb0
...
...
@@ -186,8 +186,8 @@
#define __NR_rt_sigtimedwait 176
#define __NR_rt_sigqueueinfo 177
#define __NR_rt_sigsuspend 178
#define __NR_pread 179
#define __NR_pwrite 180
#define __NR_pread
64
179
#define __NR_pwrite
64
180
#define __NR_chown 181
#define __NR_getcwd 182
#define __NR_capget 183
...
...
include/asm-ppc64/unistd.h
View file @
ff2bdcb0
...
...
@@ -188,8 +188,8 @@
#define __NR_rt_sigtimedwait 176
#define __NR_rt_sigqueueinfo 177
#define __NR_rt_sigsuspend 178
#define __NR_pread 179
#define __NR_pwrite 180
#define __NR_pread
64
179
#define __NR_pwrite
64
180
#define __NR_chown 181
#define __NR_getcwd 182
#define __NR_capget 183
...
...
include/asm-s390/unistd.h
View file @
ff2bdcb0
...
...
@@ -170,8 +170,8 @@
#define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179
#define __NR_pread
180
#define __NR_pwrite
181
#define __NR_pread
64
180
#define __NR_pwrite
64
181
#define __NR_chown 182
#define __NR_getcwd 183
#define __NR_capget 184
...
...
include/asm-s390x/unistd.h
View file @
ff2bdcb0
...
...
@@ -147,8 +147,8 @@
#define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179
#define __NR_pread
180
#define __NR_pwrite
181
#define __NR_pread
64
180
#define __NR_pwrite
64
181
#define __NR_getcwd 183
#define __NR_capget 184
#define __NR_capset 185
...
...
include/asm-sh/unistd.h
View file @
ff2bdcb0
...
...
@@ -189,8 +189,8 @@
#define __NR_rt_sigtimedwait 177
#define __NR_rt_sigqueueinfo 178
#define __NR_rt_sigsuspend 179
#define __NR_pread 180
#define __NR_pwrite 181
#define __NR_pread
64
180
#define __NR_pwrite
64
181
#define __NR_chown 182
#define __NR_getcwd 183
#define __NR_capget 184
...
...
include/asm-sparc/unistd.h
View file @
ff2bdcb0
...
...
@@ -82,8 +82,8 @@
#define __NR_getpagesize 64
/* Common */
#define __NR_msync 65
/* Common in newer 1.3.x revs... */
#define __NR_vfork 66
/* Common */
#define __NR_pread
67
/* Linux Specific */
#define __NR_pwrite
68
/* Linux Specific */
#define __NR_pread
64
67
/* Linux Specific */
#define __NR_pwrite
64
68
/* Linux Specific */
#define __NR_geteuid32 69
/* Linux sparc32, sbrk under SunOS */
#define __NR_getegid32 70
/* Linux sparc32, sstk under SunOS */
#define __NR_mmap 71
/* Common */
...
...
include/asm-sparc64/unistd.h
View file @
ff2bdcb0
...
...
@@ -82,8 +82,8 @@
#define __NR_getpagesize 64
/* Common */
#define __NR_msync 65
/* Common in newer 1.3.x revs... */
#define __NR_vfork 66
/* Common */
#define __NR_pread
67
/* Linux Specific */
#define __NR_pwrite
68
/* Linux Specific */
#define __NR_pread
64
67
/* Linux Specific */
#define __NR_pwrite
64
68
/* Linux Specific */
/* #define __NR_geteuid32 69 Linux sparc32, sbrk under SunOS */
/* #define __NR_getegid32 70 Linux sparc32, sstk under SunOS */
#define __NR_mmap 71
/* Common */
...
...
include/asm-x86_64/unistd.h
View file @
ff2bdcb0
...
...
@@ -48,10 +48,10 @@ __SYSCALL(__NR_rt_sigreturn, stub_rt_sigreturn)
#define __NR_ioctl 16
__SYSCALL
(
__NR_ioctl
,
sys_ioctl
)
#define __NR_pread
17
__SYSCALL
(
__NR_pread
,
sys_pread
)
#define __NR_pwrite
18
__SYSCALL
(
__NR_pwrite
,
sys_pwrite
)
#define __NR_pread
64
17
__SYSCALL
(
__NR_pread
64
,
sys_pread64
)
#define __NR_pwrite
64
18
__SYSCALL
(
__NR_pwrite
64
,
sys_pwrite64
)
#define __NR_readv 19
__SYSCALL
(
__NR_readv
,
sys_readv
)
#define __NR_writev 20
...
...
include/linux/mm.h
View file @
ff2bdcb0
...
...
@@ -331,7 +331,7 @@ extern void show_free_areas(void);
extern
int
fail_writepage
(
struct
page
*
);
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
int
shmem_zero_setup
(
struct
vm_area_struct
*
);
...
...
@@ -430,7 +430,7 @@ static inline unsigned long do_mmap(struct file *file, unsigned long addr,
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
);
...
...
include/linux/shmem_fs.h
View file @
ff2bdcb0
...
...
@@ -16,7 +16,7 @@ struct shmem_inode_info {
swp_entry_t
i_direct
[
SHMEM_NR_DIRECT
];
/* for the first blocks */
void
**
i_indirect
;
/* indirect blocks */
unsigned
long
swapped
;
int
locked
;
/* into memory */
unsigned
long
flags
;
struct
list_head
list
;
struct
inode
vfs_inode
;
};
...
...
include/linux/slab.h
View file @
ff2bdcb0
...
...
@@ -57,6 +57,7 @@ extern int kmem_cache_destroy(kmem_cache_t *);
extern
int
kmem_cache_shrink
(
kmem_cache_t
*
);
extern
void
*
kmem_cache_alloc
(
kmem_cache_t
*
,
int
);
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
kfree
(
const
void
*
);
...
...
ipc/shm.c
View file @
ff2bdcb0
...
...
@@ -186,7 +186,7 @@ static int newseg (key_t key, int shmflg, size_t size)
shp
->
shm_flags
=
(
shmflg
&
S_IRWXUGO
);
sprintf
(
name
,
"SYSV%08x"
,
key
);
file
=
shmem_file_setup
(
name
,
size
);
file
=
shmem_file_setup
(
name
,
size
,
VM_ACCOUNT
);
error
=
PTR_ERR
(
file
);
if
(
IS_ERR
(
file
))
goto
no_file
;
...
...
@@ -671,7 +671,7 @@ asmlinkage long sys_shmdt (char *shmaddr)
shmdnext
=
shmd
->
vm_next
;
if
(
shmd
->
vm_ops
==
&
shm_vm_ops
&&
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
;
}
}
...
...
kernel/fork.c
View file @
ff2bdcb0
...
...
@@ -210,17 +210,12 @@ static inline int dup_mmap(struct mm_struct * mm)
retval
=
-
ENOMEM
;
if
(
mpnt
->
vm_flags
&
VM_DONTCOPY
)
continue
;
/*
* FIXME: shared writable map accounting should be one off
*/
if
(
mpnt
->
vm_flags
&
VM_ACCOUNT
)
{
unsigned
int
len
=
(
mpnt
->
vm_end
-
mpnt
->
vm_start
)
>>
PAGE_SHIFT
;
if
(
!
vm_enough_memory
(
len
))
goto
fail_nomem
;
charge
+=
len
;
}
tmp
=
kmem_cache_alloc
(
vm_area_cachep
,
SLAB_KERNEL
);
if
(
!
tmp
)
goto
fail_nomem
;
...
...
kernel/ksyms.c
View file @
ff2bdcb0
...
...
@@ -105,6 +105,7 @@ EXPORT_SYMBOL(kmem_cache_destroy);
EXPORT_SYMBOL
(
kmem_cache_shrink
);
EXPORT_SYMBOL
(
kmem_cache_alloc
);
EXPORT_SYMBOL
(
kmem_cache_free
);
EXPORT_SYMBOL
(
kmem_cache_size
);
EXPORT_SYMBOL
(
kmalloc
);
EXPORT_SYMBOL
(
kfree
);
EXPORT_SYMBOL
(
vfree
);
...
...
mm/memory.c
View file @
ff2bdcb0
...
...
@@ -1096,23 +1096,20 @@ int vmtruncate(struct inode * inode, loff_t offset)
do_expand:
limit
=
current
->
rlim
[
RLIMIT_FSIZE
].
rlim_cur
;
if
(
limit
!=
RLIM_INFINITY
)
{
if
(
inode
->
i_size
>=
limit
)
{
send_sig
(
SIGXFSZ
,
current
,
0
);
goto
out
;
}
if
(
offset
>
limit
)
{
send_sig
(
SIGXFSZ
,
current
,
0
);
offset
=
limit
;
}
}
if
(
limit
!=
RLIM_INFINITY
&&
offset
>
limit
)
goto
out_sig
;
if
(
offset
>
inode
->
i_sb
->
s_maxbytes
)
goto
out
;
inode
->
i_size
=
offset
;
out_truncate:
if
(
inode
->
i_op
&&
inode
->
i_op
->
truncate
)
inode
->
i_op
->
truncate
(
inode
);
out:
return
0
;
out_sig:
send_sig
(
SIGXFSZ
,
current
,
0
);
out:
return
-
EFBIG
;
}
/*
...
...
mm/mmap.c
View file @
ff2bdcb0
...
...
@@ -131,13 +131,6 @@ int vm_enough_memory(long pages)
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. */
static
inline
void
__remove_shared_vm_struct
(
struct
vm_area_struct
*
vma
)
{
...
...
@@ -204,7 +197,7 @@ asmlinkage unsigned long sys_brk(unsigned long brk)
/* Always allow shrinking brk. */
if
(
brk
<=
mm
->
brk
)
{
if
(
!
do_munmap
(
mm
,
newbrk
,
oldbrk
-
newbrk
,
1
))
if
(
!
do_munmap
(
mm
,
newbrk
,
oldbrk
-
newbrk
))
goto
set_brk
;
goto
out
;
}
...
...
@@ -524,7 +517,7 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
munmap_back:
vma
=
find_vma_prepare
(
mm
,
addr
,
&
prev
,
&
rb_link
,
&
rb_parent
);
if
(
vma
&&
vma
->
vm_start
<
addr
+
len
)
{
if
(
do_munmap
(
mm
,
addr
,
len
,
1
))
if
(
do_munmap
(
mm
,
addr
,
len
))
return
-
ENOMEM
;
goto
munmap_back
;
}
...
...
@@ -534,16 +527,17 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
>
current
->
rlim
[
RLIMIT_AS
].
rlim_cur
)
return
-
ENOMEM
;
if
(
sysctl_overcommit_memory
>
1
)
vm_flags
&=
~
MAP_NORESERVE
;
/* Private writable mapping? Check memory availability.. */
if
((((
vm_flags
&
(
VM_SHARED
|
VM_WRITE
))
==
VM_WRITE
)
||
(
file
==
NULL
))
&&
!
(
flags
&
MAP_NORESERVE
))
{
charged
=
len
>>
PAGE_SHIFT
;
if
(
!
vm_enough_memory
(
charged
))
return
-
ENOMEM
;
vm_flags
|=
VM_ACCOUNT
;
if
(
!
(
flags
&
MAP_NORESERVE
)
||
sysctl_overcommit_memory
>
1
)
{
if
(
vm_flags
&
VM_SHARED
)
{
/* Check memory availability in shmem_file_setup? */
vm_flags
|=
VM_ACCOUNT
;
}
else
if
(
vm_flags
&
VM_WRITE
)
{
/* Private writable mapping: check memory availability */
charged
=
len
>>
PAGE_SHIFT
;
if
(
!
vm_enough_memory
(
charged
))
return
-
ENOMEM
;
vm_flags
|=
VM_ACCOUNT
;
}
}
/* Can we just expand an old anonymous mapping? */
...
...
@@ -586,12 +580,20 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
error
=
file
->
f_op
->
mmap
(
file
,
vma
);
if
(
error
)
goto
unmap_and_free_vma
;
}
else
if
(
flags
&
MAP
_SHARED
)
{
}
else
if
(
vm_flags
&
VM
_SHARED
)
{
error
=
shmem_zero_setup
(
vma
);
if
(
error
)
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??
*
* Answer: Yes, several device drivers can do it in their
...
...
@@ -943,8 +945,7 @@ static void unmap_region(struct mm_struct *mm,
struct
vm_area_struct
*
mpnt
,
struct
vm_area_struct
*
prev
,
unsigned
long
start
,
unsigned
long
end
,
int
acct
)
unsigned
long
end
)
{
mmu_gather_t
*
tlb
;
...
...
@@ -958,7 +959,7 @@ static void unmap_region(struct mm_struct *mm,
unmap_page_range
(
tlb
,
mpnt
,
from
,
to
);
if
(
acct
&&
(
mpnt
->
vm_flags
&
VM_ACCOUNT
)
)
{
if
(
mpnt
->
vm_flags
&
VM_ACCOUNT
)
{
len
=
to
-
from
;
vm_unacct_memory
(
len
>>
PAGE_SHIFT
);
}
...
...
@@ -1039,7 +1040,7 @@ static int splitvma(struct mm_struct *mm, struct vm_area_struct *mpnt, unsigned
* work. This now handles partial unmappings.
* 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
;
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)
*/
spin_lock
(
&
mm
->
page_table_lock
);
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
);
/* Fix up all other VM information */
...
...
@@ -1098,7 +1099,7 @@ asmlinkage long sys_munmap(unsigned long addr, size_t len)
struct
mm_struct
*
mm
=
current
->
mm
;
down_write
(
&
mm
->
mmap_sem
);
ret
=
do_munmap
(
mm
,
addr
,
len
,
1
);
ret
=
do_munmap
(
mm
,
addr
,
len
);
up_write
(
&
mm
->
mmap_sem
);
return
ret
;
}
...
...
@@ -1135,7 +1136,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
munmap_back:
vma
=
find_vma_prepare
(
mm
,
addr
,
&
prev
,
&
rb_link
,
&
rb_parent
);
if
(
vma
&&
vma
->
vm_start
<
addr
+
len
)
{
if
(
do_munmap
(
mm
,
addr
,
len
,
1
))
if
(
do_munmap
(
mm
,
addr
,
len
))
return
-
ENOMEM
;
goto
munmap_back
;
}
...
...
@@ -1225,7 +1226,7 @@ void exit_mmap(struct mm_struct * mm)
* removal
*/
if
(
mpnt
->
vm_flags
&
VM_ACCOUNT
)
vm_unacct_
vma
(
mpnt
);
vm_unacct_
memory
((
end
-
start
)
>>
PAGE_SHIFT
);
mm
->
map_count
--
;
unmap_page_range
(
tlb
,
mpnt
,
start
,
end
);
...
...
mm/mprotect.c
View file @
ff2bdcb0
...
...
@@ -257,6 +257,22 @@ static int mprotect_fixup(struct vm_area_struct * vma, struct vm_area_struct **
*
pprev
=
vma
;
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
];
if
(
start
==
vma
->
vm_start
)
{
if
(
end
==
vma
->
vm_end
)
...
...
@@ -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
);
else
error
=
mprotect_fixup_middle
(
vma
,
pprev
,
start
,
end
,
newflags
,
newprot
);
if
(
error
)
{
if
(
newflags
&
PROT_WRITE
)
vm_unacct_memory
(
charged
);
vm_unacct_memory
(
charged
);
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
);
return
0
;
}
...
...
mm/mremap.c
View file @
ff2bdcb0
...
...
@@ -150,6 +150,7 @@ static inline unsigned long move_vma(struct vm_area_struct * vma,
struct
mm_struct
*
mm
=
vma
->
vm_mm
;
struct
vm_area_struct
*
new_vma
,
*
next
,
*
prev
;
int
allocated_vma
;
int
split
=
0
;
new_vma
=
NULL
;
next
=
find_vma_prev
(
mm
,
new_addr
,
&
prev
);
...
...
@@ -210,11 +211,26 @@ static inline unsigned long move_vma(struct vm_area_struct * vma,
new_vma
->
vm_ops
->
open
(
new_vma
);
insert_vm_struct
(
current
->
mm
,
new_vma
);
}
/*
* The old VMA has been accounted for,
* don't double account
*/
do_munmap
(
current
->
mm
,
addr
,
old_len
,
0
);
/* Conceal VM_ACCOUNT so old reservation is not undone */
if
(
vma
->
vm_flags
&
VM_ACCOUNT
)
{
vma
->
vm_flags
&=
~
VM_ACCOUNT
;
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
;
if
(
new_vma
->
vm_flags
&
VM_LOCKED
)
{
current
->
mm
->
locked_vm
+=
new_len
>>
PAGE_SHIFT
;
...
...
@@ -229,8 +245,6 @@ static inline unsigned long move_vma(struct vm_area_struct * vma,
return
-
ENOMEM
;
}
extern
int
sysctl_overcommit_memory
;
/* FIXME!! */
/*
* Expand (or shrink) an existing mapping, potentially moving it at the
* same time (controlled by the MREMAP_MAYMOVE flag and available VM space)
...
...
@@ -274,7 +288,7 @@ unsigned long do_mremap(unsigned long addr,
if
((
addr
<=
new_addr
)
&&
(
addr
+
old_len
)
>
new_addr
)
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,
*/
ret
=
addr
;
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
))
goto
out
;
old_len
=
new_len
;
}
/*
...
...
@@ -315,8 +330,6 @@ unsigned long do_mremap(unsigned long addr,
>
current
->
rlim
[
RLIMIT_AS
].
rlim_cur
)
goto
out
;
if
(
sysctl_overcommit_memory
>
1
)
flags
&=
~
MAP_NORESERVE
;
if
(
vma
->
vm_flags
&
VM_ACCOUNT
)
{
charged
=
(
new_len
-
old_len
)
>>
PAGE_SHIFT
;
if
(
!
vm_enough_memory
(
charged
))
...
...
mm/shmem.c
View file @
ff2bdcb0
...
...
@@ -37,6 +37,12 @@
#define TMPFS_MAGIC 0x01021994
#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
)
{
...
...
@@ -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
);
#define BLOCKS_PER_PAGE (PAGE_CACHE_SIZE/512)
/*
* shmem_recalc_inode - recalculate the size of an inode
*
...
...
@@ -133,9 +137,6 @@ static void shmem_recalc_inode(struct inode * inode)
* +-> 48-51
* +-> 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
)
{
unsigned
long
offset
;
...
...
@@ -188,7 +189,7 @@ static inline swp_entry_t * shmem_alloc_entry (struct shmem_inode_info *info, un
unsigned
long
page
=
0
;
swp_entry_t
*
res
;
if
(
index
>=
SHMEM_MAX_
BLOCKS
)
if
(
index
>=
SHMEM_MAX_
INDEX
)
return
ERR_PTR
(
-
EFBIG
);
if
(
info
->
next_index
<=
index
)
...
...
@@ -363,18 +364,16 @@ static void shmem_truncate (struct inode * inode)
static
int
shmem_notify_change
(
struct
dentry
*
dentry
,
struct
iattr
*
attr
)
{
struct
inode
*
inode
=
dentry
->
d_inode
;
long
change
=
0
;
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
=
((
attr
->
ia_size
+
PAGE_SIZE
-
1
)
>>
PAGE_SHIFT
)
-
((
inode
->
i_size
+
PAGE_SIZE
-
1
)
>>
PAGE_SHIFT
);
if
(
attr
->
ia_size
>
inode
->
i_size
)
{
change
=
VM_ACCT
(
attr
->
ia_size
)
-
VM_ACCT
(
inode
->
i_size
);
if
(
change
>
0
)
{
if
(
!
vm_enough_memory
(
change
))
return
-
ENOMEM
;
}
else
...
...
@@ -384,7 +383,8 @@ static int shmem_notify_change(struct dentry * dentry, struct iattr *attr)
error
=
inode_change_ok
(
inode
,
attr
);
if
(
!
error
)
error
=
inode_setattr
(
inode
,
attr
);
if
(
error
)
vm_unacct_memory
(
change
);
return
error
;
}
...
...
@@ -392,14 +392,15 @@ static int shmem_notify_change(struct dentry * dentry, struct iattr *attr)
static
void
shmem_delete_inode
(
struct
inode
*
inode
)
{
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
);
inode
->
i_size
=
0
;
if
(
inode
->
i_op
->
truncate
==
shmem_truncate
){
spin_lock
(
&
shmem_ilock
);
list_del
(
&
SHMEM_I
(
inode
)
->
list
);
spin_unlock
(
&
shmem_ilock
)
;
if
(
inode
->
i_op
->
truncate
==
shmem_truncate
)
{
spin_lock
(
&
shmem_ilock
);
list_del
(
&
info
->
list
)
;
spin_unlock
(
&
shmem_ilock
);
if
(
info
->
flags
&
VM_ACCOUNT
)
vm_unacct_memory
(
VM_ACCT
(
inode
->
i_size
)
);
inode
->
i_size
=
0
;
shmem_truncate
(
inode
);
}
spin_lock
(
&
sbinfo
->
stat_lock
);
...
...
@@ -527,7 +528,7 @@ static int shmem_writepage(struct page * page)
index
=
page
->
index
;
inode
=
mapping
->
host
;
info
=
SHMEM_I
(
inode
);
if
(
info
->
locked
)
if
(
info
->
flags
&
VM_LOCKED
)
return
fail_writepage
(
page
);
swap
=
get_swap_page
();
if
(
!
swap
.
val
)
...
...
@@ -744,9 +745,12 @@ void shmem_lock(struct file * file, int lock)
struct
inode
*
inode
=
file
->
f_dentry
->
d_inode
;
struct
shmem_inode_info
*
info
=
SHMEM_I
(
inode
);
down
(
&
info
->
sem
);
info
->
locked
=
lock
;
up
(
&
info
->
sem
);
spin_lock
(
&
info
->
lock
);
if
(
lock
)
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
)
...
...
@@ -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
));
info
->
i_indirect
=
NULL
;
info
->
swapped
=
0
;
info
->
locked
=
0
;
info
->
flags
=
VM_ACCOUNT
;
switch
(
mode
&
S_IFMT
)
{
default:
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)
maxpos
=
inode
->
i_size
;
if
(
pos
+
count
>
inode
->
i_size
)
{
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
;
goto
out_nc
;
}
...
...
@@ -983,7 +989,7 @@ shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
out:
/* Short writes give back address space */
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:
up
(
&
inode
->
i_sem
);
return
err
;
...
...
@@ -1238,10 +1244,15 @@ static int shmem_symlink(struct inode * dir, struct dentry *dentry, const char *
memcpy
(
info
,
symname
,
len
);
inode
->
i_op
=
&
shmem_symlink_inline_operations
;
}
else
{
if
(
!
vm_enough_memory
(
VM_ACCT
(
1
)))
{
iput
(
inode
);
return
-
ENOMEM
;
}
down
(
&
info
->
sem
);
page
=
shmem_getpage_locked
(
info
,
inode
,
0
);
if
(
IS_ERR
(
page
))
{
up
(
&
info
->
sem
);
vm_unacct_memory
(
VM_ACCT
(
1
));
iput
(
inode
);
return
PTR_ERR
(
page
);
}
...
...
@@ -1430,7 +1441,7 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
sbinfo
->
free_blocks
=
blocks
;
sbinfo
->
max_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_bits
=
PAGE_CACHE_SHIFT
;
sb
->
s_magic
=
TMPFS_MAGIC
;
...
...
@@ -1646,20 +1657,21 @@ module_exit(exit_shmem_fs)
* @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
inode
*
inode
;
struct
dentry
*
dentry
,
*
root
;
struct
qstr
this
;
if
(
size
>
(
unsigned
long
long
)
SHMEM_MAX_BLOCKS
<<
PAGE_CACHE_SHIFT
)
if
(
size
>
SHMEM_MAX_BYTES
)
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
);
error
=
-
ENOMEM
;
this
.
name
=
name
;
this
.
len
=
strlen
(
name
);
this
.
hash
=
0
;
/* will go */
...
...
@@ -1678,14 +1690,14 @@ struct file *shmem_file_setup(char * name, loff_t size)
if
(
!
inode
)
goto
close_file
;
SHMEM_I
(
inode
)
->
flags
&=
flags
;
d_instantiate
(
dentry
,
inode
);
dentry
->
d_
inode
->
i_size
=
size
;
shmem_truncate
(
inode
);
inode
->
i_size
=
size
;
inode
->
i_nlink
=
0
;
/* It is unlinked */
file
->
f_vfsmnt
=
mntget
(
shm_mnt
);
file
->
f_dentry
=
dentry
;
file
->
f_op
=
&
shmem_file_operations
;
file
->
f_mode
=
FMODE_WRITE
|
FMODE_READ
;
inode
->
i_nlink
=
0
;
/* It is unlinked */
return
(
file
);
close_file:
...
...
@@ -1693,9 +1705,11 @@ struct file *shmem_file_setup(char * name, loff_t size)
put_dentry:
dput
(
dentry
);
put_memory:
vm_unacct_memory
((
size
)
>>
PAGE_CACHE_SHIFT
);
if
(
flags
&
VM_ACCOUNT
)
vm_unacct_memory
(
VM_ACCT
(
size
));
return
ERR_PTR
(
error
);
}
/*
* shmem_zero_setup - setup a shared anonymous mapping
*
...
...
@@ -1706,7 +1720,7 @@ int shmem_zero_setup(struct vm_area_struct *vma)
struct
file
*
file
;
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
))
return
PTR_ERR
(
file
);
...
...
mm/slab.c
View file @
ff2bdcb0
...
...
@@ -1647,6 +1647,15 @@ void kfree (const void *objp)
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
)
{
cache_sizes_t
*
csizep
=
cache_sizes
;
...
...
security/capability.c
View file @
ff2bdcb0
...
...
@@ -464,7 +464,7 @@ static int cap_file_mprotect (struct vm_area_struct *vma, unsigned long prot)
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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment