Re: [PATCH 1/3] mm: compaction: reset cached scanner pfn's before reading them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2014-06-09 at 06:30 -0700, Greg KH wrote:
> On Mon, Jun 09, 2014 at 11:39:15AM +0200, Vlastimil Babka wrote:
> > commit d3132e4b83e6bd383c74d716f7281d7c3136089c upstream.
> > 
> > Compaction caches pfn's for its migrate and free scanners to avoid
> > scanning the whole zone each time.  In compact_zone(), the cached values
> > are read to set up initial values for the scanners.  There are several
> > situations when these cached pfn's are reset to the first and last pfn
> > of the zone, respectively.  One of these situations is when a compaction
> > has been deferred for a zone and is now being restarted during a direct
> > compaction, which is also done in compact_zone().
> > 
> > However, compact_zone() currently reads the cached pfn's *before*
> > resetting them.  This means the reset doesn't affect the compaction that
> > performs it, and with good chance also subsequent compactions, as
> > update_pageblock_skip() is likely to be called and update the cached
> > pfn's to those being processed.  Another chance for a successful reset
> > is when a direct compaction detects that migration and free scanners
> > meet (which has its own problems addressed by another patch) and sets
> > update_pageblock_skip flag which kswapd uses to do the reset because it
> > goes to sleep.
> > 
> > This is clearly a bug that results in non-deterministic behavior, so
> > this patch moves the cached pfn reset to be performed *before* the
> > values are read.
> > 
> > Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
> > Acked-by: Mel Gorman <mgorman@xxxxxxx>
> > Acked-by: Rik van Riel <riel@xxxxxxxxxx>
> > Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
> > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> > ---
> > I have realized that this should have been CC'd stable as well. It fixes a bug
> > that makes compaction nondeterministic and broken.
> 
> 
> <formletter>
> 
> This is not the correct way to submit patches for inclusion in the
> stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
> for how to do this properly.
> 
> </formletter>

These 3 patches all have an upstream commit reference at the top, so
they looked valid to me.

Ben.

-- 
Ben Hutchings
One of the nice things about standards is that there are so many of them.

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]