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
c69c6a6e
Commit
c69c6a6e
authored
Feb 09, 2002
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Plain Diff
Merge rum.normnet.org:/spare/vanilla/linus-2.5
into rum.normnet.org:/spare/vanilla/net-drivers-2.5
parents
339c84ae
0431923f
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
229 additions
and
259 deletions
+229
-259
drivers/pcmcia/cardbus.c
drivers/pcmcia/cardbus.c
+2
-2
fs/affs/super.c
fs/affs/super.c
+2
-8
fs/dquot.c
fs/dquot.c
+3
-3
fs/ext2/balloc.c
fs/ext2/balloc.c
+1
-1
fs/lockd/svclock.c
fs/lockd/svclock.c
+8
-12
fs/lockd/svcsubs.c
fs/lockd/svcsubs.c
+1
-1
fs/nfsd/export.c
fs/nfsd/export.c
+2
-4
fs/nfsd/nfsfh.c
fs/nfsd/nfsfh.c
+1
-2
fs/nfsd/vfs.c
fs/nfsd/vfs.c
+2
-2
fs/proc/proc_misc.c
fs/proc/proc_misc.c
+25
-15
include/linux/slab.h
include/linux/slab.h
+0
-5
kernel/module.c
kernel/module.c
+56
-73
mm/slab.c
mm/slab.c
+126
-131
No files found.
drivers/pcmcia/cardbus.c
View file @
c69c6a6e
...
...
@@ -279,13 +279,13 @@ int cb_alloc(socket_info_t * s)
pci_readw
(
dev
,
PCI_DEVICE_ID
,
&
dev
->
device
);
dev
->
hdr_type
=
hdr
&
0x7f
;
pci_setup_device
(
dev
);
dev
->
dev
.
parent
=
bus
->
dev
;
strcpy
(
dev
->
dev
.
name
,
dev
->
name
);
strcpy
(
dev
->
dev
.
bus_id
,
dev
->
slot_name
);
device_register
(
&
dev
->
dev
);
pci_setup_device
(
dev
);
/* FIXME: Do we need to enable the expansion ROM? */
for
(
r
=
0
;
r
<
7
;
r
++
)
{
struct
resource
*
res
=
dev
->
resource
+
r
;
...
...
fs/affs/super.c
View file @
c69c6a6e
...
...
@@ -270,9 +270,8 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
struct
buffer_head
*
root_bh
=
NULL
;
struct
buffer_head
*
boot_bh
;
struct
inode
*
root_inode
=
NULL
;
kdev_t
dev
=
sb
->
s_dev
;
s32
root_block
;
int
blocks
,
size
,
blocksize
;
int
size
,
blocksize
;
u32
chksum
;
int
num_bm
;
int
i
,
j
;
...
...
@@ -308,12 +307,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
* blocks, we will have to change it.
*/
blocks
=
blk_size
[
major
(
dev
)]
?
blk_size
[
major
(
dev
)][
minor
(
dev
)]
:
0
;
if
(
!
blocks
)
{
printk
(
KERN_ERR
"AFFS: Could not determine device size
\n
"
);
goto
out_error
;
}
size
=
(
BLOCK_SIZE
/
512
)
*
blocks
;
size
=
sb
->
s_bdev
->
bd_inode
->
i_size
>>
9
;
pr_debug
(
"AFFS: initial blksize=%d, blocks=%d
\n
"
,
512
,
blocks
);
affs_set_blocksize
(
sb
,
PAGE_SIZE
);
...
...
fs/dquot.c
View file @
c69c6a6e
...
...
@@ -289,7 +289,7 @@ static void write_dquot(struct dquot *dquot)
sizeof
(
struct
dqblk
),
&
offset
);
if
(
ret
!=
sizeof
(
struct
dqblk
))
printk
(
KERN_WARNING
"VFS: dquota write failed on dev %s
\n
"
,
kdevname
(
dquot
->
dq_sb
->
s_dev
)
);
dquot
->
dq_sb
->
s_id
);
set_fs
(
fs
);
up
(
sem
);
...
...
@@ -440,7 +440,7 @@ static void dqput(struct dquot *dquot)
if
(
!
dquot
->
dq_count
)
{
printk
(
"VFS: dqput: trying to free free dquot
\n
"
);
printk
(
"VFS: device %s, dquot of %s %d
\n
"
,
kdevname
(
dquot
->
dq_sb
->
s_dev
)
,
dquot
->
dq_sb
->
s_id
,
quotatypes
[
dquot
->
dq_type
],
dquot
->
dq_id
);
return
;
...
...
@@ -715,7 +715,7 @@ static void print_warning(struct dquot *dquot, const char warntype)
if
(
!
need_print_warning
(
dquot
,
flag
))
return
;
dquot
->
dq_flags
|=
flag
;
tty_write_message
(
current
->
tty
,
(
char
*
)
bdevname
(
dquot
->
dq_sb
->
s_dev
)
);
tty_write_message
(
current
->
tty
,
dquot
->
dq_sb
->
s_id
);
if
(
warntype
==
ISOFTWARN
||
warntype
==
BSOFTWARN
)
tty_write_message
(
current
->
tty
,
": warning, "
);
else
...
...
fs/ext2/balloc.c
View file @
c69c6a6e
...
...
@@ -404,7 +404,7 @@ int ext2_new_block (struct inode * inode, unsigned long goal,
if
(
DQUOT_ALLOC_BLOCK
(
inode
,
1
))
goto
out
;
while
(
prealloc_goal
&&
!
DQUOT_PREALLOC_BLOCK
(
inode
,
prealloc_goal
))
while
(
prealloc_goal
&&
DQUOT_PREALLOC_BLOCK
(
inode
,
prealloc_goal
))
prealloc_goal
--
;
dq_alloc
=
prealloc_goal
+
1
;
...
...
fs/lockd/svclock.c
View file @
c69c6a6e
...
...
@@ -306,9 +306,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
struct
nlm_block
*
block
;
int
error
;
dprintk
(
"lockd: nlmsvc_lock(%02x:%02x/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)
\n
"
,
major
(
file
->
f_file
.
f_dentry
->
d_inode
->
i_dev
),
minor
(
file
->
f_file
.
f_dentry
->
d_inode
->
i_dev
),
dprintk
(
"lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)
\n
"
,
file
->
f_file
.
f_dentry
->
d_inode
->
i_sb
->
s_id
,
file
->
f_file
.
f_dentry
->
d_inode
->
i_ino
,
lock
->
fl
.
fl_type
,
lock
->
fl
.
fl_pid
,
(
long
long
)
lock
->
fl
.
fl_start
,
...
...
@@ -386,9 +385,8 @@ nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock,
{
struct
file_lock
*
fl
;
dprintk
(
"lockd: nlmsvc_testlock(%02x:%02x/%ld, ty=%d, %Ld-%Ld)
\n
"
,
major
(
file
->
f_file
.
f_dentry
->
d_inode
->
i_dev
),
minor
(
file
->
f_file
.
f_dentry
->
d_inode
->
i_dev
),
dprintk
(
"lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)
\n
"
,
file
->
f_file
.
f_dentry
->
d_inode
->
i_sb
->
s_id
,
file
->
f_file
.
f_dentry
->
d_inode
->
i_ino
,
lock
->
fl
.
fl_type
,
(
long
long
)
lock
->
fl
.
fl_start
,
...
...
@@ -419,9 +417,8 @@ nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
{
int
error
;
dprintk
(
"lockd: nlmsvc_unlock(%02x:%02x/%ld, pi=%d, %Ld-%Ld)
\n
"
,
major
(
file
->
f_file
.
f_dentry
->
d_inode
->
i_dev
),
minor
(
file
->
f_file
.
f_dentry
->
d_inode
->
i_dev
),
dprintk
(
"lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)
\n
"
,
file
->
f_file
.
f_dentry
->
d_inode
->
i_sb
->
s_id
,
file
->
f_file
.
f_dentry
->
d_inode
->
i_ino
,
lock
->
fl
.
fl_pid
,
(
long
long
)
lock
->
fl
.
fl_start
,
...
...
@@ -448,9 +445,8 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
{
struct
nlm_block
*
block
;
dprintk
(
"lockd: nlmsvc_cancel(%02x:%02x/%ld, pi=%d, %Ld-%Ld)
\n
"
,
major
(
file
->
f_file
.
f_dentry
->
d_inode
->
i_dev
),
minor
(
file
->
f_file
.
f_dentry
->
d_inode
->
i_dev
),
dprintk
(
"lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)
\n
"
,
file
->
f_file
.
f_dentry
->
d_inode
->
i_sb
->
s_id
,
file
->
f_file
.
f_dentry
->
d_inode
->
i_ino
,
lock
->
fl
.
fl_pid
,
(
long
long
)
lock
->
fl
.
fl_start
,
...
...
fs/lockd/svcsubs.c
View file @
c69c6a6e
...
...
@@ -128,7 +128,7 @@ nlm_delete_file(struct nlm_file *file)
struct
nlm_file
**
fp
,
*
f
;
dprintk
(
"lockd: closing file %s/%ld
\n
"
,
kdevname
(
inode
->
i_dev
)
,
inode
->
i_ino
);
inode
->
i_sb
->
s_id
,
inode
->
i_ino
);
fp
=
nlm_files
+
file
->
f_hash
;
while
((
f
=
*
fp
)
!=
NULL
)
{
if
(
f
==
file
)
{
...
...
fs/nfsd/export.c
View file @
c69c6a6e
...
...
@@ -375,7 +375,6 @@ exp_rootfh(struct svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
struct
nameidata
nd
;
struct
inode
*
inode
;
struct
svc_fh
fh
;
kdev_t
dev
;
int
err
;
err
=
-
EPERM
;
...
...
@@ -386,11 +385,10 @@ exp_rootfh(struct svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
return
err
;
}
inode
=
nd
.
dentry
->
d_inode
;
dev
=
inode
->
i_dev
;
dprintk
(
"nfsd: exp_rootfh(%s [%p] %s:%
02x:%02x
/%ld)
\n
"
,
dprintk
(
"nfsd: exp_rootfh(%s [%p] %s:%
s
/%ld)
\n
"
,
path
,
nd
.
dentry
,
clp
->
cl_ident
,
major
(
dev
),
minor
(
dev
),
(
long
)
inode
->
i_ino
);
inode
->
i_sb
->
s_id
,
inode
->
i_ino
);
exp
=
exp_parent
(
clp
,
inode
->
i_sb
,
nd
.
dentry
);
if
(
!
exp
)
{
dprintk
(
"nfsd: exp_rootfh export not found.
\n
"
);
...
...
fs/nfsd/nfsfh.c
View file @
c69c6a6e
...
...
@@ -424,8 +424,7 @@ find_fh_dentry(struct super_block *sb, __u32 *datap, int len, int fhtype, int ne
/* It's a directory, or we are required to confirm the file's
* location in the tree.
*/
dprintk
(
"nfs_fh: need to look harder for %02x:%02x/%d
\n
"
,
major
(
sb
->
s_dev
),
minor
(
sb
->
s_dev
),
datap
[
0
]);
dprintk
(
"nfs_fh: need to look harder for %s/%d
\n
"
,
sb
->
s_id
,
datap
[
0
]);
if
(
!
S_ISDIR
(
result
->
d_inode
->
i_mode
))
{
nfsdstats
.
fh_nocache_nondir
++
;
...
...
fs/nfsd/vfs.c
View file @
c69c6a6e
...
...
@@ -1410,8 +1410,8 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
oldlen
=
cd
.
buflen
;
/*
dprintk("nfsd: f_op->readdir(%
x
/%ld @ %d) buflen = %d (%d)\n",
file.f_inode->i_
dev
, file.f_inode->i_ino,
dprintk("nfsd: f_op->readdir(%
s
/%ld @ %d) buflen = %d (%d)\n",
file.f_inode->i_
sb->s_id
, file.f_inode->i_ino,
(int) file.f_pos, (int) oldlen, (int) cd.buflen);
*/
err
=
file
.
f_op
->
readdir
(
&
file
,
&
cd
,
(
filldir_t
)
func
);
...
...
fs/proc/proc_misc.c
View file @
c69c6a6e
...
...
@@ -50,9 +50,6 @@
* have a way to deal with that gracefully. Right now I used straightforward
* wrappers, but this needs further analysis wrt potential overflows.
*/
#ifdef CONFIG_MODULES
extern
int
get_module_list
(
char
*
);
#endif
extern
int
get_device_list
(
char
*
);
extern
int
get_partition_list
(
char
*
,
char
**
,
off_t
,
int
);
extern
int
get_filesystem_list
(
char
*
);
...
...
@@ -203,13 +200,17 @@ static struct file_operations proc_cpuinfo_operations = {
};
#ifdef CONFIG_MODULES
static
int
modules_read_proc
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
extern
struct
seq_operations
modules_op
;
static
int
modules_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
int
len
=
get_module_list
(
page
);
return
proc_calc_metrics
(
page
,
start
,
off
,
count
,
eof
,
len
);
return
seq_open
(
file
,
&
modules_op
);
}
static
struct
file_operations
proc_modules_operations
=
{
open:
modules_open
,
read:
seq_read
,
llseek:
seq_lseek
,
release:
seq_release
,
};
extern
struct
seq_operations
ksyms_op
;
static
int
ksyms_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
...
...
@@ -223,6 +224,20 @@ static struct file_operations proc_ksyms_operations = {
};
#endif
extern
struct
seq_operations
slabinfo_op
;
extern
ssize_t
slabinfo_write
(
struct
file
*
,
const
char
*
,
size_t
,
loff_t
*
);
static
int
slabinfo_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
slabinfo_op
);
}
static
struct
file_operations
proc_slabinfo_operations
=
{
open:
slabinfo_open
,
read:
seq_read
,
write:
slabinfo_write
,
llseek:
seq_lseek
,
release:
seq_release
,
};
static
int
kstat_read_proc
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
...
...
@@ -521,9 +536,6 @@ void __init proc_misc_init(void)
{
"uptime"
,
uptime_read_proc
},
{
"meminfo"
,
meminfo_read_proc
},
{
"version"
,
version_read_proc
},
#ifdef CONFIG_MODULES
{
"modules"
,
modules_read_proc
},
#endif
{
"stat"
,
kstat_read_proc
},
{
"devices"
,
devices_read_proc
},
{
"partitions"
,
partitions_read_proc
},
...
...
@@ -551,7 +563,9 @@ void __init proc_misc_init(void)
entry
->
proc_fops
=
&
proc_kmsg_operations
;
create_seq_entry
(
"cpuinfo"
,
0
,
&
proc_cpuinfo_operations
);
create_seq_entry
(
"interrupts"
,
0
,
&
proc_interrupts_operations
);
create_seq_entry
(
"slabinfo"
,
S_IWUSR
|
S_IRUGO
,
&
proc_slabinfo_operations
);
#ifdef CONFIG_MODULES
create_seq_entry
(
"modules"
,
0
,
&
proc_modules_operations
);
create_seq_entry
(
"ksyms"
,
0
,
&
proc_ksyms_operations
);
#endif
proc_root_kcore
=
create_proc_entry
(
"kcore"
,
S_IRUSR
,
NULL
);
...
...
@@ -575,8 +589,4 @@ void __init proc_misc_init(void)
entry
->
proc_fops
=
&
ppc_htab_operations
;
}
#endif
entry
=
create_proc_read_entry
(
"slabinfo"
,
S_IWUSR
|
S_IRUGO
,
NULL
,
slabinfo_read_proc
,
NULL
);
if
(
entry
)
entry
->
write_proc
=
slabinfo_write_proc
;
}
include/linux/slab.h
View file @
c69c6a6e
...
...
@@ -62,11 +62,6 @@ extern void *kmalloc(size_t, int);
extern
void
kfree
(
const
void
*
);
extern
int
FASTCALL
(
kmem_cache_reap
(
int
));
extern
int
slabinfo_read_proc
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
);
struct
file
;
extern
int
slabinfo_write_proc
(
struct
file
*
file
,
const
char
*
buffer
,
unsigned
long
count
,
void
*
data
);
/* System wide caches */
extern
kmem_cache_t
*
vm_area_cachep
;
...
...
kernel/module.c
View file @
c69c6a6e
...
...
@@ -1075,84 +1075,67 @@ free_module(struct module *mod, int tag_freed)
/*
* Called by the /proc file system to return a current list of modules.
*/
int
get_module_list
(
char
*
p
)
static
void
*
m_start
(
struct
seq_file
*
m
,
loff_t
*
pos
)
{
size_t
left
=
PAGE_SIZE
;
struct
module
*
mod
;
char
tmpstr
[
64
];
struct
module_ref
*
ref
;
for
(
mod
=
module_list
;
mod
!=
&
kernel_module
;
mod
=
mod
->
next
)
{
long
len
;
const
char
*
q
;
#define safe_copy_str(str, len) \
do { \
if (left < len) \
goto fini; \
memcpy(p, str, len); p += len, left -= len; \
} while (0)
#define safe_copy_cstr(str) safe_copy_str(str, sizeof(str)-1)
len
=
strlen
(
mod
->
name
);
safe_copy_str
(
mod
->
name
,
len
);
if
((
len
=
20
-
len
)
>
0
)
{
if
(
left
<
len
)
goto
fini
;
memset
(
p
,
' '
,
len
);
p
+=
len
;
left
-=
len
;
}
len
=
sprintf
(
tmpstr
,
"%8lu"
,
mod
->
size
);
safe_copy_str
(
tmpstr
,
len
);
if
(
mod
->
flags
&
MOD_RUNNING
)
{
len
=
sprintf
(
tmpstr
,
"%4ld"
,
(
mod_member_present
(
mod
,
can_unload
)
&&
mod
->
can_unload
?
-
1L
:
(
long
)
atomic_read
(
&
mod
->
uc
.
usecount
)));
safe_copy_str
(
tmpstr
,
len
);
}
struct
module
*
v
;
loff_t
n
=
*
pos
;
lock_kernel
();
for
(
v
=
module_list
;
v
&&
n
--
;
v
=
v
->
next
)
;
return
v
;
}
static
void
*
m_next
(
struct
seq_file
*
m
,
void
*
p
,
loff_t
*
pos
)
{
struct
module
*
v
=
p
;
(
*
pos
)
++
;
return
v
->
next
;
}
static
void
m_stop
(
struct
seq_file
*
m
,
void
*
p
)
{
unlock_kernel
();
}
static
int
m_show
(
struct
seq_file
*
m
,
void
*
p
)
{
struct
module
*
mod
=
p
;
struct
module_ref
*
ref
=
mod
->
refs
;
if
(
mod
->
flags
&
MOD_DELETED
)
safe_copy_cstr
(
" (deleted)"
);
else
if
(
mod
->
flags
&
MOD_RUNNING
)
{
if
(
mod
->
flags
&
MOD_AUTOCLEAN
)
safe_copy_cstr
(
" (autoclean)"
);
if
(
!
(
mod
->
flags
&
MOD_USED_ONCE
))
safe_copy_cstr
(
" (unused)"
);
}
else
if
(
mod
->
flags
&
MOD_INITIALIZING
)
safe_copy_cstr
(
" (initializing)"
);
else
safe_copy_cstr
(
" (uninitialized)"
);
if
((
ref
=
mod
->
refs
)
!=
NULL
)
{
safe_copy_cstr
(
" ["
);
while
(
1
)
{
q
=
ref
->
ref
->
name
;
len
=
strlen
(
q
);
safe_copy_str
(
q
,
len
);
if
((
ref
=
ref
->
next_ref
)
!=
NULL
)
safe_copy_cstr
(
" "
);
else
break
;
}
safe_copy_cstr
(
"]"
);
}
safe_copy_cstr
(
"
\n
"
);
if
(
mod
==
&
kernel_module
)
return
0
;
#undef safe_copy_str
#undef safe_copy_cstr
seq_printf
(
m
,
"%-20s%8lu"
,
mod
->
name
,
mod
->
size
);
if
(
mod
->
flags
&
MOD_RUNNING
)
seq_printf
(
m
,
"%4ld"
,
(
mod_member_present
(
mod
,
can_unload
)
&&
mod
->
can_unload
?
-
1L
:
(
long
)
atomic_read
(
&
mod
->
uc
.
usecount
)));
if
(
mod
->
flags
&
MOD_DELETED
)
seq_puts
(
m
,
" (deleted)"
);
else
if
(
mod
->
flags
&
MOD_RUNNING
)
{
if
(
mod
->
flags
&
MOD_AUTOCLEAN
)
seq_puts
(
m
,
" (autoclean)"
);
if
(
!
(
mod
->
flags
&
MOD_USED_ONCE
))
seq_puts
(
m
,
" (unused)"
);
}
else
if
(
mod
->
flags
&
MOD_INITIALIZING
)
seq_puts
(
m
,
" (initializing)"
);
else
seq_puts
(
m
,
" (uninitialized)"
);
if
(
ref
)
{
char
c
;
seq_putc
(
m
,
' '
);
for
(
c
=
'['
;
ref
;
c
=
' '
,
ref
=
ref
->
next_ref
)
seq_printf
(
m
,
"%c%s"
,
c
,
ref
->
ref
->
name
);
seq_putc
(
m
,
']'
);
}
fini:
return
PAGE_SIZE
-
left
;
seq_putc
(
m
,
'\n'
);
return
0
;
}
struct
seq_operations
modules_op
=
{
start:
m_start
,
next:
m_next
,
stop:
m_stop
,
show:
m_show
};
/*
* Called by the /proc file system to return a current list of ksyms.
...
...
mm/slab.c
View file @
c69c6a6e
...
...
@@ -75,6 +75,7 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/compiler.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
/*
...
...
@@ -1869,31 +1870,56 @@ int kmem_cache_reap (int gfp_mask)
}
#ifdef CONFIG_PROC_FS
/* /proc/slabinfo
* cache-name num-active-objs total-objs
* obj-size num-active-slabs total-slabs
* num-pages-per-slab
*/
#define FIXUP(t) \
do { \
if (len <= off) { \
off -= len; \
len = 0; \
} else { \
if (len-off > count) \
goto t; \
} \
} while (0)
static
int
proc_getdata
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
)
static
void
*
s_start
(
struct
seq_file
*
m
,
loff_t
*
pos
)
{
loff_t
n
=
*
pos
;
struct
list_head
*
p
;
int
len
=
0
;
/* Output format version, so at least we can change it without _too_
* many complaints.
*/
len
+=
sprintf
(
page
+
len
,
"slabinfo - version: 1.1"
down
(
&
cache_chain_sem
);
if
(
!
n
)
return
(
void
*
)
1
;
p
=
&
cache_cache
.
next
;
while
(
--
n
)
{
p
=
p
->
next
;
if
(
p
==
&
cache_cache
.
next
)
return
NULL
;
}
return
list_entry
(
p
,
kmem_cache_t
,
next
);
}
static
void
*
s_next
(
struct
seq_file
*
m
,
void
*
p
,
loff_t
*
pos
)
{
kmem_cache_t
*
cachep
=
p
;
++*
pos
;
if
(
p
==
(
void
*
)
1
)
return
&
cache_cache
;
cachep
=
list_entry
(
cachep
->
next
.
next
,
kmem_cache_t
,
next
);
return
cachep
==
&
cache_cache
?
NULL
:
cachep
;
}
static
void
s_stop
(
struct
seq_file
*
m
,
void
*
p
)
{
up
(
&
cache_chain_sem
);
}
static
int
s_show
(
struct
seq_file
*
m
,
void
*
p
)
{
kmem_cache_t
*
cachep
=
p
;
struct
list_head
*
q
;
slab_t
*
slabp
;
unsigned
long
active_objs
;
unsigned
long
num_objs
;
unsigned
long
active_slabs
=
0
;
unsigned
long
num_slabs
;
const
char
*
name
;
if
(
p
==
(
void
*
)
1
)
{
/*
* Output format version, so at least we can change it
* without _too_ many complaints.
*/
seq_puts
(
m
,
"slabinfo - version: 1.1"
#if STATS
" (statistics)"
#endif
...
...
@@ -1901,116 +1927,89 @@ static int proc_getdata (char*page, char**start, off_t off, int count)
" (SMP)"
#endif
"
\n
"
);
FIXUP
(
got_data
);
down
(
&
cache_chain_sem
);
p
=
&
cache_cache
.
next
;
do
{
kmem_cache_t
*
cachep
;
struct
list_head
*
q
;
slab_t
*
slabp
;
unsigned
long
active_objs
;
unsigned
long
num_objs
;
unsigned
long
active_slabs
=
0
;
unsigned
long
num_slabs
;
const
char
*
name
;
cachep
=
list_entry
(
p
,
kmem_cache_t
,
next
);
return
0
;
}
spin_lock_irq
(
&
cachep
->
spinlock
);
active_objs
=
0
;
num_slabs
=
0
;
list_for_each
(
q
,
&
cachep
->
slabs_full
)
{
slabp
=
list_entry
(
q
,
slab_t
,
list
);
if
(
slabp
->
inuse
!=
cachep
->
num
)
BUG
();
active_objs
+=
cachep
->
num
;
active_slabs
++
;
}
list_for_each
(
q
,
&
cachep
->
slabs_partial
)
{
slabp
=
list_entry
(
q
,
slab_t
,
list
);
if
(
slabp
->
inuse
==
cachep
->
num
||
!
slabp
->
inuse
)
BUG
();
active_objs
+=
slabp
->
inuse
;
active_slabs
++
;
}
list_for_each
(
q
,
&
cachep
->
slabs_free
)
{
slabp
=
list_entry
(
q
,
slab_t
,
list
);
if
(
slabp
->
inuse
)
BUG
();
num_slabs
++
;
}
num_slabs
+=
active_slabs
;
num_objs
=
num_slabs
*
cachep
->
num
;
spin_lock_irq
(
&
cachep
->
spinlock
);
active_objs
=
0
;
num_slabs
=
0
;
list_for_each
(
q
,
&
cachep
->
slabs_full
)
{
slabp
=
list_entry
(
q
,
slab_t
,
list
);
if
(
slabp
->
inuse
!=
cachep
->
num
)
BUG
();
active_objs
+=
cachep
->
num
;
active_slabs
++
;
}
list_for_each
(
q
,
&
cachep
->
slabs_partial
)
{
slabp
=
list_entry
(
q
,
slab_t
,
list
);
if
(
slabp
->
inuse
==
cachep
->
num
||
!
slabp
->
inuse
)
BUG
();
active_objs
+=
slabp
->
inuse
;
active_slabs
++
;
}
list_for_each
(
q
,
&
cachep
->
slabs_free
)
{
slabp
=
list_entry
(
q
,
slab_t
,
list
);
if
(
slabp
->
inuse
)
BUG
();
num_slabs
++
;
}
num_slabs
+=
active_slabs
;
num_objs
=
num_slabs
*
cachep
->
num
;
name
=
cachep
->
name
;
{
char
tmp
;
if
(
__get_user
(
tmp
,
name
))
name
=
"broken"
;
}
name
=
cachep
->
name
;
{
char
tmp
;
if
(
__get_user
(
tmp
,
name
))
name
=
"broken"
;
}
len
+=
sprintf
(
page
+
len
,
"%-17s %6lu %6lu %6u %4lu %4lu %4u"
,
name
,
active_objs
,
num_objs
,
cachep
->
objsize
,
active_slabs
,
num_slabs
,
(
1
<<
cachep
->
gfporder
));
seq_printf
(
m
,
"%-17s %6lu %6lu %6u %4lu %4lu %4u"
,
name
,
active_objs
,
num_objs
,
cachep
->
objsize
,
active_slabs
,
num_slabs
,
(
1
<<
cachep
->
gfporder
));
#if STATS
{
unsigned
long
errors
=
cachep
->
errors
;
unsigned
long
high
=
cachep
->
high_mark
;
unsigned
long
grown
=
cachep
->
grown
;
unsigned
long
reaped
=
cachep
->
reaped
;
unsigned
long
allocs
=
cachep
->
num_allocations
;
len
+=
sprintf
(
page
+
len
,
" : %6lu %7lu %5lu %4lu %4lu"
,
high
,
allocs
,
grown
,
reaped
,
errors
);
}
{
unsigned
long
errors
=
cachep
->
errors
;
unsigned
long
high
=
cachep
->
high_mark
;
unsigned
long
grown
=
cachep
->
grown
;
unsigned
long
reaped
=
cachep
->
reaped
;
unsigned
long
allocs
=
cachep
->
num_allocations
;
seq_printf
(
m
,
" : %6lu %7lu %5lu %4lu %4lu"
,
high
,
allocs
,
grown
,
reaped
,
errors
);
}
#endif
#ifdef CONFIG_SMP
{
unsigned
int
batchcount
=
cachep
->
batchcount
;
unsigned
int
limit
;
if
(
cc_data
(
cachep
))
limit
=
cc_data
(
cachep
)
->
limit
;
else
limit
=
0
;
len
+=
sprintf
(
page
+
len
,
" : %4u %4u"
,
limit
,
batchcount
);
}
{
unsigned
int
batchcount
=
cachep
->
batchcount
;
unsigned
int
limit
;
if
(
cc_data
(
cachep
))
limit
=
cc_data
(
cachep
)
->
limit
;
else
limit
=
0
;
seq_printf
(
m
,
" : %4u %4u"
,
limit
,
batchcount
);
}
#endif
#if STATS && defined(CONFIG_SMP)
{
unsigned
long
allochit
=
atomic_read
(
&
cachep
->
allochit
);
unsigned
long
allocmiss
=
atomic_read
(
&
cachep
->
allocmiss
);
unsigned
long
freehit
=
atomic_read
(
&
cachep
->
freehit
);
unsigned
long
freemiss
=
atomic_read
(
&
cachep
->
freemiss
);
len
+=
sprintf
(
page
+
len
,
" : %6lu %6lu %6lu %6lu"
,
allochit
,
allocmiss
,
freehit
,
freemiss
);
}
{
unsigned
long
allochit
=
atomic_read
(
&
cachep
->
allochit
);
unsigned
long
allocmiss
=
atomic_read
(
&
cachep
->
allocmiss
);
unsigned
long
freehit
=
atomic_read
(
&
cachep
->
freehit
);
unsigned
long
freemiss
=
atomic_read
(
&
cachep
->
freemiss
);
seq_printf
(
m
,
" : %6lu %6lu %6lu %6lu"
,
allochit
,
allocmiss
,
freehit
,
freemiss
);
}
#endif
len
+=
sprintf
(
page
+
len
,
"
\n
"
);
spin_unlock_irq
(
&
cachep
->
spinlock
);
FIXUP
(
got_data_up
);
p
=
cachep
->
next
.
next
;
}
while
(
p
!=
&
cache_cache
.
next
);
got_data_up:
up
(
&
cache_chain_sem
);
got_data:
*
start
=
page
+
off
;
return
len
;
spin_unlock_irq
(
&
cachep
->
spinlock
);
seq_putc
(
m
,
'\n'
);
return
0
;
}
/**
* slabinfo_read_proc - generates /proc/slabinfo
* @page: scratch area, one page long
* @start: pointer to the pointer to the output buffer
* @off: offset within /proc/slabinfo the caller is interested in
* @count: requested len in bytes
* @eof: eof marker
* @data: unused
* slabinfo_op - iterator that generates /proc/slabinfo
*
*
The contents of the buffer are
*
Output layout:
* cache-name
* num-active-objs
* total-objs
...
...
@@ -2020,28 +2019,24 @@ static int proc_getdata (char*page, char**start, off_t off, int count)
* num-pages-per-slab
* + further values on SMP and with statistics enabled
*/
int
slabinfo_read_proc
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
int
len
=
proc_getdata
(
page
,
start
,
off
,
count
);
len
-=
(
*
start
-
page
);
if
(
len
<=
count
)
*
eof
=
1
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return
len
;
}
struct
seq_operations
slabinfo_op
=
{
start:
s_start
,
next:
s_next
,
stop:
s_stop
,
show:
s_show
};
#define MAX_SLABINFO_WRITE 128
/**
* slabinfo_write
_proc
- SMP tuning for the slab allocator
* slabinfo_write - SMP tuning for the slab allocator
* @file: unused
* @buffer: user buffer
* @count: data len
* @data: unused
*/
int
slabinfo_write_proc
(
struct
file
*
file
,
const
char
*
buffer
,
unsigned
long
count
,
void
*
data
)
ssize_t
slabinfo_write
(
struct
file
*
file
,
const
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
#ifdef CONFIG_SMP
char
kbuf
[
MAX_SLABINFO_WRITE
+
1
],
*
tmp
;
...
...
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