Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5953094rwl; Mon, 9 Jan 2023 02:03:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXtbc05ZF4NzZuQh0lUHQAEMobH4bI1ZvQEso1rqgpaQ6wf+J6e3MBWGVmyB/l8/dxiZqg82 X-Received: by 2002:a17:902:ba93:b0:191:2c85:189f with SMTP id k19-20020a170902ba9300b001912c85189fmr62256491pls.69.1673258619884; Mon, 09 Jan 2023 02:03:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673258619; cv=none; d=google.com; s=arc-20160816; b=Qz1AlCii20E1d21fgYSqrb854mQUa+WxDkXrd/mGVMRG/uEg/J1pQhdHc+hnS0lH8g ZLHp17ju73JvXEit3Cix/3Eg8TrflBZLUBvUTxClB/h8U/5bc5MdHHwmej4J+NUM1XI8 FcxXEW8rYzMlStuibwfu8vPef9r6WstbMF+8jwLq6uJKURo1fxPNWtpBUYUe9JaFvxWp XvByYmNuTdNgHk8rxjFn+Q3BYEVirHqcBeQVUIGe8VCmNHOrBNQJlt8BcjPvius7CccA /axq+KTZK7YnVqpmEF2D8MZwqXHFPMMfVBTkGbJ/edzD/Xb2J1SBulb5fgKeM8dSt/a/ TA9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IsQXb0coC4MH8lm3N/KTjIXu0ELkSrGyhN9jJUZYXRg=; b=c7PY8Sc1bTJq9JmgEwsvh14k1b1Nf+SAWcKnNkaGaT7rjie8qqVTtIwK7S/w6BAsOb jnSzWtwt1caVbkTJfQf73MFCqB5/kEfsxt5oR08HWgtHtHhr4I0+AfC07opVr6qBwsmB Ft7fXG6Nbi2dsm1tfyKo5JYu89tUY/114h4yXVrDDvW+5wRJXuddg1apnDWJEn8ZxCCL WYVm7gXY34JKOQIbmLIcDc/R/qpgX/Bv7Zj1O8wTVMGt3iSGWLtwVK0Wc+4DyK2MrMhw cUWlvwkB/ygEUV2xy/s1eQMfyU5dNXHvNb8fbOHquajt0I7QSH3es+eLIgqug3DZAb1/ Ta3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=UfH94avJ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a1709027c0c00b0018666611f85si8091841pll.508.2023.01.09.02.03.32; Mon, 09 Jan 2023 02:03:39 -0800 (PST) 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=@infradead.org header.s=desiato.20200630 header.b=UfH94avJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233658AbjAIJrA (ORCPT + 54 others); Mon, 9 Jan 2023 04:47:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230404AbjAIJqG (ORCPT ); Mon, 9 Jan 2023 04:46:06 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 190CD9FD6; Mon, 9 Jan 2023 01:45:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=IsQXb0coC4MH8lm3N/KTjIXu0ELkSrGyhN9jJUZYXRg=; b=UfH94avJySRuY6Ha5LtchQXvYM Ostvhiogm0+IZ+7oM2akuvihUCNKugyradH2HkziZCGnV3Uxsg/duAsJX8SS6m8lciNAOYeQtwlDF I8OSWvdlDxBB7jddWG6vJ88//CmrHXZPDwNJdC6N50GtwYYc7glptEkWzX1+kD04YC6viV5uZQRtZ QlFEvs8g/oI073PXNs2bjCPOimhgdvy5HvGJVsp0YiO+zI+l6j1rMAauZG7547JTpTZtG3OSZL/h7 sB+c7I69mLwMN0OxvhSEoQ6BSCW1pQpjDPi0uK5lD7yKthGzLr4lgfew24uLkd3zsTP1Drleb4cji SlmHh6DQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pEohw-002fkB-0b; Mon, 09 Jan 2023 09:44:44 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 2BD35300193; Mon, 9 Jan 2023 10:44:50 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EA8D6201BB46C; Mon, 9 Jan 2023 10:44:49 +0100 (CET) Date: Mon, 9 Jan 2023 10:44:49 +0100 From: Peter Zijlstra To: Jakub Kicinski Cc: tglx@linutronix.de, jstultz@google.com, edumazet@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] softirq: don't yield if only expedited handlers are pending Message-ID: References: <20221222221244.1290833-1-kuba@kernel.org> <20221222221244.1290833-4-kuba@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221222221244.1290833-4-kuba@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 On Thu, Dec 22, 2022 at 02:12:44PM -0800, Jakub Kicinski wrote: > In networking we try to keep Tx packet queues small, so we limit > how many bytes a socket may packetize and queue up. Tx completions > (from NAPI) notify the sockets when packets have left the system > (NIC Tx completion) and the socket schedules a tasklet to queue > the next batch of frames. > > This leads to a situation where we go thru the softirq loop twice. > First round we have pending = NET (from the NIC IRQ/NAPI), and > the second iteration has pending = TASKLET (the socket tasklet). So to me that sounds like you want to fix the network code to not do this then. Why can't the NAPI thing directly queue the next batch; why do you have to do a softirq roundtrip like this? > On two web workloads I looked at this condition accounts for 10% > and 23% of all ksoftirqd wake ups respectively. We run NAPI > which wakes some process up, we hit need_resched() and wake up > ksoftirqd just to run the TSQ (TCP small queues) tasklet. > > Tweak the need_resched() condition to be ignored if all pending > softIRQs are "non-deferred". The tasklet would run relatively > soon, anyway, but once ksoftirqd is woken we're risking stalls. > > I did not see any negative impact on the latency in an RR test > on a loaded machine with this change applied. Ignoring need_resched() will get you in trouble with RT people real fast.