Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp368923pxf; Wed, 10 Mar 2021 08:00:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWVshNIZ0hXCdq2+zKkD5QIrSfnqRmo6gv1XZqm0Vj5SKkspDgw7mYhuixx92ufx0F512W X-Received: by 2002:aa7:d385:: with SMTP id x5mr4143890edq.289.1615392024343; Wed, 10 Mar 2021 08:00:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615392024; cv=none; d=google.com; s=arc-20160816; b=h9j3spMIXD7WUbMb9sfFuc6PRnxR6jckeUnWXmKoj1Btmi7AQgA9jnT6QSfQqJNnoh lKm3LU09jqRjMoVXSVvQb+Z1ZRMk8Ed+mNbVmrNhoNp8Npy/2ORj1EF+DEER0+mIRFZL YyJ1VhNKwYM4gLwdnjNzHqbn23qIPQx+EOgNl1A3hc4xC6gjuEAyZqgEr6Hrn+KJQ2CA N7IzAeYG62KaIxhPkk/0vQkE3Y9+ElHEPDrqeEgUr9f5z4I8YeHi9k7p7E0xs0Csy+J1 r5SjBrx3KDEF53VD7GbwUiDFKMe8Fw4EiOlan8BEDltWp5hMXrvnPSDyMS+BGyo+0JEn sjSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=dEJc11B4/+2bfJrfS7rf4kPcL5WeVEcvu81H9/FuMu0=; b=Mw3mwEWj8N9Eyqjiaf6PPnyLfSRJaw2dPfxrmsga5nkxbBS5OSdThNW85ltSTcIuUk 1gAOzoBqHmhmXgM3YFtRkOQCapKY1+i9ZJ+MdsZpMPmvmFKJ2ZfZS88eYEHbUU7j+qIc 8F+ECXcTM6Rh47fx0YbhdLtFT2DnoUr7sqBF4yxjbeFr0QbA3WrFSgqRUj/3zkYBRUOz 7pWr2ov0J1D7BBPRcVkEK+ghb/FyqA1mWMaBqHsZ/pysNm39IGsDMS5BLQsCZOtKH3Fu JHZEM8ec5gSSSK6a7XZ1VoQB9sZvodxPcpuIKXjcWszOx0WVhZO0vQ8rtHMtatlTWHnF asBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r16si9220198edw.458.2021.03.10.08.00.01; Wed, 10 Mar 2021 08:00:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232617AbhCJP50 (ORCPT + 99 others); Wed, 10 Mar 2021 10:57:26 -0500 Received: from mail-yb1-f174.google.com ([209.85.219.174]:43600 "EHLO mail-yb1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232887AbhCJP5B (ORCPT ); Wed, 10 Mar 2021 10:57:01 -0500 Received: by mail-yb1-f174.google.com with SMTP id u75so18308877ybi.10; Wed, 10 Mar 2021 07:57:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dEJc11B4/+2bfJrfS7rf4kPcL5WeVEcvu81H9/FuMu0=; b=OhW+dxM/nczj+2MayEE9BTK0/4WWJiKkxPcAq5qCHLtiHqwsRrtxa7f5IMPSJcb2ZK KokVb9Q0K62nUwenMEyFLtU8fh3JOY2bYpWETT3pjAFYMHIXY+gMQpCDUafRhs5uAkRD Oq+MtOPBjjGjmFFVqTA3HyrE9NOkKvUwxRDgYMXJMZUW7Tam6lrRoisU1lfAqmvoolAT BDbQrV0vBdxdAX43eNhXqedXgp1bkUmiBply4L3N9x3VhJjKN3b1puBntK0aTjj7DHyv 1CObmkoqtS17d6sGuMR2Pj4hxb3ujsFxY2RBq2RhwysIvlz04Z+Cbdkyjm0AZRBxG2GN Oq7A== X-Gm-Message-State: AOAM53237vuZr7Nb4ieCeCnoawgE91FhOJl2KIL4hRmHsmj5UvlsvY8z ACnNdkStPRTGrklnmAXh309LDQfaDzQIE3oM9Uc= X-Received: by 2002:a05:6902:4b2:: with SMTP id r18mr5096380ybs.226.1615391820211; Wed, 10 Mar 2021 07:57:00 -0800 (PST) MIME-Version: 1.0 References: <20210309152354.95309-1-mailhol.vincent@wanadoo.fr> <20210309152354.95309-2-mailhol.vincent@wanadoo.fr> In-Reply-To: From: Vincent MAILHOL Date: Thu, 11 Mar 2021 00:56:48 +0900 Message-ID: Subject: Re: [RFC PATCH 1/1] dql: add dql_set_min_limit() To: Dave Taht Cc: Marc Kleine-Budde , linux-can , LKML , Linux Kernel Network Developers , Tom Herbert , Eric Dumazet , Peter Zijlstra , Randy Dunlap Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dave, Thanks for the comprehensive comments! On Wed. 10 Mar 2021 at 04:44, Dave Taht wrote: > > I note that "proof" is very much in the developer's opinion and > limited testing base. > > Actual operational experience, as in a real deployment, with other applications, > heavy context switching, or virtualization, might yield better results. Agree. I was not thorough in my description, but what you pointed here is actually what I had in mind (and what I did for my driver). Let me borrow your exemple and include those in the v2 of the patch. > There's lots of defaults in the linux kernel that are just swags, the > default NAPI and rx/tx ring buffer sizes being two where devs just > copy/paste stuff, which either doesn't scale up, or doesn't scale > down. > > This does not mean I oppose your patch! However I have two points I'd > like to make > regarding bql and dql in general that I have long longed be explored. > > 0) Me being an advocate of low latency in general, does mean that I > have no problem > and even prefer, starving the device rather than always keeping it busy. > > /me hides Fully agree. The intent of this patch is for specific use cases where setting a default dql.min_limit has minimum latency impact for a noticeable throughput increase. My use case is a CAN driver for a USB interface module. The maximum PDU of CAN protocol is roughly 16 bytes, the USB maximum packet size is 512 bytes. If I force dql.min_limit to be around 240 bytes (i.e. roughly 15 CAN frames), all 15 frames easily fit in a single USB packet. Preparing a packet of 240 bytes is relatively fast (small latency issue) but the gain of not having to send 15 separate USB packets is huge (big throughput increase). My patch was really written for this specific context. However, I am not knowledgeable enough on other network protocols to give other examples where this new function could be applied (my blind guess is that most of the protocol should *not* use it). > 1) BQL is MIAD - multiplicative increase, additive decrease. While in > practice so far this does not seem to matter much (and also measuring > things down to "us" really hard), a stabler algorithm is AIMD. BQL > often absorbs a large TSO burst - usually a minimum of 128k is > observed on gbit, where a stabler state (without GSO) seemed to be > around 40k on many of the chipsets I worked with, back when I was > working in this area. > > (cake's gso-splitting also gets lower bql values in general, if you > have enough cpu to run cake) > > 2) BQL + hardware mq is increasingly an issue in my mind in that, say, > you are hitting > 64 hw queues, each with 128k stored in there, is additive, where in > order to service interrupts properly and keep the media busy might > only require 128k total, spread across the active queues and flows. I > have often thought that making BQL scale better to multiple hw queues > by globally sharing the buffering state(s), would lead to lower > latency, but > also that probably sharing that state would be too high overhead. > > Having not worked out a solution to 2), and preferring to start with > 1), and not having a whole lot of support for item 0) in the world, I > just thought I'd mention it, in the hope > someone might give it a go. Thank you for the comments, however, I will be of small help here. As mentioned above, my use cases are in bytes, not in kilobytes. I lack experience here. My experience is that BQL is not adapted for protocol with small PDU and also not adapted for interfaces with a high latency (e.g. USB) by default. But, modifying the dql.min_limit solves it. So, I let over people continue the discussion on points 1) and 2) Yours sincerely, Vincent