All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] slab_common: clear pointers to per memcg caches on destroy
Date: Fri, 9 Oct 2015 11:08:36 +0300	[thread overview]
Message-ID: <20151009080835.GC2302@esperanza> (raw)
In-Reply-To: <20151008141735.d545d3fa1ab0244f69c41cdf@linux-foundation.org>

On Thu, Oct 08, 2015 at 02:17:35PM -0700, Andrew Morton wrote:
> On Thu, 8 Oct 2015 19:02:40 +0300 Vladimir Davydov <vdavydov@virtuozzo.com> wrote:
> 
> > Currently, we do not clear pointers to per memcg caches in the
> > memcg_params.memcg_caches array when a global cache is destroyed with
> > kmem_cache_destroy. It is fine if the global cache does get destroyed.
> > However, a cache can be left on the list if it still has active objects
> > when kmem_cache_destroy is called (due to a memory leak). If this
> > happens, the entries in the array will point to already freed areas,
> > which is likely to result in data corruption when the cache is reused
> > (via slab merging).
> 
> It's important that we report these leaks so the kernel bug can get
> fixed.  The patch doesn't add such detection and reporting, but it
> could do so?

Reporting individual leaks is up to the slab implementation, we simply
can't do it from the generic code, so we just warn that there is a leak
there. SLUB already dumps addresses of all leaked objects to the log
(see kmem_cache_close -> free_partial -> list_slab_objects).

Thanks,
Vladimir

--
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@virtuozzo.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] slab_common: clear pointers to per memcg caches on destroy
Date: Fri, 9 Oct 2015 11:08:36 +0300	[thread overview]
Message-ID: <20151009080835.GC2302@esperanza> (raw)
In-Reply-To: <20151008141735.d545d3fa1ab0244f69c41cdf@linux-foundation.org>

On Thu, Oct 08, 2015 at 02:17:35PM -0700, Andrew Morton wrote:
> On Thu, 8 Oct 2015 19:02:40 +0300 Vladimir Davydov <vdavydov@virtuozzo.com> wrote:
> 
> > Currently, we do not clear pointers to per memcg caches in the
> > memcg_params.memcg_caches array when a global cache is destroyed with
> > kmem_cache_destroy. It is fine if the global cache does get destroyed.
> > However, a cache can be left on the list if it still has active objects
> > when kmem_cache_destroy is called (due to a memory leak). If this
> > happens, the entries in the array will point to already freed areas,
> > which is likely to result in data corruption when the cache is reused
> > (via slab merging).
> 
> It's important that we report these leaks so the kernel bug can get
> fixed.  The patch doesn't add such detection and reporting, but it
> could do so?

Reporting individual leaks is up to the slab implementation, we simply
can't do it from the generic code, so we just warn that there is a leak
there. SLUB already dumps addresses of all leaked objects to the log
(see kmem_cache_close -> free_partial -> list_slab_objects).

Thanks,
Vladimir

  reply	other threads:[~2015-10-09  8:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08 16:02 [PATCH 1/3] slab_common: rename cache create/destroy helpers Vladimir Davydov
2015-10-08 16:02 ` Vladimir Davydov
2015-10-08 16:02 ` [PATCH 2/3] slab_common: clear pointers to per memcg caches on destroy Vladimir Davydov
2015-10-08 16:02   ` Vladimir Davydov
2015-10-08 21:17   ` Andrew Morton
2015-10-08 21:17     ` Andrew Morton
2015-10-09  8:08     ` Vladimir Davydov [this message]
2015-10-09  8:08       ` Vladimir Davydov
2015-10-08 16:02 ` [PATCH 3/3] slab_common: do not warn that cache is busy on destroy more than once Vladimir Davydov
2015-10-08 16:02   ` Vladimir Davydov
2015-10-08 16:54 ` [PATCH 1/3] slab_common: rename cache create/destroy helpers Christoph Lameter
2015-10-08 16:54   ` Christoph Lameter
2015-10-14  2:35 ` David Rientjes
2015-10-14  2:35   ` David Rientjes

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=20151009080835.GC2302@esperanza \
    --to=vdavydov@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /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.