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
nexedi
linux
Commits
a773eb63
Commit
a773eb63
authored
Jan 06, 2003
by
Ravikiran G. Thirumalai
Committed by
David S. Miller
Jan 06, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Convert sockets_in_use to use per_cpu areas.
parent
9f698b0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
net/socket.c
net/socket.c
+6
-7
No files found.
net/socket.c
View file @
a773eb63
...
...
@@ -189,10 +189,7 @@ static __inline__ void net_family_read_unlock(void)
* Statistics counters of the socket lists
*/
static
union
{
int
counter
;
char
__pad
[
SMP_CACHE_BYTES
];
}
sockets_in_use
[
NR_CPUS
]
__cacheline_aligned
=
{{
0
}};
static
DEFINE_PER_CPU
(
int
,
sockets_in_use
)
=
0
;
/*
* Support routines. Move socket addresses back and forth across the kernel/user
...
...
@@ -475,7 +472,8 @@ struct socket *sock_alloc(void)
inode
->
i_uid
=
current
->
fsuid
;
inode
->
i_gid
=
current
->
fsgid
;
sockets_in_use
[
smp_processor_id
()].
counter
++
;
get_cpu_var
(
sockets_in_use
)
++
;
put_cpu_var
(
sockets_in_use
);
return
sock
;
}
...
...
@@ -511,7 +509,8 @@ void sock_release(struct socket *sock)
if
(
sock
->
fasync_list
)
printk
(
KERN_ERR
"sock_release: fasync list not empty!
\n
"
);
sockets_in_use
[
smp_processor_id
()].
counter
--
;
get_cpu_var
(
sockets_in_use
)
--
;
put_cpu_var
(
sockets_in_use
);
if
(
!
sock
->
file
)
{
iput
(
SOCK_INODE
(
sock
));
return
;
...
...
@@ -1851,7 +1850,7 @@ void socket_seq_show(struct seq_file *seq)
int
counter
=
0
;
for
(
cpu
=
0
;
cpu
<
NR_CPUS
;
cpu
++
)
counter
+=
sockets_in_use
[
cpu
].
counter
;
counter
+=
per_cpu
(
sockets_in_use
,
cpu
)
;
/* It can be negative, by the way. 8) */
if
(
counter
<
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