From: Vladimir Davydov <vdavydov@parallels.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: akpm@linux-foundation.org, rientjes@google.com,
penberg@kernel.org, cl@linux.com, glommer@gmail.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
devel@openvz.org
Subject: Re: [PATCH v2 3/7] memcg, slab: separate memcg vs root cache creation paths
Date: Tue, 4 Feb 2014 23:19:24 +0400 [thread overview]
Message-ID: <52F13D3C.801@parallels.com> (raw)
In-Reply-To: <20140204160336.GL4890@dhcp22.suse.cz>
[-- Attachment #1: Type: text/plain, Size: 2440 bytes --]
On 02/04/2014 08:03 PM, Michal Hocko wrote:
> On Mon 03-02-14 19:54:38, Vladimir Davydov wrote:
>> Memcg-awareness turned kmem_cache_create() into a dirty interweaving of
>> memcg-only and except-for-memcg calls. To clean this up, let's create a
>> separate function handling memcg caches creation. Although this will
>> result in the two functions having several hunks of practically the same
>> code, I guess this is the case when readability fully covers the cost of
>> code duplication.
> I don't know. The code is apparently cleaner because calling a function
> with NULL memcg just to go via several if (memcg) branches is ugly as
> hell. But having a duplicated function like this calls for a problem
> later.
>
> Would it be possible to split kmem_cache_create into memcg independant
> part and do the rest in a single memcg branch?
May be, something like the patch attached?
>
>> Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
>> ---
>> include/linux/memcontrol.h | 14 ++---
>> include/linux/slab.h | 9 ++-
>> mm/memcontrol.c | 16 ++----
>> mm/slab_common.c | 130 ++++++++++++++++++++++++++------------------
>> 4 files changed, 90 insertions(+), 79 deletions(-)
>>
>> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
>> index 84e4801fc36c..de79a9617e09 100644
>> --- a/include/linux/memcontrol.h
>> +++ b/include/linux/memcontrol.h
>> @@ -500,8 +500,8 @@ int memcg_cache_id(struct mem_cgroup *memcg);
>>
>> char *memcg_create_cache_name(struct mem_cgroup *memcg,
>> struct kmem_cache *root_cache);
>> -int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s,
>> - struct kmem_cache *root_cache);
>> +int memcg_alloc_cache_params(struct kmem_cache *s,
>> + struct mem_cgroup *memcg, struct kmem_cache *root_cache);
> Why is the parameters ordering changed? It really doesn't help
> review the patch.
Oh, this is because seeing something like
memcg_alloc_cache_params(NULL, s, NULL);
hurts my brain :-) I prefer to have NULLs in the end.
> Also what does `s' stand for and can we use a more
> descriptive name, please?
Yes, we can call it `cachep', but it would be too long :-/
`s' is the common name for a kmem_cache throughout mm/sl[au]b.c so I
guess it fits here. However, this function certainly needs a comment - I
guess I'll do it along with swapping the function parameters in a
separate patch.
Thanks.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-memcg-slab-separate-memcg-vs-root-cache-creation-pat.patch --]
[-- Type: text/x-patch; name="0001-memcg-slab-separate-memcg-vs-root-cache-creation-pat.patch", Size: 0 bytes --]
next prev parent reply other threads:[~2014-02-04 19:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-03 15:54 [PATCH v2 0/7] memcg-vs-slab related fixes, improvements, cleanups Vladimir Davydov
2014-02-03 15:54 ` [PATCH v2 1/7] memcg, slab: never try to merge memcg caches Vladimir Davydov
2014-02-03 15:54 ` [PATCH v2 2/7] memcg, slab: cleanup memcg cache name creation Vladimir Davydov
2014-02-03 22:08 ` Andrew Morton
2014-02-04 6:27 ` Vladimir Davydov
2014-02-04 7:39 ` [PATCH] memcg, slab: cleanup memcg cache creation Vladimir Davydov
2014-02-04 15:33 ` Michal Hocko
2014-02-04 16:09 ` Vladimir Davydov
2014-02-03 15:54 ` [PATCH v2 3/7] memcg, slab: separate memcg vs root cache creation paths Vladimir Davydov
2014-02-04 16:03 ` Michal Hocko
2014-02-04 19:19 ` Vladimir Davydov [this message]
2014-02-06 16:41 ` Michal Hocko
2014-02-06 17:12 ` Vladimir Davydov
2014-02-06 18:17 ` Michal Hocko
2014-02-06 18:43 ` Vladimir Davydov
2014-02-03 15:54 ` [PATCH v2 4/7] memcg, slab: unregister cache from memcg before starting to destroy it Vladimir Davydov
2014-02-03 15:54 ` [PATCH v2 5/7] memcg, slab: do not destroy children caches if parent has aliases Vladimir Davydov
2014-02-03 15:54 ` [PATCH v2 6/7] slub: adjust memcg caches when creating cache alias Vladimir Davydov
2014-02-03 15:54 ` [PATCH v2 7/7] slub: rework sysfs layout for memcg caches Vladimir Davydov
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=52F13D3C.801@parallels.com \
--to=vdavydov@parallels.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=devel@openvz.org \
--cc=glommer@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--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 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).