]> git.karo-electronics.de Git - karo-tx-linux.git/commit
memcg: wait for kfree's to finish before destroying cache
authorVladimir Davydov <vdavydov@parallels.com>
Thu, 26 Jun 2014 00:42:31 +0000 (10:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 26 Jun 2014 00:42:31 +0000 (10:42 +1000)
commit0b3785f7e8a6a1d2d243738834e1c45c4bb5f261
tree7204f4dcb18a950e16c3dbaeeed2085678f3b64d
parent38697407d80a97fc3b5a016402efcf011531936b
memcg: wait for kfree's to finish before destroying cache

kmem_cache_free doesn't expect that the cache can be destroyed as soon as
the object is freed, e.g.  SLUB's implementation may want to update cache
stats after putting the object to the free list.

Therefore we should wait for all kmem_cache_free's to finish before
proceeding to cache destruction.  Since both SLAB and SLUB versions of
kmem_cache_free are non-preemptable, we wait for rcu-sched grace period to
elapse.

Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/slab.h
mm/memcontrol.c