flow_cache_flush must not sleep as it can be called in atomic context;
removed the schedule_work as the deferred processing lead to the flow
cache gc never being actually run under heavy network load
Signed-off-by: Madalin Bucur <redacted>
---
net/core/flow.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
@@ -320,8 +317,7 @@ static void flow_cache_flush_tasklet(unsigned long data)flow_cache_queue_garbage(fcp,deleted,&gc_list);-if(atomic_dec_and_test(&info->cpuleft))-complete(&info->completion);+atomic_dec(&info->cpuleft);}staticvoidflow_cache_flush_per_cpu(void*data)
@@ -339,22 +335,23 @@ static void flow_cache_flush_per_cpu(void *data)voidflow_cache_flush(void){structflow_flush_infoinfo;-staticDEFINE_MUTEX(flow_flush_sem);+staticDEFINE_SPINLOCK(flow_flush_lock);/* Don't want cpus going down or up during this. */get_online_cpus();-mutex_lock(&flow_flush_sem);+spin_lock_bh(&flow_flush_lock);info.cache=&flow_cache_global;atomic_set(&info.cpuleft,num_online_cpus());-init_completion(&info.completion);local_bh_disable();smp_call_function(flow_cache_flush_per_cpu,&info,0);flow_cache_flush_tasklet((unsignedlong)&info);local_bh_enable();-wait_for_completion(&info.completion);-mutex_unlock(&flow_flush_sem);+while(atomic_read(&info.cpuleft)!=0)+cpu_relax();++spin_unlock_bh(&flow_flush_lock);put_online_cpus();}
flow_cache_flush must not sleep as it can be called in atomic context;
removed the schedule_work as the deferred processing lead to the flow
cache gc never being actually run under heavy network load
Signed-off-by: Madalin Bucur <redacted>
How is this called in an atomic context? The only caller of
flow_cache_flush() is __xfrm_garbage_collect() which is only invoked
during a NETDEV_DOWN event which ought to be non-atomic.
afinfo->garbage_collect is the only other place __xfrm_garbage_collect
is referenced, and that is completely unused and should thus be deleted
(I'll take care of that in net-next).
If NETDEV_DOWN notifier is in an atomic context, we need to accomodate
or fix that somehow.
From: David Miller <davem@davemloft.net> Date: 2011-09-27 19:32:45
From: David Miller <davem@davemloft.net>
Date: Tue, 27 Sep 2011 15:28:36 -0400 (EDT)
afinfo->garbage_collect is the only other place __xfrm_garbage_collect
is referenced, and that is completely unused and should thus be deleted
(I'll take care of that in net-next).
Nevermind I see how these are referenced directly via xfrm4_policy.c
and xfrm6_policy.c, sigh...
From: Benjamin Poirier <hidden> Date: 2011-09-29 13:24:13
On 11-09-26 20:09, Madalin Bucur wrote:
quoted hunk
flow_cache_flush must not sleep as it can be called in atomic context;
removed the schedule_work as the deferred processing lead to the flow
cache gc never being actually run under heavy network load
Signed-off-by: Madalin Bucur <redacted>
---
net/core/flow.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
@@ -320,8 +317,7 @@ static void flow_cache_flush_tasklet(unsigned long data)flow_cache_queue_garbage(fcp,deleted,&gc_list);-if(atomic_dec_and_test(&info->cpuleft))-complete(&info->completion);+atomic_dec(&info->cpuleft);}staticvoidflow_cache_flush_per_cpu(void*data)
@@ -339,22 +335,23 @@ static void flow_cache_flush_per_cpu(void *data)voidflow_cache_flush(void){structflow_flush_infoinfo;-staticDEFINE_MUTEX(flow_flush_sem);+staticDEFINE_SPINLOCK(flow_flush_lock);/* Don't want cpus going down or up during this. */get_online_cpus();-mutex_lock(&flow_flush_sem);+spin_lock_bh(&flow_flush_lock);info.cache=&flow_cache_global;atomic_set(&info.cpuleft,num_online_cpus());-init_completion(&info.completion);local_bh_disable();
local_bh_disable may as well be removed with the change to
spin_lock_bh() just above.
Also, I fail to see why bh_disable is needed for
flow_cache_flush_tasklet(). If you don't mind enlightening me, it'll be
appreciated.
Thanks,
-Ben
smp_call_function(flow_cache_flush_per_cpu, &info, 0);
flow_cache_flush_tasklet((unsigned long)&info);
local_bh_enable();
- wait_for_completion(&info.completion);
- mutex_unlock(&flow_flush_sem);
+ while (atomic_read(&info.cpuleft) != 0)
+ cpu_relax();
+
+ spin_unlock_bh(&flow_flush_lock);
put_online_cpus();
}
--
1.7.0.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Sep 27, 2011 at 03:31:32PM -0400, David Miller wrote:
From: David Miller <davem@davemloft.net>
Date: Tue, 27 Sep 2011 15:28:36 -0400 (EDT)
quoted
afinfo->garbage_collect is the only other place __xfrm_garbage_collect
is referenced, and that is completely unused and should thus be deleted
(I'll take care of that in net-next).
Nevermind I see how these are referenced directly via xfrm4_policy.c
and xfrm6_policy.c, sigh...
Is there any progress in fixing this issue? I've seen this occasionally
on some of our production systems, so I fixed it for us in the meantime
with the patch below. I could submit this for inclusion if noone else
wants to fix it in a different manner.
------
net: Add a flow_cache_flush_deferred function
flow_cach_flush() might sleep but can be called from
atomic context via the xfrm garbage collector. So add
a flow_cache_flush_deferred() function and use this if
the xfrm garbage colector is invoked from within the
packet path.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
include/net/flow.h | 1 +
net/core/flow.c | 12 ++++++++++++
net/xfrm/xfrm_policy.c | 18 ++++++++++++++----
3 files changed, 27 insertions(+), 4 deletions(-)
From: Timo Teräs <hidden> Date: 2011-12-20 08:41:44
On 12/20/2011 10:23 AM, Steffen Klassert wrote:
On Tue, Sep 27, 2011 at 03:31:32PM -0400, David Miller wrote:
quoted
From: David Miller <davem@davemloft.net>
Date: Tue, 27 Sep 2011 15:28:36 -0400 (EDT)
quoted
afinfo->garbage_collect is the only other place __xfrm_garbage_collect
is referenced, and that is completely unused and should thus be deleted
(I'll take care of that in net-next).
Nevermind I see how these are referenced directly via xfrm4_policy.c
and xfrm6_policy.c, sigh...
Is there any progress in fixing this issue? I've seen this occasionally
on some of our production systems, so I fixed it for us in the meantime
with the patch below. I could submit this for inclusion if noone else
wants to fix it in a different manner.
------
net: Add a flow_cache_flush_deferred function
flow_cach_flush() might sleep but can be called from
atomic context via the xfrm garbage collector. So add
a flow_cache_flush_deferred() function and use this if
the xfrm garbage colector is invoked from within the
packet path.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Acked-by: Timo Teräs <redacted>
I was first thinking if it made sense to run the local CPUs task
immediately on gc. But since all it does is queue the removed nodes to
the second gc that actually frees the dst's, it doesn't really make a
difference.
So this is probably as good as it gets.
From: David Miller <davem@davemloft.net> Date: 2011-12-21 21:48:56
From: Timo Teräs <redacted>
Date: Tue, 20 Dec 2011 10:41:40 +0200
On 12/20/2011 10:23 AM, Steffen Klassert wrote:
quoted
On Tue, Sep 27, 2011 at 03:31:32PM -0400, David Miller wrote:
quoted
From: David Miller <davem@davemloft.net>
Date: Tue, 27 Sep 2011 15:28:36 -0400 (EDT)
quoted
afinfo->garbage_collect is the only other place __xfrm_garbage_collect
is referenced, and that is completely unused and should thus be deleted
(I'll take care of that in net-next).
Nevermind I see how these are referenced directly via xfrm4_policy.c
and xfrm6_policy.c, sigh...
Is there any progress in fixing this issue? I've seen this occasionally
on some of our production systems, so I fixed it for us in the meantime
with the patch below. I could submit this for inclusion if noone else
wants to fix it in a different manner.
------
net: Add a flow_cache_flush_deferred function
flow_cach_flush() might sleep but can be called from
atomic context via the xfrm garbage collector. So add
a flow_cache_flush_deferred() function and use this if
the xfrm garbage colector is invoked from within the
packet path.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Acked-by: Timo Teräs <redacted>
I was first thinking if it made sense to run the local CPUs task
immediately on gc. But since all it does is queue the removed nodes to
the second gc that actually frees the dst's, it doesn't really make a
difference.
So this is probably as good as it gets.