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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 13 Jul 2016 09:40:37 +0100
From:	Mel Gorman <mgorman@...hsingularity.net>
To:	Johannes Weiner <hannes@...xchg.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Linux-MM <linux-mm@...ck.org>, Rik van Riel <riel@...riel.com>,
	Vlastimil Babka <vbabka@...e.cz>,
	Minchan Kim <minchan@...nel.org>,
	Joonsoo Kim <iamjoonsoo.kim@....com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 11/34] mm, vmscan: remove duplicate logic clearing node
 congestion and dirty state

On Tue, Jul 12, 2016 at 10:22:56AM -0400, Johannes Weiner wrote:
> On Fri, Jul 08, 2016 at 10:34:47AM +0100, Mel Gorman wrote:
> > @@ -3008,7 +3008,17 @@ static bool zone_balanced(struct zone *zone, int order, int classzone_idx)
> >  {
> >  	unsigned long mark = high_wmark_pages(zone);
> >  
> > -	return zone_watermark_ok_safe(zone, order, mark, classzone_idx);
> > +	if (!zone_watermark_ok_safe(zone, order, mark, classzone_idx))
> > +		return false;
> > +
> > +	/*
> > +	 * If any eligible zone is balanced then the node is not considered
> > +	 * to be congested or dirty
> > +	 */
> > +	clear_bit(PGDAT_CONGESTED, &zone->zone_pgdat->flags);
> > +	clear_bit(PGDAT_DIRTY, &zone->zone_pgdat->flags);
> 
> Predicate functions that secretly modify internal state give me the
> willies... The diffstat is flat, too. Is this really an improvement?

Primarily, it's about less duplicated code and maintenance overhead.
Overall I was both trying to remove side-effects and make the kswapd flow
easier to follow.

I'm open to renaming suggestions that make it clear the function
has side-effects. Best I came up with after the first coffee is
try_reset_zone_balanced() which returns true with congestion/dirty state
cleared if the zone is balanced. The name is not great because it's also
a little misleading. It doesn't try to reset anything, that's reclaim's job.

-- 
Mel Gorman
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ