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
518538b3
Commit
518538b3
authored
Jul 18, 2003
by
Rusty Russell
Committed by
Linus Torvalds
Jul 18, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] Resolve module local_t conflict
Uses local_t for module reference counts.
parent
f9feecc3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
10 deletions
+5
-10
include/linux/module.h
include/linux/module.h
+2
-7
kernel/module.c
kernel/module.c
+3
-3
No files found.
include/linux/module.h
View file @
518538b3
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include <linux/kmod.h>
#include <linux/kmod.h>
#include <linux/elf.h>
#include <linux/elf.h>
#include <linux/stringify.h>
#include <linux/stringify.h>
#include <asm/local.h>
#include <asm/module.h>
#include <asm/module.h>
...
@@ -171,7 +172,7 @@ void *__symbol_get_gpl(const char *symbol);
...
@@ -171,7 +172,7 @@ void *__symbol_get_gpl(const char *symbol);
struct
module_ref
struct
module_ref
{
{
atomic
_t
count
;
local
_t
count
;
}
____cacheline_aligned
;
}
____cacheline_aligned
;
enum
module_state
enum
module_state
...
@@ -283,12 +284,6 @@ void __symbol_put(const char *symbol);
...
@@ -283,12 +284,6 @@ void __symbol_put(const char *symbol);
#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
void
symbol_put_addr
(
void
*
addr
);
void
symbol_put_addr
(
void
*
addr
);
/* We only need protection against local interrupts. */
#ifndef __HAVE_ARCH_LOCAL_INC
#define local_inc(x) atomic_inc(x)
#define local_dec(x) atomic_dec(x)
#endif
/* Sometimes we know we already have a refcount, and it's easier not
/* Sometimes we know we already have a refcount, and it's easier not
to handle the error case (which only happens with rmmod --wait). */
to handle the error case (which only happens with rmmod --wait). */
static
inline
void
__module_get
(
struct
module
*
module
)
static
inline
void
__module_get
(
struct
module
*
module
)
...
...
kernel/module.c
View file @
518538b3
...
@@ -374,9 +374,9 @@ static void module_unload_init(struct module *mod)
...
@@ -374,9 +374,9 @@ static void module_unload_init(struct module *mod)
INIT_LIST_HEAD
(
&
mod
->
modules_which_use_me
);
INIT_LIST_HEAD
(
&
mod
->
modules_which_use_me
);
for
(
i
=
0
;
i
<
NR_CPUS
;
i
++
)
for
(
i
=
0
;
i
<
NR_CPUS
;
i
++
)
atomic
_set
(
&
mod
->
ref
[
i
].
count
,
0
);
local
_set
(
&
mod
->
ref
[
i
].
count
,
0
);
/* Hold reference count during initialization. */
/* Hold reference count during initialization. */
atomic
_set
(
&
mod
->
ref
[
smp_processor_id
()].
count
,
1
);
local
_set
(
&
mod
->
ref
[
smp_processor_id
()].
count
,
1
);
/* Backwards compatibility macros put refcount during init. */
/* Backwards compatibility macros put refcount during init. */
mod
->
waiter
=
current
;
mod
->
waiter
=
current
;
}
}
...
@@ -599,7 +599,7 @@ unsigned int module_refcount(struct module *mod)
...
@@ -599,7 +599,7 @@ unsigned int module_refcount(struct module *mod)
unsigned
int
i
,
total
=
0
;
unsigned
int
i
,
total
=
0
;
for
(
i
=
0
;
i
<
NR_CPUS
;
i
++
)
for
(
i
=
0
;
i
<
NR_CPUS
;
i
++
)
total
+=
atomic
_read
(
&
mod
->
ref
[
i
].
count
);
total
+=
local
_read
(
&
mod
->
ref
[
i
].
count
);
return
total
;
return
total
;
}
}
EXPORT_SYMBOL
(
module_refcount
);
EXPORT_SYMBOL
(
module_refcount
);
...
...
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