Skip to contentSkip to conversation

: Show timer resolution instead of clock resolution in /proc/net/psched

NET_SCHED Applied Patrick McHardy 2 participants 2 messages Oct 10, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Fix incorrect HTB burst rate calculation in userspace when clock and timer resolution differ. I guess this should go in stable 2.6.22/23 as well.

[NET_SCHED]: Show timer resolution instead of clock resolution in /proc/net/psched

The fourth parameter of /proc/net/psched is supposed to show the timer resultion and is used by HTB userspace to calculate the necessary burst rate. Currently we show the clock resolution, which results in a too low burst rate when the two differ.

---
commit a3885788169f2f70634f8142344e5131ccf32595
tree 62bcf28c9706547228521dc4402ebea273326331
parent 0e52ab8ceb41df2104279938484267ab474286d1
author Patrick McHardy <[email protected]> Wed, 10 Oct 2007 16:29:14 +0200 committer Patrick McHardy <[email protected]> Wed, 10 Oct 2007 16:29:14 +0200

 net/sched/sch_api.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
net/sched/sch_api.c +4 -1
index dee0d5f..8f1bcf6 100644
@@ -1225,10 +1225,13 @@ EXPORT_SYMBOL(tcf_destroy_chain);
 #ifdef CONFIG_PROC_FS
 static int psched_show(struct seq_file *seq, void *v)
 {
+	struct timespec ts;
+
+	hrtimer_get_res(CLOCK_MONOTONIC, &ts);
 	seq_printf(seq, "%08x %08x %08x %08x\n",
 		   (u32)NSEC_PER_USEC, (u32)PSCHED_US2NS(1),
 		   1000000,
-		   (u32)NSEC_PER_SEC/(u32)ktime_to_ns(KTIME_MONOTONIC_RES));
+		   (u32)NSEC_PER_SEC/(u32)ktime_to_ns(timespec_to_ktime(ts)));
 
 	return 0;
 }
maintainer Applied
#1 lore raw

From: Patrick McHardy <[email protected]>
Date: Wed, 10 Oct 2007 16:34:24 +0200

Quoted 8 lines

[NET_SCHED]: Show timer resolution instead of clock resolution in /proc/net/psched

The fourth parameter of /proc/net/psched is supposed to show the timer resultion and is used by HTB userspace to calculate the necessary burst rate. Currently we show the clock resolution, which results in a too low burst rate when the two differ.

Applied, thanks Patrick.