All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov@parallels.com>
To: Christoph Lameter <cl@gentwo.org>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@suse.cz,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH -mm 8/8] slab: reap dead memcg caches aggressively
Date: Sat, 31 May 2014 15:19:23 +0400	[thread overview]
Message-ID: <20140531111922.GD25076@esperanza> (raw)
In-Reply-To: <alpine.DEB.2.10.1405300957390.11943@gentwo.org>

On Fri, May 30, 2014 at 10:01:26AM -0500, Christoph Lameter wrote:
> On Fri, 30 May 2014, Vladimir Davydov wrote:
> 
> > We don't disable free objects caching for SLAB, because it would force
> > kfree to always take a spin lock, which would degrade performance
> > significantly.
> 
> You can use a similar approach than in SLUB. Reduce the size of the per
> cpu array objects to zero. Then SLAB will always fall back to its slow
> path in cache_flusharray() where you may be able to do something with less
> of an impact on performace.

In contrast to SLUB, for SLAB this will slow down kfree significantly.
Fast path for SLAB is just putting an object to a per cpu array, while
the slow path requires taking a per node lock, which is much slower even
with no contention. There still can be lots of objects in a dead memcg
cache (e.g. hundreds of megabytes of dcache), so such performance
degradation is not acceptable, IMO.

OTOH, we already have cache_reap running periodically for each cache.
Making it drain all free objects in dead caches won't impact performance
at all, neither will it complicate the code. The only downside is a dead
cache won't be destroyed immediately after it becomes unused, but since
cache_reap runs pretty often (each several secs), it shouldn't result in
any problems, I guess.

Thanks.

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Davydov <vdavydov@parallels.com>
To: Christoph Lameter <cl@gentwo.org>
Cc: <akpm@linux-foundation.org>, <hannes@cmpxchg.org>,
	<mhocko@suse.cz>, <linux-kernel@vger.kernel.org>,
	<linux-mm@kvack.org>
Subject: Re: [PATCH -mm 8/8] slab: reap dead memcg caches aggressively
Date: Sat, 31 May 2014 15:19:23 +0400	[thread overview]
Message-ID: <20140531111922.GD25076@esperanza> (raw)
In-Reply-To: <alpine.DEB.2.10.1405300957390.11943@gentwo.org>

On Fri, May 30, 2014 at 10:01:26AM -0500, Christoph Lameter wrote:
> On Fri, 30 May 2014, Vladimir Davydov wrote:
> 
> > We don't disable free objects caching for SLAB, because it would force
> > kfree to always take a spin lock, which would degrade performance
> > significantly.
> 
> You can use a similar approach than in SLUB. Reduce the size of the per
> cpu array objects to zero. Then SLAB will always fall back to its slow
> path in cache_flusharray() where you may be able to do something with less
> of an impact on performace.

In contrast to SLUB, for SLAB this will slow down kfree significantly.
Fast path for SLAB is just putting an object to a per cpu array, while
the slow path requires taking a per node lock, which is much slower even
with no contention. There still can be lots of objects in a dead memcg
cache (e.g. hundreds of megabytes of dcache), so such performance
degradation is not acceptable, IMO.

OTOH, we already have cache_reap running periodically for each cache.
Making it drain all free objects in dead caches won't impact performance
at all, neither will it complicate the code. The only downside is a dead
cache won't be destroyed immediately after it becomes unused, but since
cache_reap runs pretty often (each several secs), it shouldn't result in
any problems, I guess.

Thanks.

  reply	other threads:[~2014-05-31 11:19 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-30 13:51 [PATCH -mm 0/8] memcg/slab: reintroduce dead cache self-destruction Vladimir Davydov
2014-05-30 13:51 ` Vladimir Davydov
2014-05-30 13:51 ` [PATCH -mm 1/8] memcg: cleanup memcg_cache_params refcnt usage Vladimir Davydov
2014-05-30 13:51   ` Vladimir Davydov
2014-05-30 14:31   ` Christoph Lameter
2014-05-30 14:31     ` Christoph Lameter
2014-05-30 13:51 ` [PATCH -mm 2/8] memcg: destroy kmem caches when last slab is freed Vladimir Davydov
2014-05-30 13:51   ` Vladimir Davydov
2014-05-30 14:32   ` Christoph Lameter
2014-05-30 14:32     ` Christoph Lameter
2014-05-30 13:51 ` [PATCH -mm 3/8] memcg: mark caches that belong to offline memcgs as dead Vladimir Davydov
2014-05-30 13:51   ` Vladimir Davydov
2014-05-30 14:33   ` Christoph Lameter
2014-05-30 14:33     ` Christoph Lameter
2014-05-30 13:51 ` [PATCH -mm 4/8] slub: never fail kmem_cache_shrink Vladimir Davydov
2014-05-30 13:51   ` Vladimir Davydov
2014-05-30 14:46   ` Christoph Lameter
2014-05-30 14:46     ` Christoph Lameter
2014-05-31 10:18     ` Vladimir Davydov
2014-05-31 10:18       ` Vladimir Davydov
2014-06-02 15:13       ` Christoph Lameter
2014-06-02 15:13         ` Christoph Lameter
2014-05-30 13:51 ` [PATCH -mm 5/8] slab: remove kmem_cache_shrink retval Vladimir Davydov
2014-05-30 13:51   ` Vladimir Davydov
2014-05-30 14:49   ` Christoph Lameter
2014-05-30 14:49     ` Christoph Lameter
2014-05-31 10:27     ` Vladimir Davydov
2014-05-31 10:27       ` Vladimir Davydov
2014-06-02 15:16       ` Christoph Lameter
2014-06-02 15:16         ` Christoph Lameter
2014-06-03  9:06         ` Vladimir Davydov
2014-06-03  9:06           ` Vladimir Davydov
2014-06-03 14:48           ` Christoph Lameter
2014-06-03 14:48             ` Christoph Lameter
2014-06-03 19:00             ` Vladimir Davydov
2014-06-03 19:00               ` Vladimir Davydov
2014-05-30 13:51 ` [PATCH -mm 6/8] slub: do not use cmpxchg for adding cpu partials when irqs disabled Vladimir Davydov
2014-05-30 13:51   ` Vladimir Davydov
2014-05-30 13:51 ` [PATCH -mm 7/8] slub: make dead caches discard free slabs immediately Vladimir Davydov
2014-05-30 13:51   ` Vladimir Davydov
2014-05-30 14:57   ` Christoph Lameter
2014-05-30 14:57     ` Christoph Lameter
2014-05-31 11:04     ` Vladimir Davydov
2014-05-31 11:04       ` Vladimir Davydov
2014-06-02  4:24       ` Joonsoo Kim
2014-06-02  4:24         ` Joonsoo Kim
2014-06-02 11:47         ` Vladimir Davydov
2014-06-02 11:47           ` Vladimir Davydov
2014-06-02 14:03           ` Joonsoo Kim
2014-06-02 14:03             ` Joonsoo Kim
2014-06-02 15:17             ` Christoph Lameter
2014-06-02 15:17               ` Christoph Lameter
2014-06-03  8:16             ` Vladimir Davydov
2014-06-03  8:16               ` Vladimir Davydov
2014-06-04  8:53               ` Joonsoo Kim
2014-06-04  8:53                 ` Joonsoo Kim
2014-06-04  9:47                 ` Vladimir Davydov
2014-06-04  9:47                   ` Vladimir Davydov
2014-05-30 13:51 ` [PATCH -mm 8/8] slab: reap dead memcg caches aggressively Vladimir Davydov
2014-05-30 13:51   ` Vladimir Davydov
2014-05-30 15:01   ` Christoph Lameter
2014-05-30 15:01     ` Christoph Lameter
2014-05-31 11:19     ` Vladimir Davydov [this message]
2014-05-31 11:19       ` Vladimir Davydov
2014-06-02 15:24       ` Christoph Lameter
2014-06-02 15:24         ` Christoph Lameter
2014-06-03 20:18         ` Vladimir Davydov
2014-06-03 20:18           ` Vladimir Davydov
2014-06-02  4:41   ` Joonsoo Kim
2014-06-02  4:41     ` Joonsoo Kim
2014-06-02 12:10     ` Vladimir Davydov
2014-06-02 12:10       ` Vladimir Davydov
2014-06-02 14:01       ` Joonsoo Kim
2014-06-02 14:01         ` Joonsoo Kim
2014-06-03  8:21         ` Vladimir Davydov
2014-06-03  8:21           ` Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140531111922.GD25076@esperanza \
    --to=vdavydov@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.