From patchwork Sat Nov 5 02:32:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Soltys X-Patchwork-Id: 123800 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A4D19B70BB for ; Sat, 5 Nov 2011 13:33:14 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753536Ab1KECdJ (ORCPT ); Fri, 4 Nov 2011 22:33:09 -0400 Received: from tha.ppgk.com.pl ([77.252.116.179]:6168 "EHLO tha.ppgk.com.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753429Ab1KECdI (ORCPT ); Fri, 4 Nov 2011 22:33:08 -0400 Received: from localhost.ppgk.com.pl (localhost [127.0.0.1]) by tha.ppgk.com.pl (Postfix) with ESMTP id 736ED375F8; Sat, 5 Nov 2011 03:33:06 +0100 (CET) X-PPGK-Scanned: amavisd-new 2.6.4 (20090625) at ppgk.com.pl Received: from tha.ppgk.com.pl ([127.0.0.1]) by localhost.ppgk.com.pl (tha.ppgk.com.pl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id edntnkgmO2bc; Sat, 5 Nov 2011 03:33:05 +0100 (CET) Received: from localhost.localdomain (89-68-135-233.dynamic.chello.pl [89.68.135.233]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by tha.ppgk.com.pl (Postfix) with ESMTPSA id E7938375E5; Sat, 5 Nov 2011 03:33:03 +0100 (CET) From: Michal Soltys To: kaber@trash.net Cc: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH 02/11] sch_hfsc.c: go passive after cl_vt update in update_vf() Date: Sat, 5 Nov 2011 03:32:48 +0100 Message-Id: <1320460377-8682-3-git-send-email-soltys@ziu.info> X-Mailer: git-send-email 1.7.7.1 In-Reply-To: <1320460377-8682-1-git-send-email-soltys@ziu.info> References: <1320460377-8682-1-git-send-email-soltys@ziu.info> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In contrast to RT and UL curves - which are based on actual time and can always be properly initialized, LS is based on virtual time, which we initialize manually, in three possible ways: 1. (max + min) / 2 of active siblings (min must not be upperlimited) 2. do not adjust existing vt, if parent has the same backlog period and newly calculated vt is smaller 3. initialize to cumulative cvtmax of all periods In the hfsc paper, update_vf() was not responsible for setting class passive - it only updated linksharing related stuff. So update chores first, passivity second (if applicable). In one of the patches to altq, setting class passive was merged into update_vf(), but in doing so, go_passive condition was checked /before/ vt update. This conflicts with point (2.), as vt tested at that point doesn't reflect the situation after the last dequeue - and we update virtual time curve later, after updating vt itself. It also kind of conflicts with (3.) for single-packet backlog periods, as vt will never move to the right, but total work will keep increasing (this is handled by rtsc_min() conditions though, so the results are still generally valid). Signed-off-by: Michal Soltys --- net/sched/sch_hfsc.c | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-) diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 261accc..6b73725 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c @@ -776,6 +776,22 @@ update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time) if (!(cl->cl_flags & HFSC_FSC) || cl->cl_nactive == 0) continue; + /* update vt */ + cl->cl_vt = rtsc_y2x(&cl->cl_virtual, cl->cl_total) + - cl->cl_vtoff + cl->cl_vtadj; + + /* + * 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 (cl->cl_vt < cl->cl_parent->cl_cvtmin) { + cl->cl_vtadj += cl->cl_parent->cl_cvtmin - cl->cl_vt; + cl->cl_vt = cl->cl_parent->cl_cvtmin; + } + if (go_passive && --cl->cl_nactive == 0) go_passive = 1; else @@ -797,25 +813,10 @@ update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time) continue; } - /* - * update vt and f - */ - cl->cl_vt = rtsc_y2x(&cl->cl_virtual, cl->cl_total) - - cl->cl_vtoff + cl->cl_vtadj; - - /* - * 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 (cl->cl_vt < cl->cl_parent->cl_cvtmin) { - cl->cl_vtadj += cl->cl_parent->cl_cvtmin - cl->cl_vt; - cl->cl_vt = cl->cl_parent->cl_cvtmin; - } - /* update the vt tree */ vttree_update(cl); + /* update ft */ if (cl->cl_flags & HFSC_USC) { cl->cl_myf = cl->cl_myfadj + rtsc_y2x(&cl->cl_ulimit, cl->cl_total);