From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Balbir Singh <balbir@in.ibm.com>, Li Zefan <lizf@cn.fujitsu.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] memcg: further checking of disabled flag
Date: Sun, 29 Jun 2008 01:17:17 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0806290115440.20280@blonde.site> (raw)
In-Reply-To: <Pine.LNX.4.64.0806290108110.20280@blonde.site>
Further adjustments to the mem_cgroup_subsys.disabled tests: add one to
mem_cgroup_shrink_usage; move mem_cgroup_charge_common's into its callers,
before they've done any work; and add one to mem_cgroup_move_lists, to
avoid the overhead of its bit spin locking and unlocking.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
---
Should follow mmotm's memcg-clean-up-checking-of-the-disabled-flag.patch
mm/memcontrol.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
--- mmotm/mm/memcontrol.c 2008-06-27 13:39:20.000000000 +0100
+++ linux/mm/memcontrol.c 2008-06-27 17:32:29.000000000 +0100
@@ -354,6 +354,9 @@ void mem_cgroup_move_lists(struct page *
struct mem_cgroup_per_zone *mz;
unsigned long flags;
+ if (mem_cgroup_subsys.disabled)
+ return;
+
/*
* We cannot lock_page_cgroup while holding zone's lru_lock,
* because other holders of lock_page_cgroup can be interrupted
@@ -533,9 +536,6 @@ static int mem_cgroup_charge_common(stru
unsigned long nr_retries = MEM_CGROUP_RECLAIM_RETRIES;
struct mem_cgroup_per_zone *mz;
- if (mem_cgroup_subsys.disabled)
- return 0;
-
pc = kmem_cache_alloc(page_cgroup_cache, gfp_mask);
if (unlikely(pc == NULL))
goto err;
@@ -620,6 +620,9 @@ err:
int mem_cgroup_charge(struct page *page, struct mm_struct *mm, gfp_t gfp_mask)
{
+ if (mem_cgroup_subsys.disabled)
+ return 0;
+
/*
* If already mapped, we don't have to account.
* If page cache, page->mapping has address_space.
@@ -638,6 +641,9 @@ int mem_cgroup_charge(struct page *page,
int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
gfp_t gfp_mask)
{
+ if (mem_cgroup_subsys.disabled)
+ return 0;
+
/*
* Corner case handling. This is called from add_to_page_cache()
* in usual. But some FS (shmem) precharges this page before calling it
@@ -789,6 +795,9 @@ int mem_cgroup_shrink_usage(struct mm_st
int progress = 0;
int retry = MEM_CGROUP_RECLAIM_RETRIES;
+ if (mem_cgroup_subsys.disabled)
+ return 0;
+
rcu_read_lock();
mem = mem_cgroup_from_task(rcu_dereference(mm->owner));
css_get(&mem->css);
next prev parent reply other threads:[~2008-06-29 0:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-29 0:13 [PATCH] memcg: fix shmem_unuse_inode charging Hugh Dickins
2008-06-29 0:14 ` [PATCH] memcg: shmem_getpage release page sooner Hugh Dickins
2008-06-30 2:28 ` KAMEZAWA Hiroyuki
2008-06-29 0:15 ` [PATCH] memcg: mem_cgroup_shrink_usage css_put Hugh Dickins
2008-06-30 2:27 ` KAMEZAWA Hiroyuki
2008-06-30 6:28 ` Balbir Singh
2008-06-29 0:17 ` Hugh Dickins [this message]
2008-06-30 2:26 ` [PATCH] memcg: further checking of disabled flag KAMEZAWA Hiroyuki
2008-06-30 6:27 ` Balbir Singh
2008-06-30 6:05 ` Li Zefan
2008-06-30 2:23 ` [PATCH] memcg: fix shmem_unuse_inode charging KAMEZAWA Hiroyuki
2008-06-30 6:26 ` Balbir Singh
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=Pine.LNX.4.64.0806290115440.20280@blonde.site \
--to=hugh@veritas.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@in.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.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
all inboxes | Powered by JetHome®