linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH] mm/slab: fix kmemcg cache creation delayed issue
@ 2016-10-06 16:02 Doug Smythies
  2016-10-07  5:14 ` Joonsoo Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Smythies @ 2016-10-06 16:02 UTC (permalink / raw)
  To: js1304, 'Andrew Morton'
  Cc: 'Christoph Lameter', 'Pekka Enberg',
	'David Rientjes', 'Johannes Weiner',
	'Vladimir Davydov', linux-mm, linux-kernel,
	'Joonsoo Kim', stable

It was my (limited) understanding that the subsequent 2 patch set
superseded this patch. Indeed, the 2 patch set seems to solve
both the SLAB and SLUB bug reports.

References:

https://bugzilla.kernel.org/show_bug.cgi?id=172981
https://bugzilla.kernel.org/show_bug.cgi?id=172991
https://patchwork.kernel.org/patch/9361853
https://patchwork.kernel.org/patch/9359271
 
On 2016.10.05 23:21 Joonsoo Kim wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
> There is a bug report that SLAB makes extreme load average due to
> over 2000 kworker thread.
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=172981
>
> This issue is caused by kmemcg feature that try to create new set of
> kmem_caches for each memcg. Recently, kmem_cache creation is slowed by
> synchronize_sched() and futher kmem_cache creation is also delayed
> since kmem_cache creation is synchronized by a global slab_mutex lock.
> So, the number of kworker that try to create kmem_cache increases quitely.
> synchronize_sched() is for lockless access to node's shared array but
> it's not needed when a new kmem_cache is created. So, this patch
> rules out that case.
>
> Fixes: 801faf0db894 ("mm/slab: lockless decision to grow cache")
> Cc: stable@vger.kernel.org
> Reported-by: Doug Smythies <dsmythies@telus.net>
> Tested-by: Doug Smythies <dsmythies@telus.net>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> ---
> mm/slab.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/slab.c b/mm/slab.c
> index 6508b4d..3c83c29 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -961,7 +961,7 @@ static int setup_kmem_cache_node(struct kmem_cache *cachep,
> 	 * guaranteed to be valid until irq is re-enabled, because it will be
> 	 * freed after synchronize_sched().
> 	 */
> -	if (force_change)
> +	if (old_shared && force_change)
> 		synchronize_sched();
> 
> fail:
> -- 
> 1.9.1


--
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] 5+ messages in thread
* [PATCH] mm/slab: fix kmemcg cache creation delayed issue
@ 2016-10-06  6:20 js1304
  0 siblings, 0 replies; 5+ messages in thread
From: js1304 @ 2016-10-06  6:20 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Johannes Weiner,
	Vladimir Davydov, Doug Smythies, linux-mm, linux-kernel,
	Joonsoo Kim, stable

From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

There is a bug report that SLAB makes extreme load average due to
over 2000 kworker thread.

https://bugzilla.kernel.org/show_bug.cgi?id=172981

This issue is caused by kmemcg feature that try to create new set of
kmem_caches for each memcg. Recently, kmem_cache creation is slowed by
synchronize_sched() and futher kmem_cache creation is also delayed
since kmem_cache creation is synchronized by a global slab_mutex lock.
So, the number of kworker that try to create kmem_cache increases quitely.
synchronize_sched() is for lockless access to node's shared array but
it's not needed when a new kmem_cache is created. So, this patch
rules out that case.

Fixes: 801faf0db894 ("mm/slab: lockless decision to grow cache")
Cc: stable@vger.kernel.org
Reported-by: Doug Smythies <dsmythies@telus.net>
Tested-by: Doug Smythies <dsmythies@telus.net>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
 mm/slab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slab.c b/mm/slab.c
index 6508b4d..3c83c29 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -961,7 +961,7 @@ static int setup_kmem_cache_node(struct kmem_cache *cachep,
 	 * guaranteed to be valid until irq is re-enabled, because it will be
 	 * freed after synchronize_sched().
 	 */
-	if (force_change)
+	if (old_shared && force_change)
 		synchronize_sched();
 
 fail:
-- 
1.9.1

--
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] 5+ messages in thread

end of thread, other threads:[~2016-10-13  7:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-06 16:02 [PATCH] mm/slab: fix kmemcg cache creation delayed issue Doug Smythies
2016-10-07  5:14 ` Joonsoo Kim
2016-10-07  8:20   ` Michal Hocko
2016-10-13  7:42     ` Joonsoo Kim
  -- strict thread matches above, loose matches on Subject: below --
2016-10-06  6:20 js1304

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).