lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51C18051.8070404@asianux.com>
Date:	Wed, 19 Jun 2013 17:56:33 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	Mel Gorman <mgorman@...e.de>
CC:	hannes@...xchg.org, riel@...hat.com, mhocko@...e.cz,
	Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm/vmscan.c: 'lru' may be used without initialized after
 the patch "3abf380..." in next-20130607 tree

On 06/19/2013 04:53 PM, Mel Gorman wrote:
> On Wed, Jun 19, 2013 at 02:55:13PM +0800, Chen Gang wrote:
>> > 
>> > 'lru' may be used without initialized, so need regressing part of the
>> > related patch.
>> > 
>> > The related patch:
>> >   "3abf380 mm: remove lru parameter from __lru_cache_add and lru_cache_add_lru"
>> > 
>> > 
>> > Signed-off-by: Chen Gang <gang.chen@...anux.com>
>> > ---
>> >  mm/vmscan.c |    1 +
>> >  1 files changed, 1 insertions(+), 0 deletions(-)
>> > 
>> > diff --git a/mm/vmscan.c b/mm/vmscan.c
>> > index fe73724..e92b1858 100644
>> > --- a/mm/vmscan.c
>> > +++ b/mm/vmscan.c
>> > @@ -595,6 +595,7 @@ redo:
>> >  		 * unevictable page on [in]active list.
>> >  		 * We know how to handle that.
>> >  		 */
>> > +		lru = !!TestClearPageActive(page) + page_lru_base_type(page);
>> >  		lru_cache_add(page);
> Thanks for catching this but I have one question. Why are you clearing
> the active bit?
> 

Oh, it is my fault, I only want to regress part of the original patch,
did not notice clearing the active bit.


> Before 3abf380 we did
> 
> active = TestClearPageActive(page);
> lru = active + page_lru_base_type(page);
> lru_cache_add_lru(page, lru);
> 
> so if the page was active before then it gets added to the active list. When
> 3abf380 is applied. it becomes.
> 
> Leave PageActive alone
> lru_cache_add(page);
> .... until __pagevec_lru_add -> __pagevec_lru_add_fn
> int file = page_is_file_cache(page);
> int active = PageActive(page);
> enum lru_list lru = page_lru(page);
> 
> After your patch it's
> 
> Clear PageActive
> lru_cache_add(page)
> ......
> always add to inactive list
> 
> I do not think you intended to do this and if you did, it deserves far
> more comment than being a compile warning fix. In putback_lru_page we only
> care about whether the lru was unevictable or not. Hence I think what you
> meant to do was simply
> 
> 	lru = page_lru_base_type(page);
> 
> If you agree then can you resend a revised version to Andrew please?

Yes, I should do, but excuse me, I do not quite know about 'revised
version'.

I guess it means I need still send the related patch which base on the
original one, e.g. for next-20130618:

------------------------diff begin-------------------------------------

diff --git a/mm/vmscan.c b/mm/vmscan.c
index fe73724..d03facb 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -595,6 +595,7 @@ redo:
 		 * unevictable page on [in]active list.
 		 * We know how to handle that.
 		 */
+		lru = page_lru_base_type(page);
 		lru_cache_add(page);
 	} else {
 		/*

------------------------diff end---------------------------------------

Is it correct ?


Thanks.
-- 
Chen Gang

Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ