Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-31 Thread Johannes Weiner
On Thu, Oct 30, 2014 at 06:42:41PM +0100, Michal Hocko wrote: > On Thu 30-10-14 13:26:32, Johannes Weiner wrote: > > On Thu, Oct 30, 2014 at 04:31:59PM +0100, Michal Hocko wrote: > > > I have discussed that with our gcc guys and you are right. Strictly > > > speaking the compiler is free to do > >

Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-30 Thread Peter Zijlstra
On Thu, Oct 30, 2014 at 06:42:41PM +0100, Michal Hocko wrote: > Well, I would use a typedef to obfuscate those values because nobody > except for mem_cgroup_{begin,end}_page_stat should touch them. But we > are not doing typedefs in kernel... $ git grep typedef | wc -l 11379 -- To unsubscribe from

Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-30 Thread Michal Hocko
On Thu 30-10-14 13:26:32, Johannes Weiner wrote: > On Thu, Oct 30, 2014 at 04:31:59PM +0100, Michal Hocko wrote: > > On Thu 30-10-14 10:24:47, Sasha Levin wrote: > > > On 10/30/2014 10:14 AM, Johannes Weiner wrote: > > > >> The problem is that you are attempting to read 'locked' when you call > > >

Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-30 Thread Johannes Weiner
On Thu, Oct 30, 2014 at 04:31:59PM +0100, Michal Hocko wrote: > On Thu 30-10-14 10:24:47, Sasha Levin wrote: > > On 10/30/2014 10:14 AM, Johannes Weiner wrote: > > >> The problem is that you are attempting to read 'locked' when you call > > >> > mem_cgroup_end_page_stat(), so it gets used even befo

Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-30 Thread Sasha Levin
On 10/30/2014 11:06 AM, Johannes Weiner wrote: >> You're using that value as soon as you are passing it to a function, it >> > doesn't matter what happens inside that function. > It's copied as part of the pass-by-value protocol, but we really don't > do anything with it. So why does it matter? B

Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-30 Thread Michal Hocko
On Thu 30-10-14 10:24:47, Sasha Levin wrote: > On 10/30/2014 10:14 AM, Johannes Weiner wrote: > >> The problem is that you are attempting to read 'locked' when you call > >> > mem_cgroup_end_page_stat(), so it gets used even before you enter the > >> > function - and using uninitialized variables i

Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-30 Thread Johannes Weiner
On Thu, Oct 30, 2014 at 10:24:47AM -0400, Sasha Levin wrote: > On 10/30/2014 10:14 AM, Johannes Weiner wrote: > >> The problem is that you are attempting to read 'locked' when you call > >> > mem_cgroup_end_page_stat(), so it gets used even before you enter the > >> > function - and using uninitial

Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-30 Thread Sasha Levin
On 10/30/2014 10:14 AM, Johannes Weiner wrote: >> The problem is that you are attempting to read 'locked' when you call >> > mem_cgroup_end_page_stat(), so it gets used even before you enter the >> > function - and using uninitialized variables is undefined. > We are not using that value anywhere i

Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-30 Thread Johannes Weiner
On Thu, Oct 30, 2014 at 09:32:14AM -0400, Sasha Levin wrote: > On 10/30/2014 04:27 AM, Michal Hocko wrote: > > On Wed 29-10-14 21:44:24, Sasha Levin wrote: > >> > Commit "mm: memcontrol: fix missed end-writeback page accounting" has > >> > changed > >> > the behaviour of mem_cgroup_begin_page_stat

Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-30 Thread Sasha Levin
On 10/30/2014 04:27 AM, Michal Hocko wrote: > On Wed 29-10-14 21:44:24, Sasha Levin wrote: >> > 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 s

Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-30 Thread Michal Hocko
On Wed 29-10-14 21:44:24, Sasha Levin wrote: > 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 > l

[PATCH] mm: initialize variable for mem_cgroup_end_page_stat

2014-10-29 Thread Sasha Levin
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: