lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 11 Jan 2018 04:22:34 +0100
From:   Frederic Weisbecker <frederic@...nel.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Dmitry Safonov <dima@...sta.com>,
        Eric Dumazet <edumazet@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Dmitry Safonov <0x7f454c46@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        David Miller <davem@...emloft.net>,
        Frederic Weisbecker <fweisbec@...il.com>,
        Hannes Frederic Sowa <hannes@...essinduktion.org>,
        Ingo Molnar <mingo@...nel.org>,
        "Levin, Alexander (Sasha Levin)" <alexander.levin@...izon.com>,
        Paolo Abeni <pabeni@...hat.com>,
        "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Radu Rendec <rrendec@...sta.com>,
        Rik van Riel <riel@...hat.com>,
        Stanislaw Gruszka <sgruszka@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Wanpeng Li <wanpeng.li@...mail.com>
Subject: Re: [RFC 1/2] softirq: Defer net rx/tx processing to ksoftirqd
 context

On Wed, Jan 10, 2018 at 06:13:01PM -0800, Linus Torvalds wrote:
> So just saying "hey, ksoftirq is runnable - but maybe not running
> _now"" and ignoring softirqs entirely is just stupid. Even if we could
> easily do another small bunch of them, at least the non-networking
> ones.
> 
> So maybe that "ksoftirqd_running()" check should actually be something like
> 
>   static bool ksoftirqd_running(void)
>   {
>         struct task_struct *tsk = __this_cpu_read(ksoftirqd);
> 
>         return tsk == current;
>   }
> 
> which actually checks that ksoftirq is running right *now*, and not
> scheduled away because somebody is running a perl script.

Makes sense, but I think you need to keep the TASK_RUNNING check. In case
the hardirq is interrupting ksoftirqd in TASK_INTERRUPTIBLE state right before
it's going to sleep. In that case neither ksoftirqd nor the hardirq are going
to serve the poor pending softirqd. And if we are in nohz mode, it may not be
served before a while. So perhaps it should be:

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 2f5e87f..6e5d7bc 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -85,7 +85,7 @@ static bool ksoftirqd_running(void)
 {
 	struct task_struct *tsk = __this_cpu_read(ksoftirqd);
 
-	return tsk && (tsk->state == TASK_RUNNING);
+	return (tsk == current) && (tsk->state == TASK_RUNNING);
 }
 
 /*

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ