From: pravin b shelar <pravins@calsoftinc.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: christoph@lameter.com, netdev@oss.sgi.com, davem@davemloft.net
Subject: Re: Fwd: atomic_dec_and_test for child dst needed in dst_destroy?
Date: Thu, 07 Apr 2005 18:00:16 +0530 [thread overview]
Message-ID: <425527D8.4030408@calsoftinc.com> (raw)
In-Reply-To: <E1DJV6r-0002Nu-00@gondolin.me.apana.org.au>
[-- Attachment #1: Type: text/plain, Size: 637 bytes --]
Herbert Xu wrote:
>pravin b shelar <pravins@calsoftinc.com> wrote:
>
>
>>This patch will remove the need for atomic_dec_and_test for this
>>particular case.
>>Now we can break down the atomic_dec_and_test to atomic_dec & atomic_read.
>>
>>
>
>Sorry I overlooked your patch. Otherwise we could have solved this
>one day earlier :)
>
>
ah ... I was just waiting :)
>
>
>>Please comment.
>>
>>
>
>There is just one problem. We need an extra barrier before or after
>the goto since we no longer have the implicit barrier given by
>atomic_dec_and_test.
>
>
I am attaching updated patch with barrier.
Regards,
Pravin.
[-- Attachment #2: dst-atomic_dec_and_test-removed.patch --]
[-- Type: text/x-patch, Size: 1176 bytes --]
This patch removes atomic_dec_and_test from dst_destroy, used to test child dst __refcnt.
Signed-off by: Pravin B. Shelar <pravins@calsoftinc.com>
Index: linux-2.6.11-dsta/net/core/dst.c
===================================================================
--- linux-2.6.11-dsta.orig/net/core/dst.c 2005-04-06 00:18:32.000000000 -0700
+++ linux-2.6.11-dsta/net/core/dst.c 2005-04-07 04:53:28.000000000 -0700
@@ -198,17 +198,21 @@
dst = child;
if (dst) {
- if (atomic_dec_and_test(&dst->__refcnt)) {
- /* We were real parent of this dst, so kill child. */
- if (dst->flags&DST_NOHASH)
- goto again;
- } else {
- /* Child is still referenced, return it for freeing. */
- if (dst->flags&DST_NOHASH)
- return dst;
- /* Child is still in his hash table */
+ if (dst->flags&DST_NOHASH) {
+ atomic_dec(&dst->__refcnt);
+ smp_mb__after_atomic_dec();
+
+ if (atomic_read(&dst->__refcnt))
+ /*-- Child is still referenced, return it for freeing. */
+ return dst;
+
+ /*We were real parent of this dst, so kill child. */
+ goto again;
}
+ else /* Child is still in his hash table */
+ atomic_dec(&dst->__refcnt);
}
+
return NULL;
}
prev parent reply other threads:[~2005-04-07 12:30 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-05 18:55 atomic_dec_and_test for child dst needed in dst_destroy? Christoph Lameter
2005-04-05 19:34 ` David S. Miller
2005-04-05 19:47 ` Christoph Lameter
2005-04-05 19:50 ` David S. Miller
2005-04-05 19:58 ` Christoph Lameter
2005-04-05 20:12 ` David S. Miller
2005-04-05 21:45 ` Herbert Xu
2005-04-05 21:48 ` David S. Miller
2005-04-05 22:14 ` Christoph Lameter
2005-04-06 2:19 ` Herbert Xu
2005-04-06 3:19 ` Christoph Lameter
2005-04-06 8:32 ` Herbert Xu
2005-04-06 18:17 ` David S. Miller
2005-04-06 18:48 ` Christoph Lameter
2005-04-07 11:07 ` Herbert Xu
2005-04-07 16:00 ` Christoph Lameter
2005-04-07 21:25 ` Herbert Xu
2005-04-07 22:30 ` Christoph Lameter
2005-04-07 23:07 ` Herbert Xu
2005-04-08 5:45 ` Christoph Lameter
2005-04-08 5:48 ` Herbert Xu
2005-04-08 15:05 ` Christoph Lameter
2005-04-08 21:45 ` Herbert Xu
2005-04-09 15:28 ` Christoph Lameter
[not found] ` <b82a8917050406002339f732ca@mail.gmail.com>
2005-04-06 8:53 ` Fwd: " pravin b shelar
2005-04-07 11:23 ` Herbert Xu
2005-04-07 12:30 ` pravin b shelar [this message]
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=425527D8.4030408@calsoftinc.com \
--to=pravins@calsoftinc.com \
--cc=christoph@lameter.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@oss.sgi.com \
/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;
as well as URLs for NNTP newsgroup(s).