From: Jesper Dangaard Brouer <jdb@comx.dk>
To: "David S. Miller" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Martin Devera <devik@cdi.cz>
Subject: [PATCH 2/2] Change HTB_HYSTERESIS to a runtime parameter htb_hysteresis.
Date: Tue, 03 Jun 2008 16:06:32 +0200 [thread overview]
Message-ID: <1212501992.13164.33.camel@localhost.localdomain> (raw)
In-Reply-To: <1212501803.13164.27.camel@localhost.localdomain>
Add a htb_hysteresis parameter to htb_sch.ko and by sysfs magic make
it runtime adjustable via /sys/module/sch_htb/parameters/htb_hysteresis
mode 640.
Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
---
net/sched/sch_htb.c | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 9134f02..6807c97 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -28,6 +28,7 @@
* $Id: sch_htb.c,v 1.25 2003/12/07 11:08:25 devik Exp devik $
*/
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/string.h>
@@ -53,13 +54,17 @@
*/
#define HTB_HSIZE 16 /* classid hash size */
-#define HTB_HYSTERESIS 0 /* whether to use mode hysteresis for speedup */
+static int htb_hysteresis __read_mostly = 0; /* whether to use mode hysteresis for speedup */
#define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */
#if HTB_VER >> 16 != TC_HTB_PROTOVER
#error "Mismatched sch_htb.c and pkt_sch.h"
#endif
+/* Module parameter and sysfs export */
+module_param (htb_hysteresis, int, 0640);
+MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate");
+
/* used internaly to keep status of single class */
enum htb_cmode {
HTB_CANT_SEND, /* class can't send and can't borrow */
@@ -462,19 +467,21 @@ static void htb_deactivate_prios(struct htb_sched *q, struct htb_class *cl)
htb_remove_class_from_row(q, cl, mask);
}
-#if HTB_HYSTERESIS
static inline long htb_lowater(const struct htb_class *cl)
{
- return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0;
+ if (htb_hysteresis)
+ return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0;
+ else
+ return 0;
}
static inline long htb_hiwater(const struct htb_class *cl)
{
- return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0;
+ if (htb_hysteresis)
+ return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0;
+ else
+ return 0;
}
-#else
-#define htb_lowater(cl) (0)
-#define htb_hiwater(cl) (0)
-#endif
+
/**
* htb_class_mode - computes and returns current class mode
--
1.5.4.2
next prev parent reply other threads:[~2008-06-03 14:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-03 14:03 [PATCH 0/2] HTB scheduler HTB_HYSTERESIS modifications Jesper Dangaard Brouer
2008-06-03 14:05 ` [PATCH 1/2] HTB scheduler, change default hysteresis mode to off Jesper Dangaard Brouer
2008-06-03 14:06 ` Jesper Dangaard Brouer [this message]
2008-06-04 13:05 ` [PATCH 0/2] HTB scheduler HTB_HYSTERESIS modifications Martin Devera
2008-06-04 14:28 ` Jesper Dangaard Brouer
2008-06-04 15:31 ` Martin Devera
2008-06-12 10:01 ` Jesper Dangaard Brouer
2008-06-14 9:18 ` Martin Devera
2008-06-16 23:40 ` David Miller
2008-06-17 1:00 ` Denys Fedoryshchenko
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=1212501992.13164.33.camel@localhost.localdomain \
--to=jdb@comx.dk \
--cc=davem@davemloft.net \
--cc=devik@cdi.cz \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).