Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2131579rwa; Mon, 22 Aug 2022 02:41:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR7mDQF1P/JtjunxN6NMxeTGnx1X0T3RAM5aqrzU+a65zF+M3pE04OE1enhqe0aiGszyr0VQ X-Received: by 2002:a17:907:2c77:b0:73d:7af2:37f1 with SMTP id ib23-20020a1709072c7700b0073d7af237f1mr3287048ejc.684.1661161294592; Mon, 22 Aug 2022 02:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661161294; cv=none; d=google.com; s=arc-20160816; b=JvfBMEl0p8XrEJ5hYGg4ltakfYRYMpmNDa7YrbrYj04e+XZwmO9rw8lHw5scgypM51 5gRsIsS3Fn8QLs3ZU6PAkdvNhwKQQeUqh8VakoqCx9yDojZ5A/qk8LoDDAGPuEJPvAoa YOnm8ppNAo0sgz65GUhQ5S548yQYxzkbzAO8pIGQsukSfVNQxTkyRgEiULF0s4ohICah Z86bXeG+uBZyTlbIqkcPHfa30ktg5exnqZydjjnu92oqk6wCewr3NsLov11EKa67W2RV xDo1lvqOn97Aa0ubOZRP8hydW+cA8oTqmA/6moRQ27QM+W0hzlhUn3HrSob/9/tTdgj2 U+Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wjrH7CkWFBaGclBblrE7HFL002i1VDYL9JXtkvBlksY=; b=oCWLa0cbQVbFLXm+sTElZcxSuo6MnAEzs/LRUbYeKPxgQmlj4YX1qWsyRINKOFDEeW PJPK5Uw1fwdQCafdNYHBhWaOBusdR2+jDrL1N1iwkYocNfN7BZ36uinqwRQ7Kg9axGdU L9XapTNXKzjeKVbTSLOfIOsSmYE9GHV82GnAoZeiPXGHi1UbGQ5u1ciocOs9JyQAgrsE Tec8AeaW8TuiK+BxCc6oy3+qBLxGwdW+NQKZRu/4WKMeA3BAJZn7glT/hlYUvKGRCATl jHPYIYLrkfx/B6Blzd+9MSc0rLt/I+5ZC+so5gYW+OsNaIe5OsGBcGfSmiGKmfRQpiXQ ra2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=m9Eo8Ood; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg42-20020a170907972a00b0072f97d98a50si3154090ejc.945.2022.08.22.02.41.08; Mon, 22 Aug 2022 02:41:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=m9Eo8Ood; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234096AbiHVJKn (ORCPT + 99 others); Mon, 22 Aug 2022 05:10:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234207AbiHVJKc (ORCPT ); Mon, 22 Aug 2022 05:10:32 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44CE219C06; Mon, 22 Aug 2022 02:10:31 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id b2so7657032qvp.1; Mon, 22 Aug 2022 02:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=wjrH7CkWFBaGclBblrE7HFL002i1VDYL9JXtkvBlksY=; b=m9Eo8OodVq1Ets/OEiRoWJrWFhfn0xRM++GAXhZxITlqyA6MRrqB7PExQKR81BqoMd 3OOLgss+leeXQWJHXQTYBgXPN43Kk3H4s0SIfBeP7UDdI6AFj1JMbFxzr5rsNz1tBPdE Iv1VKq0X0XEs8Ff5FzfIuStRtbAlMk+CfHruqHibJIINFwKVRjgmYjmrSfhrY0o2AAGX 3RnZFMzTzPbjj6It6Z7AtISosQrg2T+H5v/CINVs7+rHRhdVXOLdF64GuJ+Sv8IWUjku ocK/gD5hezM0DCBxWrhwDB6vj7fPo8bdqadR+oH6EAXbsbaOLqG16LkJ0vbK8np0Vgtg Zejg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=wjrH7CkWFBaGclBblrE7HFL002i1VDYL9JXtkvBlksY=; b=1u/MkqwwBD1wTIedTEDb64YZVUpumM2wELjlyGYQ8+cTlSfx+fax/IVn/GTpJ8crSc S6uGCz9C0xSQ3DmbMjuqB76DWXa/KQlWw/C3/fkorIQ/2/moA/j99thnj8cvurpJj7KE HQ5pLW8YDoYWM9nonvEiAEJ94ytZuvNCe4PuqbPPW99pOqsaorx0WulGqmDj5bBbETf9 XkGHVgyTgBI6EoquXE5o4WPQmU4RMt77GKGYZNJQwkJi59KKdaL4rWGXA+dFsQFUuWuv 67aOMJgx21rQsNwP60zwaPQ9d5hBJvu8IVgX5wGBozoVWsAPJrU3a77Lbg2e0b80fCb8 kWHA== X-Gm-Message-State: ACgBeo1c1yQaL1jcJ/giqL8QQPyvKMDK1sFC/ns4TZPprBnVmfvIktPT sC73Es2Ca0JAQzuLpgGOXfZMgOLrCQ== X-Received: by 2002:a05:6214:27cb:b0:496:ac94:723d with SMTP id ge11-20020a05621427cb00b00496ac94723dmr14805024qvb.6.1661159430322; Mon, 22 Aug 2022 02:10:30 -0700 (PDT) Received: from bytedance.attlocal.net (ec2-52-52-7-82.us-west-1.compute.amazonaws.com. [52.52.7.82]) by smtp.gmail.com with ESMTPSA id t201-20020a37aad2000000b006b9264191b5sm11046904qke.32.2022.08.22.02.10.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 02:10:29 -0700 (PDT) From: Peilin Ye To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Hideaki YOSHIFUJI , David Ahern , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: Peilin Ye , netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang , Stephen Hemminger , Dave Taht , Peilin Ye Subject: [PATCH RFC v2 net-next 0/5] net: Qdisc backpressure infrastructure Date: Mon, 22 Aug 2022 02:10:17 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peilin Ye Hi all, Currently sockets (especially UDP ones) can drop a lot of packets at TC egress when rate limited by shaper Qdiscs like HTB. This patchset series tries to solve this by introducing a Qdisc backpressure mechanism. RFC v1 [1] used a throttle & unthrottle approach, which introduced several issues, including a thundering herd problem and a socket reference count issue [2]. This RFC v2 uses a different approach to avoid those issues: 1. When a shaper Qdisc drops a packet that belongs to a local socket due to TC egress congestion, we make part of the socket's sndbuf temporarily unavailable, so it sends slower. 2. Later, when TC egress becomes idle again, we gradually recover the socket's sndbuf back to normal. Patch 2 implements this step using a timer for UDP sockets. The thundering herd problem is avoided, since we no longer wake up all throttled sockets at the same time in qdisc_watchdog(). The socket reference count issue is also avoided, since we no longer maintain socket list on Qdisc. Performance is better than RFC v1. There is one concern about fairness between flows for TBF Qdisc, which could be solved by using a SFQ inner Qdisc. Please see the individual patches for details and numbers. Any comments, suggestions would be much appreciated. Thanks! [1] https://lore.kernel.org/netdev/cover.1651800598.git.peilin.ye@bytedance.com/ [2] https://lore.kernel.org/netdev/20220506133111.1d4bebf3@hermes.local/ Peilin Ye (5): net: Introduce Qdisc backpressure infrastructure net/udp: Implement Qdisc backpressure algorithm net/sched: sch_tbf: Use Qdisc backpressure infrastructure net/sched: sch_htb: Use Qdisc backpressure infrastructure net/sched: sch_cbq: Use Qdisc backpressure infrastructure Documentation/networking/ip-sysctl.rst | 11 ++++ include/linux/udp.h | 3 ++ include/net/netns/ipv4.h | 1 + include/net/sch_generic.h | 11 ++++ include/net/sock.h | 21 ++++++++ include/net/udp.h | 1 + net/core/sock.c | 5 +- net/ipv4/sysctl_net_ipv4.c | 7 +++ net/ipv4/udp.c | 69 +++++++++++++++++++++++++- net/ipv6/udp.c | 2 +- net/sched/sch_cbq.c | 1 + net/sched/sch_htb.c | 2 + net/sched/sch_tbf.c | 2 + 13 files changed, 132 insertions(+), 4 deletions(-) -- 2.20.1