linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: memcontrol: do not bypass slab charge if memcg is offline
Date: Thu, 4 Feb 2016 15:33:28 -0500	[thread overview]
Message-ID: <20160204203328.GC8208@cmpxchg.org> (raw)
In-Reply-To: <1454588275-7615-1-git-send-email-vdavydov@virtuozzo.com>

On Thu, Feb 04, 2016 at 03:17:55PM +0300, Vladimir Davydov wrote:
> Slab pages are charged in two steps. First, an appropriate per memcg
> cache is selected (see memcg_kmem_get_cache) basing on the current
> context, then the new slab page is charged to the memory cgroup which
> the selected cache was created for (see memcg_charge_slab ->
> __memcg_kmem_charge_memcg). It is OK to bypass kmemcg charge at step 1,
> but if step 1 succeeded and we successfully allocated a new slab page,
> step 2 must be performed, otherwise we would get a per memcg kmem cache
> which contains a slab that does not hold a reference to the memory
> cgroup owning the cache. Since per memcg kmem caches are destroyed on
> memcg css free, this could result in freeing a cache while there are
> still active objects in it.
> 
> However, currently we will bypass slab page charge if the memory cgroup
> owning the cache is offline (see __memcg_kmem_charge_memcg). This is
> very unlikely to occur in practice, because for this to happen a process
> must be migrated to a different cgroup and the old cgroup must be
> removed while the process is in kmalloc somewhere between steps 1 and 2
> (e.g.  trying to allocate a new page). Nevertheless, it's still better
> to eliminate such a possibility.
> 
> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>

Acked-by: Johannes Weiner <hannes@cmpxchg.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>

      reply	other threads:[~2016-02-04 20:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04 12:17 [PATCH] mm: memcontrol: do not bypass slab charge if memcg is offline Vladimir Davydov
2016-02-04 20:33 ` Johannes Weiner [this message]

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=20160204203328.GC8208@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=vdavydov@virtuozzo.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 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).