diff mbox

[11/11] sch_hfsc.c: remove cl_vtadj, shift virtual curve instead

Message ID 1320460377-8682-12-git-send-email-soltys@ziu.info
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Michal Soltys Nov. 5, 2011, 2:32 a.m. UTC
Instead of keeping intra-period difference, we can simply shift
the virtual curve to the right (as the adjustment is permanent).
---
 net/sched/sch_hfsc.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 2109878..bf38551 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -151,8 +151,6 @@  struct hfsc_class {
 	u64	cl_cvtmin;		/* minimal virtual time among the
 					   children fit for link-sharing
 					   (monotonic within a period) */
-	u64	cl_vtadj;		/* intra-period cumulative vt
-					   adjustment */
 	u64	cl_cvtoff;		/* last (biggest) vt seen between
 					   siblings */
 
@@ -764,7 +762,6 @@  init_vf(struct hfsc_class *cl, unsigned int len)
 			/* update the virtual curve */
 			rtsc_min(&cl->cl_virtual, &cl->cl_fsc, cl->cl_vt, cl->cl_total);
 
-			cl->cl_vtadj = 0;
 			cl->cl_vtperiod++;
 			cl->cl_parentperiod = cl->cl_parent->cl_vtperiod;
 			if (cl->cl_parent->cl_nactive == 0)
@@ -810,17 +807,19 @@  update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time)
 			continue;
 
 		/* update vt */
-		cl->cl_vt = rtsc_y2x(&cl->cl_virtual, cl->cl_total) + cl->cl_vtadj;
+		cl->cl_vt = rtsc_y2x(&cl->cl_virtual, cl->cl_total);
 
 		/*
 		 * fixup vt due to upperlimit (if applicable)
 		 *
-		 * if vt of the class is smaller than cvtmin,
-		 * the class was skipped in the past due to non-fit.
-		 * if so, we need to adjust vtadj.
+		 * if we detect we're lagging past virtual times of other siblings,
+		 * that means we were skipped in the past due to non-fit.
+		 *
+		 * If so we adjust vt and shift virtual curve to match current
+		 * situation.
 		 */
 		if (cl->cl_vt < cl->cl_parent->cl_cvtmin) {
-			cl->cl_vtadj += cl->cl_parent->cl_cvtmin - cl->cl_vt;
+			cl->cl_virtual.x += cl->cl_parent->cl_cvtmin - cl->cl_vt;
 			cl->cl_vt = cl->cl_parent->cl_cvtmin;
 		}
 
@@ -1527,7 +1526,6 @@  hfsc_reset_class(struct hfsc_class *cl)
 	cl->cl_d            = 0;
 	cl->cl_e            = 0;
 	cl->cl_vt           = 0;
-	cl->cl_vtadj        = 0;
 	cl->cl_cvtmin       = 0;
 	cl->cl_cvtoff       = 0;
 	cl->cl_vtperiod     = 0;