Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1158941rwr; Thu, 20 Apr 2023 10:42:33 -0700 (PDT) X-Google-Smtp-Source: AKy350aYdSsqgYobrUsw4UWIszk3gbOgGdAkm27PGLJt3OyKIDDryDyAB7HFRIC++mfDyPwoOZ2i X-Received: by 2002:a05:6a20:1b26:b0:f0:66c3:7196 with SMTP id ch38-20020a056a201b2600b000f066c37196mr2302488pzb.42.1682012552806; Thu, 20 Apr 2023 10:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682012552; cv=none; d=google.com; s=arc-20160816; b=Q8SAwVUSRU1dpI0PG9EGBKKVLDB/9xIi/MEh9d2///jfYw3ygyoM+APFOdfWRTatLr xJsbJcP4jg29PQIyRmq0QsKuXp7LGWqRO8MlzPDOywykltDn0kWYZEJgT4JtKIKjwBvW aJ2NVhM32DoF6hxJXvtOlQM7a90Vh6JscsdNYThTvPTPrTybungnPrRxEXm1ISApM4FO xwP9Kc7LH/DSfxstuZTLR/N0oe9m9+gUIeAy8l4WpdSy6kQOYhLlbsksGTWltvnT5fUT t/5vc2Vc/9TROgjy0+m/WvQg2JRVVOE3meH9nAyP59Gu2hEcSlJP0hjexEqzsupttkWo /AMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=wWI/KrkBx1ruAw1fs2tCw7jtIGLbpWu/3dIfHT/7yPY=; b=g+QcVXI5aQ5OclhEFFzgOkXDPVwRc9ZYV8Yw6TWOl5lQR4zMMVXIDt9F3nsTIBxDtr IXoKclQ31ncnQhcSqgsWzQI/wXjNGQDJbVQtIH0bVpkd+XR5Ip/Pm5iT72JrhaCtb4gD 1/qKv0fEpguxli14Qq2IxAEFpekHaazKCOT8FYdU7eU5U2ih8MfcN08ns6EYdnDAKYE0 s+kNzW7Dq58YDXni5scRtHb03Wd1EOeFegRYKfdLCxZ7MiXFB5YiTRuPkzn6Ljg7Xyb5 LbzfPyZ3hs6GFKbpmN9RgIPo5W1UjJRYdrsid+kT2CcbOuqJSDomNNJI8d1BN99cmy1y b0Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="dG/12FU2"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a6555c7000000b004f24be1c13csi2375827pgs.117.2023.04.20.10.42.20; Thu, 20 Apr 2023 10:42:32 -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=@google.com header.s=20221208 header.b="dG/12FU2"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231655AbjDTRmN (ORCPT + 99 others); Thu, 20 Apr 2023 13:42:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbjDTRmM (ORCPT ); Thu, 20 Apr 2023 13:42:12 -0400 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5619CE58 for ; Thu, 20 Apr 2023 10:42:09 -0700 (PDT) Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-760bba6404cso38309339f.1 for ; Thu, 20 Apr 2023 10:42:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682012528; x=1684604528; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wWI/KrkBx1ruAw1fs2tCw7jtIGLbpWu/3dIfHT/7yPY=; b=dG/12FU273yJIqrgVgIy0hpaDniYZteZdc0q5qUnK/tUBY0lYC/cwnLUJb2RA7Tx4t pWHp9T6wiMZ8VED3rwPBOlXY4idM6rPkEjdzIoQTD0arlH8NDBko1kX08GzKfzVxvR1M GtusXvkMxv8spvgxIs1F0Yxn34fSLI0oNPEkxEFjsOScIAq+kWxob0rgcWyMSVR/NmCm u/9hjGzCP0XJUR2C2j+0i/seC8P+AzraizAsLWYHtHiFBhesBGtaC23O9XfGQAkBQBRv ms/IZoEYCVGB1sAoIe2S82A+Hzb0Y7oeBXyNp62fNDp8cbhft7elBgddKFhZNu1xpbF1 cErA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682012528; x=1684604528; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wWI/KrkBx1ruAw1fs2tCw7jtIGLbpWu/3dIfHT/7yPY=; b=BGXrszH3PdQiQ5DTcBF1g3nnyd8z/0zyAXGPyYgjYlvSpXth72qMr4Nz8Wh+WjYRe1 vQBlZtDWx55ti59dohBOHAzMyOgRuushAPpcIvZq/yg4D8+91PyUiXP3uB2P46PQNiPJ e/Q+KXVHrqaZ2gyAqLLMXmlAKuagJ5csWRMDqbOVH36dRv5fXa0HN6IP41FuDGmlWYft O0WAs5qwjh4EV527TxUQRgdTass8Cygq4mXo1J7RcIarygxjLyFJfKegXZ3Q99SYHfkP pSuC7NU/BAyPwHYL/5TSMzhNGbeJiSPwti3AFDXvSvhcTUzncylIxtpW5o/+fRhoOVTd Yg8w== X-Gm-Message-State: AAQBX9eTW15Vzi2M3EKp0u7dZ21SXcMa21EalKAXbQfip/kzDBVBlCol dGn8ANNVhzwVRCBFO8TMgb8v6B7UhDn9yQ9ex/wsFg== X-Received: by 2002:a92:c908:0:b0:329:42d1:6e2d with SMTP id t8-20020a92c908000000b0032942d16e2dmr1162376ilp.6.1682012528360; Thu, 20 Apr 2023 10:42:08 -0700 (PDT) MIME-Version: 1.0 References: <20221222221244.1290833-1-kuba@kernel.org> <305d7742212cbe98621b16be782b0562f1012cb6.camel@redhat.com> In-Reply-To: <305d7742212cbe98621b16be782b0562f1012cb6.camel@redhat.com> From: Eric Dumazet Date: Thu, 20 Apr 2023 19:41:57 +0200 Message-ID: Subject: Re: [PATCH 0/3] softirq: uncontroversial change To: Paolo Abeni Cc: Jakub Kicinski , peterz@infradead.org, tglx@linutronix.de, jstultz@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 On Thu, Apr 20, 2023 at 7:24=E2=80=AFPM Paolo Abeni wro= te: > > Hi all, > On Thu, 2022-12-22 at 14:12 -0800, Jakub Kicinski wrote: > > Catching up on LWN I run across the article about softirq > > changes, and then I noticed fresh patches in Peter's tree. > > So probably wise for me to throw these out there. > > > > My (can I say Meta's?) problem is the opposite to what the RT > > sensitive people complain about. In the current scheme once > > ksoftirqd is woken no network processing happens until it runs. > > > > When networking gets overloaded - that's probably fair, the problem > > is that we confuse latency tweaks with overload protection. We have > > a needs_resched() in the loop condition (which is a latency tweak) > > Most often we defer to ksoftirqd because we're trying to be nice > > and let user space respond quickly, not because there is an > > overload. But the user space may not be nice, and sit on the CPU > > for 10ms+. Also the sirq's "work allowance" is 2ms, which is > > uncomfortably close to the timer tick, but that's another story. > > > > We have a sirq latency tracker in our prod kernel which catches > > 8ms+ stalls of net Tx (packets queued to the NIC but there is > > no NAPI cleanup within 8ms) and with these patches applied > > on 5.19 fully loaded web machine sees a drop in stalls from > > 1.8 stalls/sec to 0.16/sec. I also see a 50% drop in outgoing > > TCP retransmissions and ~10% drop in non-TLP incoming ones. > > This is not a network-heavy workload so most of the rtx are > > due to scheduling artifacts. > > > > The network latency in a datacenter is somewhere around neat > > 1000x lower than scheduling granularity (around 10us). > > > > These patches (patch 2 is "the meat") change what we recognize > > as overload. Instead of just checking if "ksoftirqd is woken" > > it also caps how long we consider ourselves to be in overload, > > a time limit which is different based on whether we yield due > > to real resource exhaustion vs just hitting that needs_resched(). > > > > I hope the core concept is not entirely idiotic. It'd be great > > if we could get this in or fold an equivalent concept into ongoing > > work from others, because due to various "scheduler improvements" > > every time we upgrade the production kernel this problem is getting > > worse :( > > Please allow me to revive this old thread. > > My understanding is that we want to avoid adding more heuristics here, > preferring a consistent refactor. > > I would like to propose a revert of: > > 4cd13c21b207 softirq: Let ksoftirqd do its job > > the its follow-ups: > > 3c53776e29f8 Mark HI and TASKLET softirq synchronous > 0f50524789fc softirq: Don't skip softirq execution when softirq thread is= parking > > The problem originally addressed by 4cd13c21b207 can now be tackled > with the threaded napi, available since: > > 29863d41bb6e net: implement threaded-able napi poll loop support > > Reverting the mentioned commit should address the latency issues > mentioned by Jakub - I verified it solves a somewhat related problem in > my setup - and reduces the layering of heuristics in this area. > > A refactor introducing uniform overload detection and proper resource > control will be better, but I admit it's beyond me and anyway it could > still land afterwards. > > Any opinion more then welcome! Seems fine, but I think few things need to be fixed first in napi_threaded_poll() to enable some important features that are currently in net_rx_action() on= ly.