From: Hal Rosenstock <halr@voltaire.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, openib-general@openib.org
Subject: [PATCH 12/27] Eliminate MAD cache leak associated with local completions
Date: 11 Jul 2005 10:17:25 -0400 [thread overview]
Message-ID: <1121089118.4389.4529.camel@hal.voltaire.com> (raw)
Eliminate MAD cache leak associated with local completions.
Also, when canceling MAD, empty local completion list as well.
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
This patch depends on patch 11/27.
--
mad.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)
diff -uprN linux-2.6.13-rc2-mm1/drivers/infiniband11/core/mad.c linux-2.6.13-rc2-mm1/drivers/infiniband12/core/mad.c
-- linux-2.6.13-rc2-mm1/drivers/infiniband11/core/mad.c 2005-07-09 17:41:24.000000000 -0400
+++ linux-2.6.13-rc2-mm1/drivers/infiniband12/core/mad.c 2005-07-09 17:46:10.000000000 -0400
@@ -1994,6 +1994,8 @@ static void cancel_mads(struct ib_mad_ag
/* Empty wait list to prevent receives from finding a request */
list_splice_init(&mad_agent_priv->wait_list, &cancel_list);
+ /* Empty local completion list as well */
+ list_splice_init(&mad_agent_priv->local_list, &cancel_list);
spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
/* Report all cancelled requests */
@@ -2108,6 +2110,7 @@ static void local_completions(void *data
struct ib_mad_local_private *local;
struct ib_mad_agent_private *recv_mad_agent;
unsigned long flags;
+ int recv = 0;
struct ib_wc wc;
struct ib_mad_send_wc mad_send_wc;
@@ -2123,10 +2126,10 @@ static void local_completions(void *data
recv_mad_agent = local->recv_mad_agent;
if (!recv_mad_agent) {
printk(KERN_ERR PFX "No receive MAD agent for local completion\n");
- kmem_cache_free(ib_mad_cache, local->mad_priv);
goto local_send_completion;
}
+ recv = 1;
/*
* Defined behavior is to complete response
* before request
@@ -2169,6 +2172,8 @@ local_send_completion:
spin_lock_irqsave(&mad_agent_priv->lock, flags);
list_del(&local->completion_list);
atomic_dec(&mad_agent_priv->refcount);
+ if (!recv)
+ kmem_cache_free(ib_mad_cache, local->mad_priv);
kfree(local);
}
spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
reply other threads:[~2005-07-11 14:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1121089118.4389.4529.camel@hal.voltaire.com \
--to=halr@voltaire.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=openib-general@openib.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®