aboutsummaryrefslogtreecommitdiffstats
path: root/net/rds/ib_rdma.c
diff options
context:
space:
mode:
authorWengang Wang <wen.gang.wang@oracle.com>2015-08-25 15:02:00 -0400
committerDavid S. Miller <davem@davemloft.net>2015-08-25 19:28:11 -0400
commit6116c2030fff91950f68b7fffb5959c91a05aaf6 (patch)
treec569c731786a9b9e2cfe6f37fe12e52212ab1055 /net/rds/ib_rdma.c
parent3f6b3143031b678a8577df1f24ca977510aefcf5 (diff)
RDS: fix fmr pool dirty_count
In rds_ib_flush_mr_pool(), dirty_count accounts the clean ones which is wrong. This can lead to a negative dirty count value. Lets fix it. Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com> Signed-off-by: Santosh Shilimkar <ssantosh@kernel.org> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/ib_rdma.c')
-rw-r--r--net/rds/ib_rdma.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
index 7b7aac8cdb56..a275b7d205ef 100644
--- a/net/rds/ib_rdma.c
+++ b/net/rds/ib_rdma.c
@@ -528,11 +528,13 @@ static inline unsigned int rds_ib_flush_goal(struct rds_ib_mr_pool *pool, int fr
528/* 528/*
529 * given an llist of mrs, put them all into the list_head for more processing 529 * given an llist of mrs, put them all into the list_head for more processing
530 */ 530 */
531static void llist_append_to_list(struct llist_head *llist, struct list_head *list) 531static unsigned int llist_append_to_list(struct llist_head *llist,
532 struct list_head *list)
532{ 533{
533 struct rds_ib_mr *ibmr; 534 struct rds_ib_mr *ibmr;
534 struct llist_node *node; 535 struct llist_node *node;
535 struct llist_node *next; 536 struct llist_node *next;
537 unsigned int count = 0;
536 538
537 node = llist_del_all(llist); 539 node = llist_del_all(llist);
538 while (node) { 540 while (node) {
@@ -540,7 +542,9 @@ static void llist_append_to_list(struct llist_head *llist, struct list_head *lis
540 ibmr = llist_entry(node, struct rds_ib_mr, llnode); 542 ibmr = llist_entry(node, struct rds_ib_mr, llnode);
541 list_add_tail(&ibmr->unmap_list, list); 543 list_add_tail(&ibmr->unmap_list, list);
542 node = next; 544 node = next;
545 count++;
543 } 546 }
547 return count;
544} 548}
545 549
546/* 550/*
@@ -581,7 +585,7 @@ static int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
581 LIST_HEAD(unmap_list); 585 LIST_HEAD(unmap_list);
582 LIST_HEAD(fmr_list); 586 LIST_HEAD(fmr_list);
583 unsigned long unpinned = 0; 587 unsigned long unpinned = 0;
584 unsigned int nfreed = 0, ncleaned = 0, free_goal; 588 unsigned int nfreed = 0, dirty_to_clean = 0, free_goal;
585 int ret = 0; 589 int ret = 0;
586 590
587 rds_ib_stats_inc(s_ib_rdma_mr_pool_flush); 591 rds_ib_stats_inc(s_ib_rdma_mr_pool_flush);
@@ -623,8 +627,8 @@ static int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
623 /* Get the list of all MRs to be dropped. Ordering matters - 627 /* Get the list of all MRs to be dropped. Ordering matters -
624 * we want to put drop_list ahead of free_list. 628 * we want to put drop_list ahead of free_list.
625 */ 629 */
626 llist_append_to_list(&pool->drop_list, &unmap_list); 630 dirty_to_clean = llist_append_to_list(&pool->drop_list, &unmap_list);
627 llist_append_to_list(&pool->free_list, &unmap_list); 631 dirty_to_clean += llist_append_to_list(&pool->free_list, &unmap_list);
628 if (free_all) 632 if (free_all)
629 llist_append_to_list(&pool->clean_list, &unmap_list); 633 llist_append_to_list(&pool->clean_list, &unmap_list);
630 634
@@ -652,7 +656,6 @@ static int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
652 kfree(ibmr); 656 kfree(ibmr);
653 nfreed++; 657 nfreed++;
654 } 658 }
655 ncleaned++;
656 } 659 }
657 660
658 if (!list_empty(&unmap_list)) { 661 if (!list_empty(&unmap_list)) {
@@ -678,7 +681,7 @@ static int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
678 } 681 }
679 682
680 atomic_sub(unpinned, &pool->free_pinned); 683 atomic_sub(unpinned, &pool->free_pinned);
681 atomic_sub(ncleaned, &pool->dirty_count); 684 atomic_sub(dirty_to_clean, &pool->dirty_count);
682 atomic_sub(nfreed, &pool->item_count); 685 atomic_sub(nfreed, &pool->item_count);
683 686
684out: 687out: