summaryrefslogtreecommitdiffstats
path: root/net/tipc/ref.h
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2014-08-22 18:09:16 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-23 14:18:34 -0400
commit6c9808ce09f778a1de7b207b82cfc36a59cda2d3 (patch)
treedce467a4bd4be90896e7243f87335e1b41cded75 /net/tipc/ref.h
parent9b50fd087a9f1454d6a8b613fff376dfb6d6ea93 (diff)
tipc: remove port_lock
In previous commits we have reduced usage of port_lock to a minimum, and complemented it with usage of bh_lock_sock() at the remaining locations. The purpose has been to remove this lock altogether, since it largely duplicates the role of bh_lock_sock. We are now ready to do this. However, we still need to protect the BH callers from inadvertent release of the socket while they hold a reference to it. We do this by replacing port_lock by a combination of a rw-lock protecting the reference table as such, and updating the socket reference counter while the socket is referenced from BH. This technique is more standard and comprehensible than the previous approach, and turns out to have a positive effect on overall performance. Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/ref.h')
-rw-r--r--net/tipc/ref.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/net/tipc/ref.h b/net/tipc/ref.h
index e236fa520a1d..2b75a892305a 100644
--- a/net/tipc/ref.h
+++ b/net/tipc/ref.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * net/tipc/ref.h: Include file for TIPC object registry code 2 * net/tipc/ref.h: Include file for TIPC object registry code
3 * 3 *
4 * Copyright (c) 1991-2006, Ericsson AB 4 * Copyright (c) 1991-2006, 2014, Ericsson AB
5 * Copyright (c) 2005-2006, Wind River Systems 5 * Copyright (c) 2005-2006, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
@@ -37,13 +37,20 @@
37#ifndef _TIPC_REF_H 37#ifndef _TIPC_REF_H
38#define _TIPC_REF_H 38#define _TIPC_REF_H
39 39
40#include "socket.h"
41
40int tipc_ref_table_init(u32 requested_size, u32 start); 42int tipc_ref_table_init(u32 requested_size, u32 start);
41void tipc_ref_table_stop(void); 43void tipc_ref_table_stop(void);
42 44
43u32 tipc_ref_acquire(void *object, spinlock_t **lock); 45u32 tipc_ref_acquire(struct tipc_sock *tsk);
44void tipc_ref_discard(u32 ref); 46void tipc_ref_discard(u32 ref);
45 47
46void *tipc_ref_lock(u32 ref); 48struct tipc_sock *tipc_sk_get(u32 ref);
47void *tipc_ref_lock_next(u32 *ref); 49struct tipc_sock *tipc_sk_get_next(u32 *ref);
50
51static inline void tipc_sk_put(struct tipc_sock *tsk)
52{
53 sock_put(&tsk->sk);
54}
48 55
49#endif 56#endif