From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 89B463B29D for ; Tue, 22 Jun 2021 10:25:10 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624371910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tQubmPTLnQfIPKw4yN/G3gcFBs8p8BToeGjR7DUDd2E=; b=cK6f2tKasAWHK4yWUatfDKgWOii6Typhvj/9FFW1OlxmSehAEgAYRhby6+DZlo1S2Xehy3 tRR2u3WdoMyO4Pq8GoIkrd8qgsj+XzkV1C6waXMFYWyFi4kjKEO72iiGwg3aOrCbC7+Fnn xBnouxnNNXFtNIrZ+RZVE2Jh4VA8bH0= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-rQineN1pOh-Qcl9ejpv7Uw-1; Tue, 22 Jun 2021 10:25:08 -0400 X-MC-Unique: rQineN1pOh-Qcl9ejpv7Uw-1 Received: by mail-ed1-f69.google.com with SMTP id z5-20020a05640235c5b0290393974bcf7eso9587221edc.2 for ; Tue, 22 Jun 2021 07:25:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=LCflcc9DDHTNNAkd92nsNiNwbbVljRsMVFiiBCW1kJ0=; b=rtDlHrTm17QK47Ng7Udidt4EHJYwPEkdXTZno56577hf3i8vcQKXk92lmFmbIHgo+o FFuZs1/9KBXBLP22jdlyRPjKrjAyeHIRj5Z2s7YdZxNSTmat84+IwQ8NPSebG3g+mDdm NC6kM110/IwQsmQB4rkdX0AgT7XCRC3jkxdtkOtlcwwhkjbLCixUobJEN3vM4Tv+ZrAY /ebGEaPQmn9kLBRQsNcvy+6pNGCw0NxOftmjJfV+ZgjxM8FjkuaU0gacfZ76JC0JKldl OhO0mv+qCKnAHsLwQ2W7Wku91qaVBx8zOBqjefD1PM1N0rn1mzRcIYYXakyzfA2U7ePb HqXg== X-Gm-Message-State: AOAM531WiYQ8Oi37E4ii+OuFJdOWk22zjr/OjFEobilevUGyvdiYCYoA qOxBqeP2m3Pdm2hZ4DmSA1MVU6BiBllypmCPDG1r1wQHosfqb4zVA89k8H1np45o4lek1Ldwt8B 5VFhK1Yaqp8Ga07uGJUYwaDHwoaBNZQXHjtk= X-Received: by 2002:a17:906:724b:: with SMTP id n11mr4294471ejk.338.1624371907352; Tue, 22 Jun 2021 07:25:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfhQ9n159wBTBj85gnBrCTgrjxKuGkYGuGtBN1OcVEly2AURLap2vSlV+EfQGSjnfFnVPIRw== X-Received: by 2002:a17:906:724b:: with SMTP id n11mr4294452ejk.338.1624371907193; Tue, 22 Jun 2021 07:25:07 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id r17sm12057603edt.33.2021.06.22.07.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 07:25:06 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 8AA2218071E; Tue, 22 Jun 2021 16:25:03 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Felix Fietkau Cc: make-wifi-fast@lists.bufferbloat.net, Rajkumar Manoharan , Kan Yan , Yibo Zhao , linux-wireless@vger.kernel.org In-Reply-To: <20210507094851.180838-1-toke@redhat.com> References: <20210507094851.180838-1-toke@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett Date: Tue, 22 Jun 2021 16:25:03 +0200 Message-ID: <87o8byou2o.fsf@toke.dk> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=toke@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Make-wifi-fast] [PATCH mac80211-next v8] mac80211: Switch to a virtual time-based airtime scheduler X-BeenThere: make-wifi-fast@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2021 14:25:10 -0000 Toke H=C3=B8iland-J=C3=B8rgensen writes: > This switches the airtime scheduler in mac80211 to use a virtual time-bas= ed > scheduler instead of the round-robin scheduler used before. This has a > couple of advantages: > > - No need to sync up the round-robin scheduler in firmware/hardware with > the round-robin airtime scheduler. > > - If several stations are eligible for transmission we can schedule both = of > them; no need to hard-block the scheduling rotation until the head of t= he > queue has used up its quantum. > > - The check of whether a station is eligible for transmission becomes > simpler (in ieee80211_txq_may_transmit()). > > The drawback is that scheduling becomes slightly more expensive, as we ne= ed > to maintain an rbtree of TXQs sorted by virtual time. This means that > ieee80211_register_airtime() becomes O(logN) in the number of currently > scheduled TXQs because it can change the order of the scheduled stations. > We mitigate this overhead by only resorting when a station changes positi= on > in the tree, and hopefully N rarely grows too big (it's only TXQs current= ly > backlogged, not all associated stations), so it shouldn't be too big of a= n > issue. > > To prevent divisions in the fast path, we maintain both station sums and > pre-computed reciprocals of the sums. This turns the fast-path operation > into a multiplication, with divisions only happening as the number of > active stations change (to re-compute the current sum of all active stati= on > weights). To prevent this re-computation of the reciprocal from happening > too frequently, we use a time-based notion of station activity, instead o= f > updating the weight every time a station gets scheduled or de-scheduled. = As > queues can oscillate between empty and occupied quite frequently, this ca= n > significantly cut down on the number of re-computations. It also has the > added benefit of making the station airtime calculation independent on > whether the queue happened to have drained at the time an airtime value w= as > accounted. > > Co-developed-by: Yibo Zhao > Signed-off-by: Yibo Zhao > Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Hey Felix Had a chance to look at this yet? :) -Toke