linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, riel@redhat.com, mhocko@suse.cz,
	hannes@cmpxchg.org, peterz@infradead.org, linux-mm@kvack.org,
	Sasha Levin <sasha.levin@oracle.com>
Subject: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat
Date: Wed, 29 Oct 2014 21:44:24 -0400	[thread overview]
Message-ID: <1414633464-19419-1-git-send-email-sasha.levin@oracle.com> (raw)

Commit "mm: memcontrol: fix missed end-writeback page accounting" has changed
the behaviour of mem_cgroup_begin_page_stat() to not always set the "locked"
parameter.

We should initialize it at the callers to prevent garbage being used in a
later call to mem_cgroup_end_page_stat().

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 mm/page-writeback.c |    4 ++--
 mm/rmap.c           |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 19ceae8..7a02c97 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2329,7 +2329,7 @@ int test_clear_page_writeback(struct page *page)
 	struct address_space *mapping = page_mapping(page);
 	unsigned long memcg_flags;
 	struct mem_cgroup *memcg;
-	bool locked;
+	bool locked = false;
 	int ret;
 
 	memcg = mem_cgroup_begin_page_stat(page, &locked, &memcg_flags);
@@ -2366,7 +2366,7 @@ int __test_set_page_writeback(struct page *page, bool keep_write)
 	struct address_space *mapping = page_mapping(page);
 	unsigned long memcg_flags;
 	struct mem_cgroup *memcg;
-	bool locked;
+	bool locked = false;
 	int ret;
 
 	memcg = mem_cgroup_begin_page_stat(page, &locked, &memcg_flags);
diff --git a/mm/rmap.c b/mm/rmap.c
index 19886fb..4a4dc84 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1044,7 +1044,7 @@ void page_add_file_rmap(struct page *page)
 {
 	struct mem_cgroup *memcg;
 	unsigned long flags;
-	bool locked;
+	bool locked = false;
 
 	memcg = mem_cgroup_begin_page_stat(page, &locked, &flags);
 	if (atomic_inc_and_test(&page->_mapcount)) {
@@ -1058,7 +1058,7 @@ static void page_remove_file_rmap(struct page *page)
 {
 	struct mem_cgroup *memcg;
 	unsigned long flags;
-	bool locked;
+	bool locked = false;
 
 	memcg = mem_cgroup_begin_page_stat(page, &locked, &flags);
 
-- 
1.7.10.4

--
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:[~2014-10-30  1:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30  1:44 Sasha Levin [this message]
2014-10-30  8:27 ` [PATCH] mm: initialize variable for mem_cgroup_end_page_stat Michal Hocko
2014-10-30 13:32   ` Sasha Levin
2014-10-30 14:14     ` Johannes Weiner
2014-10-30 14:24       ` Sasha Levin
2014-10-30 15:06         ` Johannes Weiner
2014-10-30 16:02           ` Sasha Levin
2014-10-30 15:31         ` Michal Hocko
2014-10-30 17:26           ` Johannes Weiner
2014-10-30 17:42             ` Michal Hocko
2014-10-30 19:30               ` Peter Zijlstra
2014-10-31 18:17               ` Johannes Weiner

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=1414633464-19419-1-git-send-email-sasha.levin@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.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).