netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: jamal <hadi@cyberus.ca>
Cc: Maillist netdev <netdev@oss.sgi.com>
Subject: [PATCH PKT_SCHED 17/22]: tc actions: remove unnecessary locking for refcnt changes
Date: Mon, 10 Jan 2005 20:38:12 +0100	[thread overview]
Message-ID: <41E2D9A4.6050004@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

BTW: This part in pkt_act.h looks kind of strange:

tcf_hash_check:
                if (bind) {
                        p->bindcnt++;
                        p->refcnt++;
                }

but tcf_hash_release:
                if (bind) {
                        p->bindcnt--;
                }
                p->refcnt--;

Shouldn't refcnt be incremented unconditionally ?


[-- Attachment #2: 17.diff --]
[-- Type: text/x-patch, Size: 2033 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/01/10 03:14:38+01:00 kaber@coreworks.de 
#   [PKT_SCHED]: tc actions: remove unnecessary locking for refcnt changes
#   
#   refcnt/bindcnt are only used in user context under the rtnl, no additional
#   locking is necessary. Besides it was only done in some places, so kill it.
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/sched/police.c
#   2005/01/10 03:14:31+01:00 kaber@coreworks.de +0 -2
#   [PKT_SCHED]: tc actions: remove unnecessary locking for refcnt changes
#   
#   refcnt/bindcnt are only used in user context under the rtnl, no additional
#   locking is necessary. Besides it was only done in some places, so kill it.
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# include/net/pkt_act.h
#   2005/01/10 03:14:31+01:00 kaber@coreworks.de +1 -3
#   [PKT_SCHED]: tc actions: remove unnecessary locking for refcnt changes
#   
#   refcnt/bindcnt are only used in user context under the rtnl, no additional
#   locking is necessary. Besides it was only done in some places, so kill it.
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/include/net/pkt_act.h b/include/net/pkt_act.h
--- a/include/net/pkt_act.h	2005-01-10 06:22:58 +01:00
+++ b/include/net/pkt_act.h	2005-01-10 06:22:58 +01:00
@@ -222,13 +222,11 @@
 {
 	struct tcf_st *p = NULL;
 	if (index && (p = tcf_hash_lookup(index)) != NULL) {
-		spin_lock(&p->lock);
 		if (bind) {
 			p->bindcnt++;
 			p->refcnt++;
 		}
-		spin_unlock(&p->lock);
-		a->priv = (void *) p;
+		a->priv = p;
 	}
 	return p;
 }
diff -Nru a/net/sched/police.c b/net/sched/police.c
--- a/net/sched/police.c	2005-01-10 06:22:58 +01:00
+++ b/net/sched/police.c	2005-01-10 06:22:58 +01:00
@@ -189,12 +189,10 @@
 
 	if (parm->index && (p = tcf_police_lookup(parm->index)) != NULL) {
 		a->priv = p;
-		spin_lock(&p->lock);
 		if (bind) {
 			p->bindcnt += 1;
 			p->refcnt += 1;
 		}
-		spin_unlock(&p->lock);
 		if (ovr)
 			goto override;
 		return ret;

                 reply	other threads:[~2005-01-10 19:38 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=41E2D9A4.6050004@trash.net \
    --to=kaber@trash.net \
    --cc=hadi@cyberus.ca \
    --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).