Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932489AbeAKUhn (ORCPT + 1 other); Thu, 11 Jan 2018 15:37:43 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:33285 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932377AbeAKUhk (ORCPT ); Thu, 11 Jan 2018 15:37:40 -0500 X-Google-Smtp-Source: ACJfBos6keSYQqznm4T9WF4Gqr7aL1P7kvkBqfPZ+DBua1+jPVptPrx6Yhg4ltyF/NQ6eTo/oMIYFBIjANDDgIMAla4= MIME-Version: 1.0 In-Reply-To: <1515702883.3039.27.camel@arista.com> References: <20180109133623.10711-1-dima@arista.com> <20180109133623.10711-2-dima@arista.com> <1515620880.3350.44.camel@arista.com> <20180111032232.GA11633@lerouge> <20180111044456.GC11633@lerouge> <1515681091.3039.21.camel@arista.com> <20180111163204.GE6176@hirez.programming.kicks-ass.net> <1515702883.3039.27.camel@arista.com> From: Eric Dumazet Date: Thu, 11 Jan 2018 12:37:37 -0800 Message-ID: Subject: Re: [RFC 1/2] softirq: Defer net rx/tx processing to ksoftirqd context To: Dmitry Safonov Cc: Linus Torvalds , Peter Zijlstra , Frederic Weisbecker , LKML , Dmitry Safonov <0x7f454c46@gmail.com>, Andrew Morton , David Miller , Frederic Weisbecker , Hannes Frederic Sowa , Ingo Molnar , "Levin, Alexander (Sasha Levin)" , Paolo Abeni , "Paul E. McKenney" , Radu Rendec , Rik van Riel , Stanislaw Gruszka , Thomas Gleixner , Wanpeng Li Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, Jan 11, 2018 at 12:34 PM, Dmitry Safonov wrote: > On Thu, 2018-01-11 at 12:22 -0800, Linus Torvalds wrote: >> On Thu, Jan 11, 2018 at 12:16 PM, Eric Dumazet >> wrote: >> > >> > Note that when I implemented TCP Small queues, I did experiments >> > between >> > using a work queue or a tasklet, and workqueues added unacceptable >> > P99 >> > latencies, when many user threads are competing with kernel >> > threads. >> >> Yes. >> >> So I think one solution might be to have a hybrid system, where we do >> the softirq's synchronously normally (which is what you really want >> for good latency). >> >> But then fall down on a threaded model - but that fallback case >> should >> be per-softirq, not global. So if one softirq uses a lot of CPU time, >> that shouldn't affect the latency of other softirqs. >> >> So maybe we could get rid of the per-cpu ksoftirqd entirely, and >> replace it with with per-cpu and per-softirq workqueues? >> >> Would something like that sound sane? >> >> Just a SMOP/SMOT (small matter of programming/testing). > > I could try to write a PoC for that.. > What should be the trigger to fall into workqueue? > How to tell if there're too many softirqs of the kind? > Current logic with if (pending) in the end of __do_softirq() > looks working selectively.. > It looks to be still possible to starve a cpu. I guess we would need to track amount of time spent while processing sortirq (while interrupting a non idle task)