Re: [PATCH -mm] slab: delete cache from list after __kmem_cache_shutdown succeeds

2014-06-02 Thread David Rientjes
On Thu, 15 May 2014, Vladimir Davydov wrote:

> Currently, on kmem_cache_destroy we delete the cache from the slab_list
> before __kmem_cache_shutdown, inserting it back to the list on failure.
> Initially, this was done, because we could release the slab_mutex in
> __kmem_cache_shutdown to delete sysfs slub entry, but since commit
> 41a212859a4d ("slub: use sysfs'es release mechanism for kmem_cache") we
> remove sysfs entry later in kmem_cache_destroy after dropping the
> slab_mutex, so that no implementation of __kmem_cache_shutdown can ever
> release the lock. Therefore we can simplify the code a bit by moving
> list_del after __kmem_cache_shutdown.
> 
> Signed-off-by: Vladimir Davydov 

Acked-by: David Rientjes 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -mm] slab: delete cache from list after __kmem_cache_shutdown succeeds

2014-06-02 Thread David Rientjes
On Thu, 15 May 2014, Vladimir Davydov wrote:

 Currently, on kmem_cache_destroy we delete the cache from the slab_list
 before __kmem_cache_shutdown, inserting it back to the list on failure.
 Initially, this was done, because we could release the slab_mutex in
 __kmem_cache_shutdown to delete sysfs slub entry, but since commit
 41a212859a4d (slub: use sysfs'es release mechanism for kmem_cache) we
 remove sysfs entry later in kmem_cache_destroy after dropping the
 slab_mutex, so that no implementation of __kmem_cache_shutdown can ever
 release the lock. Therefore we can simplify the code a bit by moving
 list_del after __kmem_cache_shutdown.
 
 Signed-off-by: Vladimir Davydov vdavy...@parallels.com

Acked-by: David Rientjes rient...@google.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH -mm] slab: delete cache from list after __kmem_cache_shutdown succeeds

2014-05-15 Thread Vladimir Davydov
Currently, on kmem_cache_destroy we delete the cache from the slab_list
before __kmem_cache_shutdown, inserting it back to the list on failure.
Initially, this was done, because we could release the slab_mutex in
__kmem_cache_shutdown to delete sysfs slub entry, but since commit
41a212859a4d ("slub: use sysfs'es release mechanism for kmem_cache") we
remove sysfs entry later in kmem_cache_destroy after dropping the
slab_mutex, so that no implementation of __kmem_cache_shutdown can ever
release the lock. Therefore we can simplify the code a bit by moving
list_del after __kmem_cache_shutdown.

Signed-off-by: Vladimir Davydov 
Cc: Christoph Lameter 
Cc: Pekka Enberg 
---
 mm/slab_common.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/slab_common.c b/mm/slab_common.c
index 48fafb61f35e..735e01a0db6f 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -346,15 +346,15 @@ void kmem_cache_destroy(struct kmem_cache *s)
if (memcg_cleanup_cache_params(s) != 0)
goto out_unlock;
 
-   list_del(>list);
if (__kmem_cache_shutdown(s) != 0) {
-   list_add(>list, _caches);
printk(KERN_ERR "kmem_cache_destroy %s: "
   "Slab cache still has objects\n", s->name);
dump_stack();
goto out_unlock;
}
 
+   list_del(>list);
+
mutex_unlock(_mutex);
if (s->flags & SLAB_DESTROY_BY_RCU)
rcu_barrier();
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH -mm] slab: delete cache from list after __kmem_cache_shutdown succeeds

2014-05-15 Thread Vladimir Davydov
Currently, on kmem_cache_destroy we delete the cache from the slab_list
before __kmem_cache_shutdown, inserting it back to the list on failure.
Initially, this was done, because we could release the slab_mutex in
__kmem_cache_shutdown to delete sysfs slub entry, but since commit
41a212859a4d (slub: use sysfs'es release mechanism for kmem_cache) we
remove sysfs entry later in kmem_cache_destroy after dropping the
slab_mutex, so that no implementation of __kmem_cache_shutdown can ever
release the lock. Therefore we can simplify the code a bit by moving
list_del after __kmem_cache_shutdown.

Signed-off-by: Vladimir Davydov vdavy...@parallels.com
Cc: Christoph Lameter c...@linux-foundation.org
Cc: Pekka Enberg penb...@kernel.org
---
 mm/slab_common.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/slab_common.c b/mm/slab_common.c
index 48fafb61f35e..735e01a0db6f 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -346,15 +346,15 @@ void kmem_cache_destroy(struct kmem_cache *s)
if (memcg_cleanup_cache_params(s) != 0)
goto out_unlock;
 
-   list_del(s-list);
if (__kmem_cache_shutdown(s) != 0) {
-   list_add(s-list, slab_caches);
printk(KERN_ERR kmem_cache_destroy %s: 
   Slab cache still has objects\n, s-name);
dump_stack();
goto out_unlock;
}
 
+   list_del(s-list);
+
mutex_unlock(slab_mutex);
if (s-flags  SLAB_DESTROY_BY_RCU)
rcu_barrier();
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/