aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/ib.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2010-05-27 01:05:37 -0400
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:15:23 -0400
commit33244125871734ebc0d8d147680a0d7e99385e0b (patch)
treec4dad958a4de167f5b954e91bc90d69000cd89c1 /net/rds/ib.h
parentfc24f78085e8771670af42f2b8929b16a0c98a22 (diff)
RDS/IB: Add caching of frags and incs
This patch is based heavily on an initial patch by Chris Mason. Instead of freeing slab memory and pages, it keeps them, and funnels them back to be reused. The lock minimization strategy uses xchg and cmpxchg atomic ops for manipulation of pointers to list heads. We anchor the lists with a pointer to a list_head struct instead of a static list_head struct. We just have to carefully use the existing primitives with the difference between a pointer and a static head struct. For example, 'list_empty()' means that our anchor pointer points to a list with a single item instead of meaning that our static head element doesn't point to any list items. Original patch by Chris, with significant mods and fixes by Andy and Zach. Signed-off-by: Chris Mason <chris.mason@oracle.com> Signed-off-by: Andy Grover <andy.grover@oracle.com> Signed-off-by: Zach Brown <zach.brown@oracle.com>
Diffstat (limited to 'net/rds/ib.h')
-rw-r--r--net/rds/ib.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/rds/ib.h b/net/rds/ib.h
index 9bb7a7412a44..2efd9d11e7d4 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -21,6 +21,8 @@
21 21
22#define RDS_IB_SUPPORTED_PROTOCOLS 0x00000003 /* minor versions supported */ 22#define RDS_IB_SUPPORTED_PROTOCOLS 0x00000003 /* minor versions supported */
23 23
24#define RDS_IB_RECYCLE_BATCH_COUNT 32
25
24extern struct list_head rds_ib_devices; 26extern struct list_head rds_ib_devices;
25 27
26/* 28/*
@@ -30,14 +32,27 @@ extern struct list_head rds_ib_devices;
30 */ 32 */
31struct rds_page_frag { 33struct rds_page_frag {
32 struct list_head f_item; 34 struct list_head f_item;
35 struct list_head f_cache_entry;
33 struct scatterlist f_sg; 36 struct scatterlist f_sg;
34}; 37};
35 38
36struct rds_ib_incoming { 39struct rds_ib_incoming {
37 struct list_head ii_frags; 40 struct list_head ii_frags;
41 struct list_head ii_cache_entry;
38 struct rds_incoming ii_inc; 42 struct rds_incoming ii_inc;
39}; 43};
40 44
45struct rds_ib_cache_head {
46 struct list_head *first;
47 unsigned long count;
48};
49
50struct rds_ib_refill_cache {
51 struct rds_ib_cache_head *percpu;
52 struct list_head *xfer;
53 struct list_head *ready;
54};
55
41struct rds_ib_connect_private { 56struct rds_ib_connect_private {
42 /* Add new fields at the end, and don't permute existing fields. */ 57 /* Add new fields at the end, and don't permute existing fields. */
43 __be32 dp_saddr; 58 __be32 dp_saddr;
@@ -104,6 +119,8 @@ struct rds_ib_connection {
104 u64 i_recv_hdrs_dma; 119 u64 i_recv_hdrs_dma;
105 struct rds_ib_recv_work *i_recvs; 120 struct rds_ib_recv_work *i_recvs;
106 u64 i_ack_recv; /* last ACK received */ 121 u64 i_ack_recv; /* last ACK received */
122 struct rds_ib_refill_cache i_cache_incs;
123 struct rds_ib_refill_cache i_cache_frags;
107 124
108 /* sending acks */ 125 /* sending acks */
109 unsigned long i_ack_flags; 126 unsigned long i_ack_flags;
@@ -304,6 +321,8 @@ void rds_ib_flush_mrs(void);
304int __init rds_ib_recv_init(void); 321int __init rds_ib_recv_init(void);
305void rds_ib_recv_exit(void); 322void rds_ib_recv_exit(void);
306int rds_ib_recv(struct rds_connection *conn); 323int rds_ib_recv(struct rds_connection *conn);
324int rds_ib_recv_alloc_caches(struct rds_ib_connection *ic);
325void rds_ib_recv_free_caches(struct rds_ib_connection *ic);
307int rds_ib_recv_refill(struct rds_connection *conn, int prefill); 326int rds_ib_recv_refill(struct rds_connection *conn, int prefill);
308void rds_ib_inc_free(struct rds_incoming *inc); 327void rds_ib_inc_free(struct rds_incoming *inc);
309int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iovec *iov, 328int rds_ib_inc_copy_to_user(struct rds_incoming *inc, struct iovec *iov,