Skip to content

Commit 5de3861

Browse files
Wengang-oracleMukesh Kacker
authored andcommitted
rds: set fmr pool dirty_count correctly
In rds_ib_flush_mr_pool() the setting of dirty_count is wrong in case "free_all" is true -- "clean" ones also counted as dirty. dirty_count being negative is seen in vmcore. Orabug: 21551548 Signed-off-by: Wengang Wang <[email protected]> Reviewed-by: Chien-Hua Yen <[email protected]>
1 parent 2c704cd commit 5de3861

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

net/rds/ib_rdma.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -599,12 +599,14 @@ static inline unsigned int rds_ib_flush_goal(struct rds_ib_mr_pool *pool, int fr
599599
/*
600600
* given an xlist of mrs, put them all into the list_head for more processing
601601
*/
602-
static void xlist_append_to_list(struct xlist_head *xlist, struct list_head *list)
602+
static int xlist_append_to_list(struct xlist_head *xlist,
603+
struct list_head *list)
603604
{
604605
struct rds_ib_mr *ibmr;
605606
struct xlist_head splice;
606607
struct xlist_head *cur;
607608
struct xlist_head *next;
609+
int count = 0;
608610

609611
splice.next = NULL;
610612
xlist_splice(xlist, &splice);
@@ -614,7 +616,9 @@ static void xlist_append_to_list(struct xlist_head *xlist, struct list_head *lis
614616
ibmr = list_entry(cur, struct rds_ib_mr, xlist);
615617
list_add_tail(&ibmr->unmap_list, list);
616618
cur = next;
619+
count++;
617620
}
621+
return count;
618622
}
619623

620624
/*
@@ -654,7 +658,7 @@ static int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
654658
LIST_HEAD(unmap_list);
655659
LIST_HEAD(fmr_list);
656660
unsigned long unpinned = 0;
657-
unsigned int nfreed = 0, ncleaned = 0, free_goal;
661+
unsigned int nfreed = 0, dirty_to_clean = 0, free_goal;
658662
int ret = 0;
659663

660664
if (pool->pool_type == RDS_IB_MR_8K_POOL)
@@ -699,8 +703,8 @@ static int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
699703
/* Get the list of all MRs to be dropped. Ordering matters -
700704
* we want to put drop_list ahead of free_list.
701705
*/
702-
xlist_append_to_list(&pool->drop_list, &unmap_list);
703-
xlist_append_to_list(&pool->free_list, &unmap_list);
706+
dirty_to_clean = xlist_append_to_list(&pool->drop_list, &unmap_list);
707+
dirty_to_clean += xlist_append_to_list(&pool->free_list, &unmap_list);
704708
if (free_all)
705709
xlist_append_to_list(&pool->clean_list, &unmap_list);
706710

@@ -731,7 +735,6 @@ static int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
731735
kfree(ibmr);
732736
nfreed++;
733737
}
734-
ncleaned++;
735738
}
736739

737740
if (!list_empty(&unmap_list)) {
@@ -757,7 +760,7 @@ static int rds_ib_flush_mr_pool(struct rds_ib_mr_pool *pool,
757760
}
758761

759762
atomic_sub(unpinned, &pool->free_pinned);
760-
atomic_sub(ncleaned, &pool->dirty_count);
763+
atomic_sub(dirty_to_clean, &pool->dirty_count);
761764
atomic_sub(nfreed, &pool->item_count);
762765

763766
out:

0 commit comments

Comments
 (0)