* [PATCH 0/3] a few cleanups about kmem code
@ 2013-10-23 11:31 Qiang Huang
2013-10-23 11:31 ` [PATCH 1/3] memcg, kmem: Use is_root_cache instead of hard code Qiang Huang
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Qiang Huang @ 2013-10-23 11:31 UTC (permalink / raw)
To: akpm
Cc: hannes, mhocko, cl, penberg, glommer, rientjes, cgroups,
linux-mm, lizefan
Qiang Huang (3):
memcg, kmem: Use is_root_cache instead of hard code
memcg, kmem: rename cache_from_memcg to cache_from_memcg_idx
memcg, kmem: use cache_from_memcg_idx instead of hard code
mm/memcontrol.c | 15 ++++++++-------
mm/slab.c | 2 +-
mm/slab.h | 6 ++++--
mm/slab_common.c | 2 +-
mm/slub.c | 2 +-
5 files changed, 15 insertions(+), 12 deletions(-)
--
1.8.3
--
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>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] memcg, kmem: Use is_root_cache instead of hard code
2013-10-23 11:31 [PATCH 0/3] a few cleanups about kmem code Qiang Huang
@ 2013-10-23 11:31 ` Qiang Huang
2013-10-24 17:30 ` Pekka Enberg
2013-10-31 2:35 ` David Rientjes
2013-10-23 11:31 ` [PATCH 2/3] memcg, kmem: rename cache_from_memcg to cache_from_memcg_idx Qiang Huang
2013-10-23 11:31 ` [PATCH 3/3] memcg, kmem: use cache_from_memcg_idx instead of hard code Qiang Huang
2 siblings, 2 replies; 10+ messages in thread
From: Qiang Huang @ 2013-10-23 11:31 UTC (permalink / raw)
To: akpm
Cc: hannes, mhocko, cl, penberg, glommer, rientjes, cgroups,
linux-mm, lizefan
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
---
mm/memcontrol.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b73988a..15ad0e3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -57,6 +57,7 @@
#include <net/sock.h>
#include <net/ip.h>
#include <net/tcp_memcontrol.h>
+#include "slab.h"
#include <asm/uaccess.h>
@@ -3064,7 +3065,7 @@ int memcg_update_cache_size(struct kmem_cache *s, int num_groups)
{
struct memcg_cache_params *cur_params = s->memcg_params;
- VM_BUG_ON(s->memcg_params && !s->memcg_params->is_root_cache);
+ VM_BUG_ON(!is_root_cache(s));
if (num_groups > memcg_limited_groups_array_size) {
int i;
--
1.8.3
--
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>
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] memcg, kmem: rename cache_from_memcg to cache_from_memcg_idx
2013-10-23 11:31 [PATCH 0/3] a few cleanups about kmem code Qiang Huang
2013-10-23 11:31 ` [PATCH 1/3] memcg, kmem: Use is_root_cache instead of hard code Qiang Huang
@ 2013-10-23 11:31 ` Qiang Huang
2013-10-24 17:31 ` Pekka Enberg
2013-10-31 2:37 ` David Rientjes
2013-10-23 11:31 ` [PATCH 3/3] memcg, kmem: use cache_from_memcg_idx instead of hard code Qiang Huang
2 siblings, 2 replies; 10+ messages in thread
From: Qiang Huang @ 2013-10-23 11:31 UTC (permalink / raw)
To: akpm
Cc: hannes, mhocko, cl, penberg, glommer, rientjes, cgroups,
linux-mm, lizefan
We can't see the relationship with memcg from the parameters,
so the name with memcg_idx would be more reasonable.
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
---
mm/slab.c | 2 +-
mm/slab.h | 6 ++++--
mm/slab_common.c | 2 +-
mm/slub.c | 2 +-
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 8ccd296..3a90fbc 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3977,7 +3977,7 @@ static int do_tune_cpucache(struct kmem_cache *cachep, int limit,
VM_BUG_ON(!mutex_is_locked(&slab_mutex));
for_each_memcg_cache_index(i) {
- c = cache_from_memcg(cachep, i);
+ c = cache_from_memcg_idx(cachep, i);
if (c)
/* return value determined by the parent cache only */
__do_tune_cpucache(c, limit, batchcount, shared, gfp);
diff --git a/mm/slab.h b/mm/slab.h
index f96b49e..a6d5bee 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -160,7 +160,8 @@ static inline const char *cache_name(struct kmem_cache *s)
return s->name;
}
-static inline struct kmem_cache *cache_from_memcg(struct kmem_cache *s, int idx)
+static inline struct kmem_cache *
+cache_from_memcg_idx(struct kmem_cache *s, int idx)
{
return s->memcg_params->memcg_caches[idx];
}
@@ -202,7 +203,8 @@ static inline const char *cache_name(struct kmem_cache *s)
return s->name;
}
-static inline struct kmem_cache *cache_from_memcg(struct kmem_cache *s, int idx)
+static inline struct kmem_cache *
+cache_from_memcg_idx(struct kmem_cache *s, int idx)
{
return NULL;
}
diff --git a/mm/slab_common.c b/mm/slab_common.c
index 2d41450..34d1551 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -552,7 +552,7 @@ memcg_accumulate_slabinfo(struct kmem_cache *s, struct slabinfo *info)
return;
for_each_memcg_cache_index(i) {
- c = cache_from_memcg(s, i);
+ c = cache_from_memcg_idx(s, i);
if (!c)
continue;
diff --git a/mm/slub.c b/mm/slub.c
index 0f3b6c1..0fa9930 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4999,7 +4999,7 @@ static ssize_t slab_attr_store(struct kobject *kobj,
* through the descendants with best-effort propagation.
*/
for_each_memcg_cache_index(i) {
- struct kmem_cache *c = cache_from_memcg(s, i);
+ struct kmem_cache *c = cache_from_memcg_idx(s, i);
if (c)
attribute->store(c, buf, len);
}
--
1.8.3
--
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>
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] memcg, kmem: use cache_from_memcg_idx instead of hard code
2013-10-23 11:31 [PATCH 0/3] a few cleanups about kmem code Qiang Huang
2013-10-23 11:31 ` [PATCH 1/3] memcg, kmem: Use is_root_cache instead of hard code Qiang Huang
2013-10-23 11:31 ` [PATCH 2/3] memcg, kmem: rename cache_from_memcg to cache_from_memcg_idx Qiang Huang
@ 2013-10-23 11:31 ` Qiang Huang
2013-10-24 17:31 ` Pekka Enberg
2013-10-31 2:40 ` David Rientjes
2 siblings, 2 replies; 10+ messages in thread
From: Qiang Huang @ 2013-10-23 11:31 UTC (permalink / raw)
To: akpm
Cc: hannes, mhocko, cl, penberg, glommer, rientjes, cgroups,
linux-mm, lizefan
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
---
mm/memcontrol.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 15ad0e3..5479b37 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2882,7 +2882,7 @@ static struct kmem_cache *memcg_params_to_cache(struct memcg_cache_params *p)
VM_BUG_ON(p->is_root_cache);
cachep = p->root_cache;
- return cachep->memcg_params->memcg_caches[memcg_cache_id(p->memcg)];
+ return cache_from_memcg_idx(cachep, memcg_cache_id(p->memcg));
}
#ifdef CONFIG_SLABINFO
@@ -3323,7 +3323,7 @@ static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *memcg,
idx = memcg_cache_id(memcg);
mutex_lock(&memcg_cache_mutex);
- new_cachep = cachep->memcg_params->memcg_caches[idx];
+ new_cachep = cache_from_memcg_idx(cachep, idx);
if (new_cachep) {
css_put(&memcg->css);
goto out;
@@ -3369,8 +3369,8 @@ void kmem_cache_destroy_memcg_children(struct kmem_cache *s)
* we'll take the set_limit_mutex to protect ourselves against this.
*/
mutex_lock(&set_limit_mutex);
- for (i = 0; i < memcg_limited_groups_array_size; i++) {
- c = s->memcg_params->memcg_caches[i];
+ for_each_memcg_cache_index(i) {
+ c = cache_from_memcg_idx(s, i);
if (!c)
continue;
@@ -3503,8 +3503,8 @@ struct kmem_cache *__memcg_kmem_get_cache(struct kmem_cache *cachep,
* code updating memcg_caches will issue a write barrier to match this.
*/
read_barrier_depends();
- if (likely(cachep->memcg_params->memcg_caches[idx])) {
- cachep = cachep->memcg_params->memcg_caches[idx];
+ if (likely(cache_from_memcg_idx(cachep, idx))) {
+ cachep = cache_from_memcg_idx(cachep, idx);
goto out;
}
--
1.8.3
--
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>
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] memcg, kmem: Use is_root_cache instead of hard code
2013-10-23 11:31 ` [PATCH 1/3] memcg, kmem: Use is_root_cache instead of hard code Qiang Huang
@ 2013-10-24 17:30 ` Pekka Enberg
2013-10-31 2:35 ` David Rientjes
1 sibling, 0 replies; 10+ messages in thread
From: Pekka Enberg @ 2013-10-24 17:30 UTC (permalink / raw)
To: Qiang Huang, akpm
Cc: hannes, mhocko, cl, penberg, glommer, rientjes, cgroups,
linux-mm, lizefan
On 10/23/2013 02:31 PM, Qiang Huang wrote:
> Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
> ---
> mm/memcontrol.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index b73988a..15ad0e3 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -57,6 +57,7 @@
> #include <net/sock.h>
> #include <net/ip.h>
> #include <net/tcp_memcontrol.h>
> +#include "slab.h"
>
> #include <asm/uaccess.h>
>
> @@ -3064,7 +3065,7 @@ int memcg_update_cache_size(struct kmem_cache *s, int num_groups)
> {
> struct memcg_cache_params *cur_params = s->memcg_params;
>
> - VM_BUG_ON(s->memcg_params && !s->memcg_params->is_root_cache);
> + VM_BUG_ON(!is_root_cache(s));
>
> if (num_groups > memcg_limited_groups_array_size) {
> int i;
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Andrew, I think your tree is the right place for these patches.
--
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>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] memcg, kmem: rename cache_from_memcg to cache_from_memcg_idx
2013-10-23 11:31 ` [PATCH 2/3] memcg, kmem: rename cache_from_memcg to cache_from_memcg_idx Qiang Huang
@ 2013-10-24 17:31 ` Pekka Enberg
2013-10-31 2:37 ` David Rientjes
1 sibling, 0 replies; 10+ messages in thread
From: Pekka Enberg @ 2013-10-24 17:31 UTC (permalink / raw)
To: Qiang Huang, akpm
Cc: hannes, mhocko, cl, penberg, glommer, rientjes, cgroups,
linux-mm, lizefan
On 10/23/2013 02:31 PM, Qiang Huang wrote:
> We can't see the relationship with memcg from the parameters,
> so the name with memcg_idx would be more reasonable.
>
> Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Reviewed-by: Pekka Enberg <penberg@kernel.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>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] memcg, kmem: use cache_from_memcg_idx instead of hard code
2013-10-23 11:31 ` [PATCH 3/3] memcg, kmem: use cache_from_memcg_idx instead of hard code Qiang Huang
@ 2013-10-24 17:31 ` Pekka Enberg
2013-10-31 2:40 ` David Rientjes
1 sibling, 0 replies; 10+ messages in thread
From: Pekka Enberg @ 2013-10-24 17:31 UTC (permalink / raw)
To: Qiang Huang, akpm
Cc: hannes, mhocko, cl, penberg, glommer, rientjes, cgroups,
linux-mm, lizefan
On 10/23/2013 02:31 PM, Qiang Huang wrote:
> Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Reviewed-by: Pekka Enberg <penberg@kernel.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>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] memcg, kmem: Use is_root_cache instead of hard code
2013-10-23 11:31 ` [PATCH 1/3] memcg, kmem: Use is_root_cache instead of hard code Qiang Huang
2013-10-24 17:30 ` Pekka Enberg
@ 2013-10-31 2:35 ` David Rientjes
1 sibling, 0 replies; 10+ messages in thread
From: David Rientjes @ 2013-10-31 2:35 UTC (permalink / raw)
To: Qiang Huang
Cc: akpm, hannes, mhocko, cl, penberg, glommer, cgroups, linux-mm, lizefan
On Wed, 23 Oct 2013, Qiang Huang wrote:
> Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: David Rientjes <rientjes@google.com>
--
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>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] memcg, kmem: rename cache_from_memcg to cache_from_memcg_idx
2013-10-23 11:31 ` [PATCH 2/3] memcg, kmem: rename cache_from_memcg to cache_from_memcg_idx Qiang Huang
2013-10-24 17:31 ` Pekka Enberg
@ 2013-10-31 2:37 ` David Rientjes
1 sibling, 0 replies; 10+ messages in thread
From: David Rientjes @ 2013-10-31 2:37 UTC (permalink / raw)
To: Qiang Huang
Cc: akpm, hannes, mhocko, cl, penberg, glommer, cgroups, linux-mm, lizefan
On Wed, 23 Oct 2013, Qiang Huang wrote:
> We can't see the relationship with memcg from the parameters,
> so the name with memcg_idx would be more reasonable.
>
> Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: David Rientjes <rientjes@google.com>
--
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>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] memcg, kmem: use cache_from_memcg_idx instead of hard code
2013-10-23 11:31 ` [PATCH 3/3] memcg, kmem: use cache_from_memcg_idx instead of hard code Qiang Huang
2013-10-24 17:31 ` Pekka Enberg
@ 2013-10-31 2:40 ` David Rientjes
1 sibling, 0 replies; 10+ messages in thread
From: David Rientjes @ 2013-10-31 2:40 UTC (permalink / raw)
To: Qiang Huang
Cc: Andrew Morton, hannes, mhocko, cl, penberg, cgroups, linux-mm, lizefan
On Wed, 23 Oct 2013, Qiang Huang wrote:
> Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: David Rientjes <rientjes@google.com>
--
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>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-10-31 2:40 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-23 11:31 [PATCH 0/3] a few cleanups about kmem code Qiang Huang
2013-10-23 11:31 ` [PATCH 1/3] memcg, kmem: Use is_root_cache instead of hard code Qiang Huang
2013-10-24 17:30 ` Pekka Enberg
2013-10-31 2:35 ` David Rientjes
2013-10-23 11:31 ` [PATCH 2/3] memcg, kmem: rename cache_from_memcg to cache_from_memcg_idx Qiang Huang
2013-10-24 17:31 ` Pekka Enberg
2013-10-31 2:37 ` David Rientjes
2013-10-23 11:31 ` [PATCH 3/3] memcg, kmem: use cache_from_memcg_idx instead of hard code Qiang Huang
2013-10-24 17:31 ` Pekka Enberg
2013-10-31 2:40 ` David Rientjes
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).