aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/ib_cm.c
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_cm.c
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_cm.c')
-rw-r--r--net/rds/ib_cm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index a9fb917c00bb..10f6a8815cd0 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -709,12 +709,19 @@ int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp)
709{ 709{
710 struct rds_ib_connection *ic; 710 struct rds_ib_connection *ic;
711 unsigned long flags; 711 unsigned long flags;
712 int ret;
712 713
713 /* XXX too lazy? */ 714 /* XXX too lazy? */
714 ic = kzalloc(sizeof(struct rds_ib_connection), GFP_KERNEL); 715 ic = kzalloc(sizeof(struct rds_ib_connection), GFP_KERNEL);
715 if (!ic) 716 if (!ic)
716 return -ENOMEM; 717 return -ENOMEM;
717 718
719 ret = rds_ib_recv_alloc_caches(ic);
720 if (ret) {
721 kfree(ic);
722 return ret;
723 }
724
718 INIT_LIST_HEAD(&ic->ib_node); 725 INIT_LIST_HEAD(&ic->ib_node);
719 tasklet_init(&ic->i_recv_tasklet, rds_ib_recv_tasklet_fn, 726 tasklet_init(&ic->i_recv_tasklet, rds_ib_recv_tasklet_fn,
720 (unsigned long) ic); 727 (unsigned long) ic);
@@ -763,6 +770,8 @@ void rds_ib_conn_free(void *arg)
763 list_del(&ic->ib_node); 770 list_del(&ic->ib_node);
764 spin_unlock_irq(lock_ptr); 771 spin_unlock_irq(lock_ptr);
765 772
773 rds_ib_recv_free_caches(ic);
774
766 kfree(ic); 775 kfree(ic);
767} 776}
768 777