Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp980553rwi; Mon, 10 Oct 2022 09:34:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7xaNMeMup9lq5nlU9lLXjmjuIIKvTvH6vnufeohsf3bdptPd2WaOHQc//rnKIAwkC55EM/ X-Received: by 2002:a17:907:1b22:b0:741:8809:b4e6 with SMTP id mp34-20020a1709071b2200b007418809b4e6mr15463115ejc.84.1665419673004; Mon, 10 Oct 2022 09:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665419672; cv=none; d=google.com; s=arc-20160816; b=JkJoNRQPZsQE2pPn5W41/9+pm4i5s70yFFw+egEgLZGmEPh+cSxAYvn9cfdE4SAfEZ kiCOG4p1vy+I+u+6GDE2Y4Oy0Dki2Szflu0ZE5kLqCaq56tgUq1p/3SMC2ETKvXhonpX 3pN2lK3BnmF0qVZBagv5G4UcZJTqEl1/qVTUZekugzJASmDWncppY7JGWq2ye6IFg8gs UFeIGSf2uigZROa/p+QueWpAFYI3L/5P7ywJ6bjuin8BENZSL1Pt1/uHFAl/Elgt23NI caeAkbPFJZxewbaak4+HCy86p6HGeFz1zQINgZF+6KLIc11w5NfV9+y+nLEy5Z+tI5Lc nHrA== 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; bh=WZbO21XJjCIMXGLERxB7NMlAAl954bBHUsrnhnGPaik=; b=RimQtH+Fb1yhQ6KO1uWM+IH/AqagPceLfPYVUcnw6VddwYKwtwUc4nWzeQtIiiQMLg h1q2ATSdDdMultWW8SoqmxjOm4DEDbMz0qpfMsE48XiHmFcvPNIL96S4aGhhM1nHIShh vBHrt4ACl0tQ7hyNnpb+sxd04YjptvX6c+tBqEGd/vZ3Z/u1ton9tXR16QlRieZq1C0E /offxgX7jLXjm3FtfutitTjMfUhvWAPmpyseJVn67AgVWobxkpUMue4lAa4+cn21gl6Q bG4OSuOzm/Ppe8n/ucQnXq2KWjRTIPgF2ThkLcKheZdiEoOWZ+RQcTXgbWdO4XfZYYZl BVNQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp40-20020a1709073e2800b0077bf109acb5si8141114ejc.116.2022.10.10.09.34.05; Mon, 10 Oct 2022 09:34: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229793AbiJJQJZ (ORCPT + 99 others); Mon, 10 Oct 2022 12:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbiJJQJY (ORCPT ); Mon, 10 Oct 2022 12:09:24 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 62DE024F06 for ; Mon, 10 Oct 2022 09:09:22 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5074212FC; Mon, 10 Oct 2022 09:09:28 -0700 (PDT) Received: from wubuntu (unknown [10.57.35.2]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 903DD3F67D; Mon, 10 Oct 2022 09:09:19 -0700 (PDT) Date: Mon, 10 Oct 2022 17:09:17 +0100 From: Qais Yousef To: John Stultz Cc: LKML , Pavankumar Kondeti , John Dias , Connor O'Brien , Rick Yiu , John Kacur , Chris Redpath , Abhijeet Dharmapurikar , Peter Zijlstra , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Thomas Gleixner , kernel-team@android.com, Satya Durga Srinivasu Prabhala , "J . Avila" Subject: Re: [RFC PATCH v4 3/3] softirq: defer softirq processing to ksoftirqd if CPU is busy with RT Message-ID: <20221010160917.p2ftu3eezsrbfdfk@wubuntu> References: <20221003232033.3404802-1-jstultz@google.com> <20221003232033.3404802-4-jstultz@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221003232033.3404802-4-jstultz@google.com> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, 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 Hi John On 10/03/22 23:20, John Stultz wrote: > 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. > > Additionally, this patch stubs out ksoftirqd_running() logic, > in the CONFIG_RT_SOFTIRQ_OPTIMIZATION case, as deferring > potentially long-running softirqs will cause the logic to not > process shorter-running softirqs immediately. By stubbing it out > the potentially long running softirqs are deferred, but the > shorter running ones can still run immediately. The cover letter didn't make it to my inbox (nor to others AFAICS from lore), so replying here. The series looks good to me. It offers a compromise to avoid an existing conflict between RT and softirqs without disrupting much how both inherently work. I guess it's up to the maintainers to decide if this direction is acceptable or not. I've seen Thomas had a comment on another softirq series (which attempts to throttle them ;-) by the way that is worth looking it: https://lore.kernel.org/lkml/877d81jc13.ffs@tglx/ Meanwhile, I did run a few tests on a test laptop that has 2 core SMT2 i7 laptop (since I assume you tested on Android) I set priority to 1 for all of these cyclic tests. First I ran without applying your patch to fix the affinity problem in cyclictest: I had a 1 hour run of 4 threads - 4 iperf threads and 4 dd threads are doing work in the background: | vanilla | with softirq patches v4 | -------------------|-----------------|-------------------------| t0 max delay (us) | 6728 | 2096 | t1 max delay (us) | 2545 | 1990 | t2 max delay (us) | 2282 | 2094 | t3 max delay (us) | 6038 | 2162 | Which shows max latency is improved a lot. Though because I missed applying your cyclictest patch, I believe this can be attributed only to patch 3 which defers the softirq if there's current task is an RT one. I applied your patch to cyclictest to NOT force affinity when specifying -t option. Ran cyclictest for 4 hours, -t 3, 3 iperf threads and 3 dd threads running in the background: | vanilla | with softirq patches v4 | -------------------|-----------------|-------------------------| t0 max delay (us) | 2656 | 2164 | t1 max delay (us) | 2773 | 1982 | t2 max delay (us) | 2272 | 2278 | I didn't hit a big max delay on this case. It shows things are better still. Ran another cyclictest for 4 hours, -t 4, 4 iperf threads and 4 dd threads in the background: | vanilla | with softirq patches v4 | -------------------|-----------------|-------------------------| t0 max delay (us) | 4012 | 7074 | t1 max delay (us) | 2460 | 9088 | t2 max delay (us) | 3755 | 2784 | t3 max delay (us) | 4392 | 2295 | Here the results worryingly show that applying the patches make things much worse. I still have to investigate why. I'll have another run to see if the results look different, then try to dig more. All results are from the cyclictest json dump. Cheers -- Qais Yousef