From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mail.toke.dk; spf=pass smtp.mailfrom=; dkim=pass header.d=gmail.com; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=gmail.com policy.dmarc=quarantine Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by mail.toke.dk (Postfix) with ESMTPS id C8CA29E71C8 for ; Sun, 30 Nov 2025 16:07:20 +0100 (CET) Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-78665368a5cso31190377b3.3 for ; Sun, 30 Nov 2025 07:07:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764515238; x=1765120038; darn=lists.bufferbloat.net; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=itd4PosqC2kQ6zrsIqy/TPRszeArCm4Xh6ukzxPw+Yo=; b=Psn75u5NAzIeeME6YR41XVViBEBRY2N+CuE2tzLcrOLKJtkm0/ZeDxvKNF7nQXsXQy flZWhqQHC1POjcCjGmlQ7y5mdG6lneEzO5ORtOyKna4B+MWrzhBLlJCvdDWyL5q1vGdg VtXmgP2yBYgJ8zBwsiveLmli4fuSoC8BUnXsP9vY++wBS+74HlieEeBc/pmUkWeCD5yg J02673rfW5HOuxtqrGSpSpX1WQVIHAjX/7tmEZ+RbNsN5LgZx85U1XU//lk0MF2VhHG6 T8vGGUTMnzH7QfRsdlo2rgSApSE8C3+xSLRwNSZJpFglP5yiINcT2PtwshzE1a30HUJZ rLMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764515238; x=1765120038; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=itd4PosqC2kQ6zrsIqy/TPRszeArCm4Xh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OHBmQd9rNQiF76l3DEZ6cqgPks+2lwoVOrZKt6CCGOvt1K9Wy0x0O8mff5Vu+W gXb8w== X-Google-Smtp-Source: AGHT+IG60qUorMUgYcasY4EIKb1vnjohAXAd1P97tCZqWlM1nclAgl4uc4LJSWiAP/p0TAS5iyCAsg== X-Received: by 2002:a05:690c:6c0e:b0:788:1cde:cad4 with SMTP id 00721157ae682-78a8b4720c1mr290681297b3.19.1764515238523; Sun, 30 Nov 2025 07:07:18 -0800 (PST) Received: from gmail.com (116.235.236.35.bc.googleusercontent.com. [35.236.235.116]) by smtp.gmail.com with UTF8SMTPSA id 00721157ae682-78ad0d3f600sm37931137b3.9.2025.11.30.07.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Nov 2025 07:07:17 -0800 (PST) Date: Sun, 30 Nov 2025 10:07:17 -0500 From: Willem de Bruijn To: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= , Willem de Bruijn , Willem de Bruijn , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: =?UTF-8?B?Sm9uYXMgS8O2cHBlbGVy?= , cake@lists.bufferbloat.net, netdev@vger.kernel.org Message-ID: In-Reply-To: <87zf84ab2d.fsf@toke.dk> References: <20251127-mq-cake-sub-qdisc-v2-0-24d9ead047b9@redhat.com> <20251127-mq-cake-sub-qdisc-v2-2-24d9ead047b9@redhat.com> <87a505b3dt.fsf@toke.dk> <87zf84ab2d.fsf@toke.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-MailFrom: willemdebruijn.kernel@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation Message-ID-Hash: 534Y3TUBHB4VZE2FRMGPLBKTTOCRDQ2B X-Message-ID-Hash: 534Y3TUBHB4VZE2FRMGPLBKTTOCRDQ2B X-Mailman-Approved-At: Sun, 30 Nov 2025 17:01:55 +0100 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Cake] Re: [PATCH net-next v2 2/4] net/sched: sch_cake: Add cake_mq qdisc for using cake on mq devices List-Id: Cake - FQ_codel the next generation Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Toke H=C3=B8iland-J=C3=B8rgensen wrote: > Willem de Bruijn writes: > = > > Toke H=C3=B8iland-J=C3=B8rgensen wrote: > >> Willem de Bruijn writes: > >> = > >> > Toke H=C3=B8iland-J=C3=B8rgensen wrote: > >> >> Add a cake_mq qdisc which installs cake instances on each hardwar= e > >> >> queue on a multi-queue device. > >> >> = > >> >> This is just a copy of sch_mq that installs cake instead of the d= efault > >> >> qdisc on each queue. Subsequent commits will add sharing of the c= onfig > >> >> between cake instances, as well as a multi-queue aware shaper alg= orithm. > >> >> = > >> >> Reviewed-by: Jamal Hadi Salim > >> >> Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen = > >> >> --- > >> >> net/sched/sch_cake.c | 214 +++++++++++++++++++++++++++++++++++++= +++++++++++++- > >> >> 1 file changed, 213 insertions(+), 1 deletion(-) > >> > > >> > Is this code duplication unavoidable? > >> > > >> > Could the same be achieved by either > >> > > >> > extending the original sch_mq to have a variant that calls the > >> > custom cake_mq_change. > >> > > >> > Or avoid hanging the shared state off of parent mq entirely. Have = the > >> > cake instances share it directly. E.g., where all but the instance= on > >> > netdev_get_tx_queue(dev, 0) are opened in a special "shared" mode = (a > >> > bit like SO_REUSEPORT sockets) and lookup the state from that > >> > instance. > >> = > >> We actually started out with something like that, but ended up with = the > >> current variant for primarily UAPI reasons: Having the mq variant be= a > >> separate named qdisc is simple and easy to understand ('cake' gets y= ou > >> single-queue, 'cake_mq' gets you multi-queue). > >> = > >> I think having that variant live with the cake code makes sense. I > >> suppose we could reuse a couple of the mq callbacks by exporting the= m > >> and calling them from the cake code and avoid some duplication that = way. > >> I can follow up with a patch to consolidate those if you think it is= > >> worth it to do so? > > > > Since most functions are identical, I do think reusing them is > > preferable over duplicating them. > = > Sure, that's fair. Seems relatively straight forward too: > = > https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git/commit/?= h=3Dmq-cake-sub-qdisc&id=3Dfdb6891cc584a22d4823d771a602f9f1ee56eeae Great. That's good enough for me. = > > I'm not fully convinced that mq_cake + cake is preferable over > > mq + cake (my second suggestion). We also do not have a separate > > mq_fq, say. But mine is just one opinion from the peanut gallery. > = > Right, I do see what you mean; as I said we did consider this initially= , > but went with this implementation from a configuration simplicity > consideration. = Then admins have only to install one qdisc, rather than what we do for FQ today which is one MQ + a loop over the FQs. I don't know if we have to coddle admins like that. > If we were to implement this as an option when running > under the existing mq, we'd have to add an option to cake itself to opt= > in to this behaviour, and then deal with the various combinations of > sub-qdiscs being added and removed (including mixing cake and non-cake > sub-qdiscs of the same mq). And userspace would have to setup the mq, > then manually add the cake instances with the shared flag underneath it= . One question is whether the kernel needs to protect admins from doing the unexpected thing, which would be mixing mq children of different type when using shared cake state between children. Honestly, I don't think so. But it could be done. For instance by adding an mq option that requires all children to be of the same kind, or even by silently setting this if the first child added is a cake instance with shared option set. As for shared state, in cake_init the qdisc could check that the dev root is mq and it is a direct child of this qdisc, and then scan the mq children for the existence of a cake child. If one exists, take a ref on a shared state struct. If not, create the struct. Again, like SO_REUSEPORT. All easier said than implemented, of course, but seems doable? > Whereas with this cake_mq qdisc the user interface is as simple as > possible: just substitute 'cake_mq' for 'cake' if you want the > multi-queue behaviour on a device; everything else stays the same. Sinc= e > configuration simplicity is an explicit goal of cake, I think this is > appropriate; although it may not be for other qdiscs. > = > Hope that makes sense? > = > -Toke