* [PATCH] mm: slub: replace kick_all_cpus_sync with synchronize_sched in kmem_cache_shrink
@ 2016-04-01 12:30 ` Vladimir Davydov
0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Davydov @ 2016-04-01 12:30 UTC (permalink / raw)
To: Andrew Morton
Cc: Peter Zijlstra, Christoph Lameter, Joonsoo Kim, Pekka Enberg,
David Rientjes, Johannes Weiner, Michal Hocko, linux-mm,
linux-kernel
When we call __kmem_cache_shrink on memory cgroup removal, we need to
synchronize kmem_cache->cpu_partial update with put_cpu_partial that
might be running on other cpus. Currently, we achieve that by using
kick_all_cpus_sync, which works as a system wide memory barrier. Though
fast it is, this method has a flow - it issues a lot of IPIs, which
might hurt high performance or real-time workloads.
To fix this, let's replace kick_all_cpus_sync with synchronize_sched.
Although the latter one may take much longer to finish, it shouldn't be
a problem in this particular case, because memory cgroups are destroyed
asynchronously from a workqueue so that no user visible effects should
be introduced. OTOH, it will save us from excessive IPIs when someone
removes a cgroup.
Anyway, even if using synchronize_sched turns out to take too long, we
can always introduce a kind of __kmem_cache_shrink batching so that this
method would only be called once per one cgroup destruction (not per
each per memcg kmem cache as it is now).
Reported-and-suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
---
mm/slub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/slub.c b/mm/slub.c
index 279e773d80d3..03067f43dcf4 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3697,7 +3697,7 @@ int __kmem_cache_shrink(struct kmem_cache *s, bool deactivate)
* s->cpu_partial is checked locklessly (see put_cpu_partial),
* so we have to make sure the change is visible.
*/
- kick_all_cpus_sync();
+ synchronize_sched();
}
flush_all(s);
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] mm: slub: replace kick_all_cpus_sync with synchronize_sched in kmem_cache_shrink
@ 2016-04-01 12:30 ` Vladimir Davydov
0 siblings, 0 replies; 6+ messages in thread
From: Vladimir Davydov @ 2016-04-01 12:30 UTC (permalink / raw)
To: Andrew Morton
Cc: Peter Zijlstra, Christoph Lameter, Joonsoo Kim, Pekka Enberg,
David Rientjes, Johannes Weiner, Michal Hocko, linux-mm,
linux-kernel
When we call __kmem_cache_shrink on memory cgroup removal, we need to
synchronize kmem_cache->cpu_partial update with put_cpu_partial that
might be running on other cpus. Currently, we achieve that by using
kick_all_cpus_sync, which works as a system wide memory barrier. Though
fast it is, this method has a flow - it issues a lot of IPIs, which
might hurt high performance or real-time workloads.
To fix this, let's replace kick_all_cpus_sync with synchronize_sched.
Although the latter one may take much longer to finish, it shouldn't be
a problem in this particular case, because memory cgroups are destroyed
asynchronously from a workqueue so that no user visible effects should
be introduced. OTOH, it will save us from excessive IPIs when someone
removes a cgroup.
Anyway, even if using synchronize_sched turns out to take too long, we
can always introduce a kind of __kmem_cache_shrink batching so that this
method would only be called once per one cgroup destruction (not per
each per memcg kmem cache as it is now).
Reported-and-suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
---
mm/slub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/slub.c b/mm/slub.c
index 279e773d80d3..03067f43dcf4 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3697,7 +3697,7 @@ int __kmem_cache_shrink(struct kmem_cache *s, bool deactivate)
* s->cpu_partial is checked locklessly (see put_cpu_partial),
* so we have to make sure the change is visible.
*/
- kick_all_cpus_sync();
+ synchronize_sched();
}
flush_all(s);
--
2.1.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: slub: replace kick_all_cpus_sync with synchronize_sched in kmem_cache_shrink
2016-04-01 12:30 ` Vladimir Davydov
@ 2016-04-01 15:48 ` Peter Zijlstra
-1 siblings, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2016-04-01 15:48 UTC (permalink / raw)
To: Vladimir Davydov
Cc: Andrew Morton, Christoph Lameter, Joonsoo Kim, Pekka Enberg,
David Rientjes, Johannes Weiner, Michal Hocko, linux-mm,
linux-kernel
On Fri, Apr 01, 2016 at 03:30:17PM +0300, Vladimir Davydov wrote:
> When we call __kmem_cache_shrink on memory cgroup removal, we need to
> synchronize kmem_cache->cpu_partial update with put_cpu_partial that
> might be running on other cpus. Currently, we achieve that by using
> kick_all_cpus_sync, which works as a system wide memory barrier. Though
> fast it is, this method has a flow - it issues a lot of IPIs, which
> might hurt high performance or real-time workloads.
>
> To fix this, let's replace kick_all_cpus_sync with synchronize_sched.
> Although the latter one may take much longer to finish, it shouldn't be
> a problem in this particular case, because memory cgroups are destroyed
> asynchronously from a workqueue so that no user visible effects should
> be introduced. OTOH, it will save us from excessive IPIs when someone
> removes a cgroup.
>
> Anyway, even if using synchronize_sched turns out to take too long, we
> can always introduce a kind of __kmem_cache_shrink batching so that this
> method would only be called once per one cgroup destruction (not per
> each per memcg kmem cache as it is now).
>
> Reported-and-suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Thanks!
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: slub: replace kick_all_cpus_sync with synchronize_sched in kmem_cache_shrink
@ 2016-04-01 15:48 ` Peter Zijlstra
0 siblings, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2016-04-01 15:48 UTC (permalink / raw)
To: Vladimir Davydov
Cc: Andrew Morton, Christoph Lameter, Joonsoo Kim, Pekka Enberg,
David Rientjes, Johannes Weiner, Michal Hocko, linux-mm,
linux-kernel
On Fri, Apr 01, 2016 at 03:30:17PM +0300, Vladimir Davydov wrote:
> When we call __kmem_cache_shrink on memory cgroup removal, we need to
> synchronize kmem_cache->cpu_partial update with put_cpu_partial that
> might be running on other cpus. Currently, we achieve that by using
> kick_all_cpus_sync, which works as a system wide memory barrier. Though
> fast it is, this method has a flow - it issues a lot of IPIs, which
> might hurt high performance or real-time workloads.
>
> To fix this, let's replace kick_all_cpus_sync with synchronize_sched.
> Although the latter one may take much longer to finish, it shouldn't be
> a problem in this particular case, because memory cgroups are destroyed
> asynchronously from a workqueue so that no user visible effects should
> be introduced. OTOH, it will save us from excessive IPIs when someone
> removes a cgroup.
>
> Anyway, even if using synchronize_sched turns out to take too long, we
> can always introduce a kind of __kmem_cache_shrink batching so that this
> method would only be called once per one cgroup destruction (not per
> each per memcg kmem cache as it is now).
>
> Reported-and-suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Thanks!
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: slub: replace kick_all_cpus_sync with synchronize_sched in kmem_cache_shrink
2016-04-01 12:30 ` Vladimir Davydov
@ 2016-04-06 11:56 ` Michal Hocko
-1 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2016-04-06 11:56 UTC (permalink / raw)
To: Vladimir Davydov
Cc: Andrew Morton, Peter Zijlstra, Christoph Lameter, Joonsoo Kim,
Pekka Enberg, David Rientjes, Johannes Weiner, linux-mm,
linux-kernel
On Fri 01-04-16 15:30:17, Vladimir Davydov wrote:
> When we call __kmem_cache_shrink on memory cgroup removal, we need to
> synchronize kmem_cache->cpu_partial update with put_cpu_partial that
> might be running on other cpus. Currently, we achieve that by using
> kick_all_cpus_sync, which works as a system wide memory barrier. Though
> fast it is, this method has a flow - it issues a lot of IPIs, which
> might hurt high performance or real-time workloads.
>
> To fix this, let's replace kick_all_cpus_sync with synchronize_sched.
> Although the latter one may take much longer to finish, it shouldn't be
> a problem in this particular case, because memory cgroups are destroyed
> asynchronously from a workqueue so that no user visible effects should
> be introduced. OTOH, it will save us from excessive IPIs when someone
> removes a cgroup.
>
> Anyway, even if using synchronize_sched turns out to take too long, we
> can always introduce a kind of __kmem_cache_shrink batching so that this
> method would only be called once per one cgroup destruction (not per
> each per memcg kmem cache as it is now).
>
> Reported-and-suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> mm/slub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 279e773d80d3..03067f43dcf4 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3697,7 +3697,7 @@ int __kmem_cache_shrink(struct kmem_cache *s, bool deactivate)
> * s->cpu_partial is checked locklessly (see put_cpu_partial),
> * so we have to make sure the change is visible.
> */
> - kick_all_cpus_sync();
> + synchronize_sched();
> }
>
> flush_all(s);
> --
> 2.1.4
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: slub: replace kick_all_cpus_sync with synchronize_sched in kmem_cache_shrink
@ 2016-04-06 11:56 ` Michal Hocko
0 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2016-04-06 11:56 UTC (permalink / raw)
To: Vladimir Davydov
Cc: Andrew Morton, Peter Zijlstra, Christoph Lameter, Joonsoo Kim,
Pekka Enberg, David Rientjes, Johannes Weiner, linux-mm,
linux-kernel
On Fri 01-04-16 15:30:17, Vladimir Davydov wrote:
> When we call __kmem_cache_shrink on memory cgroup removal, we need to
> synchronize kmem_cache->cpu_partial update with put_cpu_partial that
> might be running on other cpus. Currently, we achieve that by using
> kick_all_cpus_sync, which works as a system wide memory barrier. Though
> fast it is, this method has a flow - it issues a lot of IPIs, which
> might hurt high performance or real-time workloads.
>
> To fix this, let's replace kick_all_cpus_sync with synchronize_sched.
> Although the latter one may take much longer to finish, it shouldn't be
> a problem in this particular case, because memory cgroups are destroyed
> asynchronously from a workqueue so that no user visible effects should
> be introduced. OTOH, it will save us from excessive IPIs when someone
> removes a cgroup.
>
> Anyway, even if using synchronize_sched turns out to take too long, we
> can always introduce a kind of __kmem_cache_shrink batching so that this
> method would only be called once per one cgroup destruction (not per
> each per memcg kmem cache as it is now).
>
> Reported-and-suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> mm/slub.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 279e773d80d3..03067f43dcf4 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3697,7 +3697,7 @@ int __kmem_cache_shrink(struct kmem_cache *s, bool deactivate)
> * s->cpu_partial is checked locklessly (see put_cpu_partial),
> * so we have to make sure the change is visible.
> */
> - kick_all_cpus_sync();
> + synchronize_sched();
> }
>
> flush_all(s);
> --
> 2.1.4
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-06 11:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-01 12:30 [PATCH] mm: slub: replace kick_all_cpus_sync with synchronize_sched in kmem_cache_shrink Vladimir Davydov
2016-04-01 12:30 ` Vladimir Davydov
2016-04-01 15:48 ` Peter Zijlstra
2016-04-01 15:48 ` Peter Zijlstra
2016-04-06 11:56 ` Michal Hocko
2016-04-06 11:56 ` Michal Hocko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.