Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp922005rwb; Tue, 4 Oct 2022 12:35:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SPUB4XcneRayfksQRgPT+F/m/TaAfWDRmeVtC9juVa+2aR9JSkE2OgnTOZBkeG+U78Kc5 X-Received: by 2002:a17:906:7055:b0:78b:9148:6b41 with SMTP id r21-20020a170906705500b0078b91486b41mr8780332ejj.629.1664912112387; Tue, 04 Oct 2022 12:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664912112; cv=none; d=google.com; s=arc-20160816; b=QR5/JbUH1oJPDHpfKDWp6iDYb19NXxITDwI33cX1arCNgnrNAUhi4yKLWwbD0XRfWQ jcK8jO8wYpOp8CPKcnXGW8xKKKAgx+LxEqfZQ/XtVDC0mPpxl8S+8d6BrnYYH1RKfKwi Fpmv9dep9OFDnX3Lkrwlj0HlkKBPLXRJUPMY9f2Xnyhzy7/NnfFrsU+xmaoQzwQ/0Pkb OalUi27Jc81diXk++BSqhw3BdPoC+YfJ4aMz887pRkaQIr4K340tgcffCVgKfHokUr0w V7FusJyVGfXwF9/6OroJ8J3RpzniTOCNiW1usiZOwm84aH6hWIDetJd1umMCK3GuX7Fc X1kg== 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:dkim-signature; bh=fvWgk8o1Yyu3CLIgnzzCCwXTSFv/+lUvtPxy3V4OsJU=; b=B2+sGhZT6fgjZOnyi+fOWbh9YhMolpezNbHWkK4cvSdv2piwFID4BnecXpuDgVt8Ss yxLgR/mKfzQEYJGTFZJV0V383Ow8n6kq6Q1l9ap6KNXP0aZ61NGA1pKqQswjvjD//9Ot gWOVrVBdcWiC4AHaOBpHDbW7RmtblcDnhZDspQR/pXxEP8h7laqj+HNcXsT3tbBnEWi2 vJohQwMrzfFJ4LcOu5fBz9BC08ri0KEurr1Njo5imaQZdpglivMsGfRsH9dzJ+8j9Eyf Ae4F6V0HGtruS10yia2ZFFYxG4GpFUo6jJoNvYbFDa/Y8eXCeCMlmRBGwdr4svYtl22y iucQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qccRpoEv; 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 sc37-20020a1709078a2500b0078c959aea8bsi4591726ejc.324.2022.10.04.12.34.47; Tue, 04 Oct 2022 12:35:12 -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=20210112 header.b=qccRpoEv; 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 S229453AbiJDTTp (ORCPT + 99 others); Tue, 4 Oct 2022 15:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbiJDTTm (ORCPT ); Tue, 4 Oct 2022 15:19:42 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88152D65 for ; Tue, 4 Oct 2022 12:19:40 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id bn8so2966633ljb.6 for ; Tue, 04 Oct 2022 12:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=fvWgk8o1Yyu3CLIgnzzCCwXTSFv/+lUvtPxy3V4OsJU=; b=qccRpoEvt0602Zse5wCsznS7Mf2Bjdcxs62QTaX13HwzliPk+fW4uveflrNKoQ+YyX xqsABLl1gT1yTUGD9Gj/1pY3MUmPNZlrYV+8AbpSolObhIf7KdevpIsLhiMhCd5gXDSA Nb9sLZJuf3q5uO7xmpaF2iuTB8CY0H41nj1Mf3wTJSswsLJ2vtCnydECHehoUuZpHQps 0scjVKqMQJ2IS9qwfmywPUFiW+FQlape1ccFdEskoHeKJNsKtHSMzS7cwwUyQ2wR5M+B Vmyn/6UzGZIftwXNkm9JOoit9Kij9s2XpXShinA2UVDmRbwqm8ZEflAgMOgR+K5VBF7v d0yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=fvWgk8o1Yyu3CLIgnzzCCwXTSFv/+lUvtPxy3V4OsJU=; b=5slNRn5++uYK5qFRsl/dv8sHhuzVQZuav1tjMHC3NDyAwtuy2wyeFGpfsaJ11JLTs9 Ge6jQrzWToCDn8Iu4zzctuETg4bEpLWXFDh0A4mxhXxYfFCWmGTnCEVKanpehQx2s5V7 MaXJjFiOkcsxHXbSJYd9h+NFABoZkSQvGewOrRRp2VEpTaQI87YOwj3g/pCmZqNJVCkI UyEJDmZFtGTEUbTvestcq5HliAodm0NEesW/m8/gfvgNWHWFnmgAxfYASE/Xa3NPr2wr soQ1OEbk7zKrOTkv+tgiVs5psUltRLPgwDNYt6Lrm8yb98yOe0KjwJdFP1ZDOsjqqnvR X4Ug== X-Gm-Message-State: ACrzQf1yIi6NEHjw1GvqwHkVWKlHWVnC1dcSQ8drlRR5OaErIL4FduxO WLmobWKNlINyiHTD/sQYZgTqrh1Q2yZzSN2CQgvs X-Received: by 2002:a2e:84cc:0:b0:26d:e0c8:95d with SMTP id q12-20020a2e84cc000000b0026de0c8095dmr3237208ljh.388.1664911178800; Tue, 04 Oct 2022 12:19:38 -0700 (PDT) MIME-Version: 1.0 References: <20221003232033.3404802-1-jstultz@google.com> <20221003232033.3404802-4-jstultz@google.com> In-Reply-To: From: John Stultz Date: Tue, 4 Oct 2022 12:19:27 -0700 Message-ID: Subject: Re: [RFC PATCH v4 3/3] softirq: defer softirq processing to ksoftirqd if CPU is busy with RT To: David Laight Cc: LKML , John Dias , "Connor O'Brien" , Rick Yiu , John Kacur , Qais Yousef , Chris Redpath , Abhijeet Dharmapurikar , Peter Zijlstra , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Thomas Gleixner , "kernel-team@android.com" , "J . Avila" Content-Type: text/plain; charset="UTF-8" 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, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Tue, Oct 4, 2022 at 3:45 AM David Laight wrote: > From: John Stultz > > Sent: 04 October 2022 00:21 > > > > From: Pavankumar Kondeti > > > > Defer the softirq processing to ksoftirqd if a RT task is > > running or queued on the current CPU. This complements the RT > > task placement algorithm which tries to find a CPU that is not > > currently busy with softirqs. > > > > Currently NET_TX, NET_RX, BLOCK and IRQ_POLL softirqs are only > > deferred as they can potentially run for long time. > > Deferring NET_RX to ksoftirqd stops the NET_RX code from > running until the RT process completes. > > This has exactly the same problems as the softint taking > priority of the RT task - just the other way around. > > Under very high traffic loads receive packets get lost. > In many cases that is actually far worse that the wakeup > of an RT process being delayed slightly. > > The is no 'one size fits all' answer to the problem. I'm not claiming there is a one size fits all solution, just like there are cases where PREEMPT_RT is the right choice and cases where it is not. I'm only proposing we add this build-time configurable option, because the issues they address do affect Android devices and we need some sort of solution (though I'm open to alternatives). > Plausibly depending on the priority of the RT task > might be useful. > But sometimes it depends on the actual reason for the > wakeup. > For instance a wakeup from an ISR or a hish-res timer > might need lower latency than one from a futex. I mean, with the PREEMPT_RT series years ago there used to be configuration guides on setting the rtprio for each softirq thread to provide tuning knobs like you mention, but I'm not sure what the current state of that is. If you're wanting more flexibility from the proposed patch, I guess we could have a knob to runtime set which softirqs would be deferred by rt tasks, but I'm not sure if folks want to expose that level of detail of the kernel's workings as a UABI, so having it be a kernel build option avoids that. thanks -john