diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-11-11 01:06:01 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-11-11 01:06:01 -0500 |
commit | 9305cfa4443dbfb99faf35c5603ec0c0e91b5ef8 (patch) | |
tree | 957551b7016caedcb6f85ec733e6a14d6707096f | |
parent | 8032b46489e50ef8f3992159abd0349b5b8e476c (diff) |
[AF_UNIX]: Make unix_tot_inflight counter non-atomic
This counter is _always_ modified under the unix_gc_lock spinlock,
so its atomicity can be provided w/o additional efforts.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/af_unix.h | 2 | ||||
-rw-r--r-- | net/unix/af_unix.c | 2 | ||||
-rw-r--r-- | net/unix/garbage.c | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 0864a775de24..a1c805d7f488 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -12,7 +12,7 @@ extern void unix_gc(void); | |||
12 | 12 | ||
13 | #define UNIX_HASH_SIZE 256 | 13 | #define UNIX_HASH_SIZE 256 |
14 | 14 | ||
15 | extern atomic_t unix_tot_inflight; | 15 | extern unsigned int unix_tot_inflight; |
16 | 16 | ||
17 | struct unix_address { | 17 | struct unix_address { |
18 | atomic_t refcnt; | 18 | atomic_t refcnt; |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 515e7a692f9b..ab9048ac197f 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -457,7 +457,7 @@ static int unix_release_sock (struct sock *sk, int embrion) | |||
457 | * What the above comment does talk about? --ANK(980817) | 457 | * What the above comment does talk about? --ANK(980817) |
458 | */ | 458 | */ |
459 | 459 | ||
460 | if (atomic_read(&unix_tot_inflight)) | 460 | if (unix_tot_inflight) |
461 | unix_gc(); /* Garbage collect fds */ | 461 | unix_gc(); /* Garbage collect fds */ |
462 | 462 | ||
463 | return 0; | 463 | return 0; |
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 406b6433e467..399717ed7b9d 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -92,7 +92,7 @@ static LIST_HEAD(gc_inflight_list); | |||
92 | static LIST_HEAD(gc_candidates); | 92 | static LIST_HEAD(gc_candidates); |
93 | static DEFINE_SPINLOCK(unix_gc_lock); | 93 | static DEFINE_SPINLOCK(unix_gc_lock); |
94 | 94 | ||
95 | atomic_t unix_tot_inflight = ATOMIC_INIT(0); | 95 | unsigned int unix_tot_inflight; |
96 | 96 | ||
97 | 97 | ||
98 | static struct sock *unix_get_socket(struct file *filp) | 98 | static struct sock *unix_get_socket(struct file *filp) |
@@ -133,7 +133,7 @@ void unix_inflight(struct file *fp) | |||
133 | } else { | 133 | } else { |
134 | BUG_ON(list_empty(&u->link)); | 134 | BUG_ON(list_empty(&u->link)); |
135 | } | 135 | } |
136 | atomic_inc(&unix_tot_inflight); | 136 | unix_tot_inflight++; |
137 | spin_unlock(&unix_gc_lock); | 137 | spin_unlock(&unix_gc_lock); |
138 | } | 138 | } |
139 | } | 139 | } |
@@ -147,7 +147,7 @@ void unix_notinflight(struct file *fp) | |||
147 | BUG_ON(list_empty(&u->link)); | 147 | BUG_ON(list_empty(&u->link)); |
148 | if (atomic_dec_and_test(&u->inflight)) | 148 | if (atomic_dec_and_test(&u->inflight)) |
149 | list_del_init(&u->link); | 149 | list_del_init(&u->link); |
150 | atomic_dec(&unix_tot_inflight); | 150 | unix_tot_inflight--; |
151 | spin_unlock(&unix_gc_lock); | 151 | spin_unlock(&unix_gc_lock); |
152 | } | 152 | } |
153 | } | 153 | } |