LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Pete Wyckoff <pw@osc.edu>
To: Roland Dreier <rdreier@cisco.com>
Cc: Olaf Kirch <olaf.kirch@oracle.com>,
	general@lists.openfabrics.org, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] ib fmr pool: flush used clean entries
Date: Tue, 26 Feb 2008 13:27:53 -0500	[thread overview]
Message-ID: <20080226182753.GF7033@osc.edu> (raw)
In-Reply-To: <20080226182655.GD7033@osc.edu>

Commit a3cd7d9070be417a21905c997ee32d756d999b38 (IB/fmr_pool:
ib_fmr_pool_flush() should flush all dirty FMRs) caused a
regression for iSER and was reverted in
e5507736c6449b3253347eed6f8ea77a28cf688e.

This change attempts to redo the original patch so that all used
FMR entries are flushed when ib_flush_fmr_pool() is called,
and other FMR users are not affected.  Simply move used entries
from the clean list onto the dirty list before letting the
cleanup thread do its job.

Signed-off-by: Pete Wyckoff <pw@osc.edu>
---
 drivers/infiniband/core/fmr_pool.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c
index 4044fdf..06d502c 100644
--- a/drivers/infiniband/core/fmr_pool.c
+++ b/drivers/infiniband/core/fmr_pool.c
@@ -398,8 +398,23 @@ EXPORT_SYMBOL(ib_destroy_fmr_pool);
  */
 int ib_flush_fmr_pool(struct ib_fmr_pool *pool)
 {
-	int serial = atomic_inc_return(&pool->req_ser);
+	int serial;
+	struct ib_pool_fmr *fmr, *next;
+
+	/*
+	 * The free_list holds FMRs that may have been used
+	 * but have not been remapped enough times to be dirty.
+	 * Put them on the dirty list now so that the cleanup
+	 * thread will reap them too.
+	 */
+	spin_lock_irq(&pool->pool_lock);
+	list_for_each_entry_safe(fmr, next, &pool->free_list, list) {
+		if (fmr->remap_count > 0)
+			list_move(&fmr->list, &pool->dirty_list);
+	}
+	spin_unlock_irq(&pool->pool_lock);
 
+	serial = atomic_inc_return(&pool->req_ser);
 	wake_up_process(pool->thread);
 
 	if (wait_event_interruptible(pool->force_wait,
-- 
1.5.4.1


  parent reply	other threads:[~2008-02-26 18:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080225225330.GA3316@osc.edu>
     [not found] ` <ada1w70zlkf.fsf@cisco.com>
2008-02-26 18:26   ` [PATCH 0/2] (was Re: [ofa-general] fmr pool free_list empty) Pete Wyckoff
2008-02-26 18:27     ` [PATCH 1/2] Revert "IB/fmr_pool: ib_fmr_pool_flush() should flush all dirty FMRs" Pete Wyckoff
2008-02-26 19:23       ` Benny Halevy
2008-02-26 19:39         ` Matthew Wilcox
2008-02-26 19:47           ` Benny Halevy
2008-02-29 21:29       ` Roland Dreier
2008-02-26 18:27     ` Pete Wyckoff [this message]
2008-02-26 20:09       ` [ofa-general] [PATCH 2/2] ib fmr pool: flush used clean entries Roland Dreier
2008-02-26 21:58         ` Olaf Kirch
2008-02-29 21:32       ` Roland Dreier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080226182753.GF7033@osc.edu \
    --to=pw@osc.edu \
    --cc=general@lists.openfabrics.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=olaf.kirch@oracle.com \
    --cc=rdreier@cisco.com \
    --subject='Re: [PATCH 2/2] ib fmr pool: flush used clean entries' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).