linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@parallels.com>
To: Mel Gorman <mgorman@suse.de>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	cgroups@vger.kernel.org, devel@openvz.org,
	Michal Hocko <mhocko@suse.cz>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	kamezawa.hiroyu@jp.fujitsu.com, Christoph Lameter <cl@linux.com>,
	David Rientjes <rientjes@google.com>,
	Pekka Enberg <penberg@kernel.org>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	Suleiman Souhlal <suleiman@google.com>
Subject: Re: [PATCH v2 07/11] mm: Allocate kernel pages to the right memcg
Date: Wed, 15 Aug 2012 17:39:58 +0400	[thread overview]
Message-ID: <502BA6AE.9000209@parallels.com> (raw)
In-Reply-To: <20120815132244.GQ4177@suse.de>

>>
>> As for the type, do you think using struct mem_cgroup would be less
>> confusing?
>>
> 
> Yes and returning the mem_cgroup or NULL instead of bool.

Ok. struct mem_cgroup it is.

> 
>> The placeholder is there, but it is later patched
>> to the final thing.
>> With that explained, if you want me to change it to something else, I
>> can do it. Should I ?
>>
> 
> Not in this patch anyway. I would have preferred a pattern like this but
> that's about it.
> 
> #ifdef CONFIG_MEMCG_KMEM
> extern struct static_key memcg_kmem_enabled_key;
> static inline int memcg_kmem_enabled(void)
> {
>        return static_key_false(&memcg_kmem_enabled_key);
> }
> #else
> 
> static inline bool memcg_kmem_enabled(void)
> {
>        return false;
> }
> #endif
> 

humm, I'll have to think about this name.
"memcg_kmem_enabled" means it is enabled in this cgroup. It is actually
used inside memcontrol.c to denote precisely that.

Now the static branch, of course, means it is globally enabled. Or as I
called here, "on".


> Two reasons. One, it does not use the terms "on" and "enabled"
> interchangeably.  The other reason is down to taste as I'm copying the
> pattern I used myself for sk_memalloc_socks(). Of course I am biased.
> 
> Also, why is the key exported?
> 

Same reason. The slab will now have inline functions that will test
against that. The alloc functions themselves, are inside the page
allocator, and the exports can go away.

But the static branch will still be tested inside inlined functions in
the slab.

That said, for the sake of simplicity, I can make it go away here, and
add that to the right place later.

>>> I also find it *very* strange to have a function named as if it is an
>>> allocation-style function when it in fact it's looking up a mem_cgroup
>>> and charging it (and uncharging it in the error path if necessary). If
>>> it was called memcg_kmem_newpage_charge I might have found it a little
>>> better.
>>
>> I don't feel strongly about names in general. I can change it.
>> Will update to memcg_kmem_newpage_charge() and memcg_kmem_page_uncharge().
>>
> 
> I would prefer that anyway. Names have meaning and people make assumptions on
> the implementation depending on the name. We should try to be as consistent
> as possible or maintenance becomes harder. I know there are areas where
> we are not consistent at all but we should not compound the problem.

memcg_kmem_page_charge() is even better I believe, and that is what I
changed this to in my tree.

>>> As this thing is called from within the allocator, it's not clear why
>>> __memcg_kmem_new_page is exported. I can't imagine why a module would call
>>> it directly although maybe you cover that somewhere else in the series.
>>
>> Okay, more people commented on this, so let me clarify: They shouldn't
>> be. They were initially exported when this was about the slab only,
>> because they could be called from inlined functions from the allocators.
>> Now that the charge/uncharge was moved to the page allocator - which
>> already allowed me the big benefit of separating this in two pieces,
>> none of this needs to be exported.
>>
>> Sorry for not noticing this myself, but thanks for the eyes =)
>>
> 
> You're welcome. I expect to see all the exports disappear so. If there
> are any exports left I think it would be important to document why they
> have to be exported. This is particularly true because they are
> EXPORT_SYMBOL not EXPORT_SYMBOL_GPL. I think it would be good to know in
> advance why a module (particularly an out-of-tree one) would be
> interested.
> 

I will remove them all for now.

--
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:[~2012-08-15 13:40 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-09 13:01 [PATCH v2 00/11] Request for Inclusion: kmem controller for memcg Glauber Costa
2012-08-09 13:01 ` [PATCH v2 01/11] memcg: Make it possible to use the stock for more than one page Glauber Costa
2012-08-10 15:12   ` Michal Hocko
2012-08-09 13:01 ` [PATCH v2 02/11] memcg: Reclaim when more than one page needed Glauber Costa
2012-08-10 15:42   ` Michal Hocko
2012-08-10 16:49     ` Kamezawa Hiroyuki
2012-08-10 17:28       ` Michal Hocko
2012-08-10 17:56         ` Kamezawa Hiroyuki
2012-08-10 17:30   ` Michal Hocko
2012-08-10 18:52     ` Michal Hocko
2012-08-10 18:54   ` Michal Hocko
2012-08-13  8:05     ` Glauber Costa
2012-08-13 13:10       ` Michal Hocko
2012-08-09 13:01 ` [PATCH v2 03/11] memcg: change defines to an enum Glauber Costa
2012-08-10 15:43   ` Michal Hocko
2012-08-09 13:01 ` [PATCH v2 04/11] kmem accounting basic infrastructure Glauber Costa
2012-08-10 17:02   ` Kamezawa Hiroyuki
2012-08-13  8:36     ` Glauber Costa
2012-08-17  2:38       ` Kamezawa Hiroyuki
2012-08-14 16:21   ` Michal Hocko
2012-08-15  9:33     ` Glauber Costa
2012-08-15 11:12       ` James Bottomley
2012-08-15 12:55         ` Michal Hocko
2012-08-15 13:29           ` James Bottomley
2012-08-15 12:39       ` Michal Hocko
2012-08-15 12:53         ` Glauber Costa
2012-08-15 13:02           ` Michal Hocko
2012-08-15 13:04             ` Glauber Costa
2012-08-15 13:26               ` Michal Hocko
2012-08-15 13:31                 ` Glauber Costa
2012-08-15 14:10                   ` Michal Hocko
2012-08-15 14:11                     ` Glauber Costa
2012-08-15 14:47         ` Christoph Lameter
2012-08-15 15:11           ` Glauber Costa
2012-08-15 15:34             ` Christoph Lameter
2012-08-15 15:35               ` Glauber Costa
2012-08-15 17:26                 ` Christoph Lameter
2012-08-15 18:11               ` Ying Han
2012-08-15 18:25                 ` Christoph Lameter
2012-08-15 19:22                   ` Glauber Costa
2012-08-15 18:07             ` Ying Han
2012-08-15 15:19           ` Greg Thelen
2012-08-15 15:36             ` Christoph Lameter
2012-08-15 18:01         ` Ying Han
2012-08-15 18:00           ` Glauber Costa
2012-08-15 19:50     ` Ying Han
2012-08-16 15:25       ` Michal Hocko
2012-08-17  5:58         ` Ying Han
2012-08-09 13:01 ` [PATCH v2 05/11] Add a __GFP_KMEMCG flag Glauber Costa
2012-08-10 17:07   ` Kamezawa Hiroyuki
2012-08-09 13:01 ` [PATCH v2 06/11] memcg: kmem controller infrastructure Glauber Costa
2012-08-10 17:27   ` Kamezawa Hiroyuki
2012-08-13  8:28     ` Glauber Costa
2012-08-14 18:58       ` Greg Thelen
2012-08-15  9:18         ` Glauber Costa
2012-08-15 16:38           ` Greg Thelen
2012-08-15 17:00             ` Glauber Costa
2012-08-15 17:12               ` Greg Thelen
2012-08-15 19:31                 ` Glauber Costa
2012-08-16  3:37                   ` Greg Thelen
2012-08-16  7:47                     ` Glauber Costa
2012-08-20 13:36               ` Kamezawa Hiroyuki
2012-08-20 15:29                 ` Glauber Costa
2012-08-17  2:36       ` Kamezawa Hiroyuki
2012-08-17  7:04         ` Glauber Costa
2012-08-14 11:00     ` Glauber Costa
2012-08-11  5:11   ` Greg Thelen
2012-08-13  8:07     ` Glauber Costa
2012-08-13  9:59     ` Glauber Costa
2012-08-13 21:21       ` Greg Thelen
2012-08-14 17:25   ` Michal Hocko
2012-08-15  9:42     ` Glauber Costa
2012-08-15 10:44       ` Glauber Costa
2012-08-15 13:09       ` Michal Hocko
2012-08-15 14:01         ` Glauber Costa
2012-08-15 14:23           ` Michal Hocko
2012-08-15 14:27             ` Glauber Costa
2012-08-16  9:53               ` Michal Hocko
2012-08-16  9:57                 ` Glauber Costa
2012-08-16 15:05                   ` Michal Hocko
2012-08-16 15:22                     ` Glauber Costa
2012-08-21 21:50   ` Greg Thelen
2012-08-22  8:35     ` Glauber Costa
2012-08-23  0:07       ` Greg Thelen
2012-08-23  7:51         ` Glauber Costa
2012-08-09 13:01 ` [PATCH v2 07/11] mm: Allocate kernel pages to the right memcg Glauber Costa
2012-08-09 16:33   ` Greg Thelen
2012-08-09 16:42     ` Glauber Costa
2012-08-10 17:33   ` Kamezawa Hiroyuki
2012-08-13  8:03     ` Glauber Costa
2012-08-13  8:57       ` Mel Gorman
2012-08-10 17:36   ` Greg Thelen
2012-08-13  8:02     ` Glauber Costa
2012-08-14 15:16   ` Mel Gorman
2012-08-15  9:08     ` Glauber Costa
2012-08-15 13:22       ` Mel Gorman
2012-08-15 13:39         ` Glauber Costa [this message]
2012-08-15 13:51         ` Glauber Costa
2012-08-15  9:24   ` Michal Hocko
2012-08-09 13:01 ` [PATCH v2 08/11] memcg: disable kmem code when not in use Glauber Costa
2012-08-17  7:02   ` Michal Hocko
2012-08-17  7:01     ` Glauber Costa
2012-08-17  8:04       ` Michal Hocko
2012-08-09 13:01 ` [PATCH v2 09/11] memcg: propagate kmem limiting information to children Glauber Costa
2012-08-10 17:51   ` Kamezawa Hiroyuki
2012-08-13  8:01     ` Glauber Costa
2012-08-17  9:00   ` Michal Hocko
2012-08-17  9:15     ` Glauber Costa
2012-08-17  9:35       ` Michal Hocko
2012-08-17 10:07         ` Glauber Costa
2012-08-17 10:35           ` Michal Hocko
2012-08-17 10:36             ` Glauber Costa
2012-08-21  7:54               ` Michal Hocko
2012-08-21  8:35                 ` Michal Hocko
2012-08-21  9:17                   ` Glauber Costa
2012-08-21  9:22                 ` Glauber Costa
2012-08-21 10:00                   ` Michal Hocko
2012-08-21 10:01                     ` Glauber Costa
2012-08-22  1:09                     ` Greg Thelen
2012-08-22  8:22                       ` Glauber Costa
2012-08-22 23:23                         ` Greg Thelen
2012-08-23  7:55                           ` Glauber Costa
2012-08-24  5:06                             ` Greg Thelen
2012-08-24  5:23                               ` Glauber Costa
2012-08-17 10:39             ` Glauber Costa
2012-08-09 13:01 ` [PATCH v2 10/11] memcg: allow a memcg with kmem charges to be destructed Glauber Costa
2012-08-21  8:22   ` Michal Hocko
2012-08-22  8:36     ` Glauber Costa
2012-08-09 13:01 ` [PATCH v2 11/11] protect architectures where THREAD_SIZE >= PAGE_SIZE against fork bombs Glauber Costa
2012-08-10 17:54   ` Kamezawa Hiroyuki
2012-08-21  9:35   ` Michal Hocko
2012-08-21  9:40     ` Glauber Costa
2012-08-21 10:57       ` Michal Hocko
2012-08-17 21:37 ` [PATCH v2 00/11] Request for Inclusion: kmem controller for memcg Ying Han
2012-08-20  7:51   ` Glauber Costa

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=502BA6AE.9000209@parallels.com \
    --to=glommer@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=cl@linux.com \
    --cc=devel@openvz.org \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=penberg@cs.helsinki.fi \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=suleiman@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).