lkml.org 
[lkml]   [2019]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 09/22] mm, compaction: Use free lists to quickly locate a migration source
On Thu, Jan 31, 2019 at 02:55:01PM +0100, Vlastimil Babka wrote:
> > +
> > + /*
> > + * Avoid if skipped recently. Ideally it would
> > + * move to the tail but even safe iteration of
> > + * the list assumes an entry is deleted, not
> > + * reordered.
> > + */
> > + if (get_pageblock_skip(freepage)) {
> > + if (list_is_last(freelist, &freepage->lru))
> > + break;
> > +
> > + continue;
> > + }
> > +
> > + /* Reorder to so a future search skips recent pages */
> > + move_freelist_tail(freelist, freepage);
> > +
> > + pfn = pageblock_start_pfn(free_pfn);
> > + cc->fast_search_fail = 0;
> > + set_pageblock_skip(freepage);
> > + break;
> > + }
> > +
> > + if (nr_scanned >= limit) {
> > + cc->fast_search_fail++;
> > + move_freelist_tail(freelist, freepage);
> > + break;
> > + }
> > + }
> > + spin_unlock_irqrestore(&cc->zone->lock, flags);
> > + }
> > +
> > + cc->total_migrate_scanned += nr_scanned;
> > +
> > + /*
> > + * If fast scanning failed then use a cached entry for a page block
> > + * that had free pages as the basis for starting a linear scan.
> > + */
> > + if (pfn == cc->migrate_pfn)
> > + reinit_migrate_pfn(cc);
>
> This will set cc->migrate_pfn to the lowest pfn encountered, yet return
> pfn initialized by original cc->migrate_pfn.
> AFAICS isolate_migratepages() will use the returned pfn for the linear
> scan and then overwrite cc->migrate_pfn with wherever it advanced from
> there. So whatever we stored here into cc->migrate_pfn will never get
> actually used, except when isolate_migratepages() returns with
> ISOLATED_ABORT.
> So maybe the infinite kcompactd loop is linked to ISOLATED_ABORT?
>

I'm not entirely sure it would fix the infinite loop. I suspect that is
going to be a boundary conditions where the two scanners are close but
do not meet if it still exists after the batch of fixes. However, you're
right that this code is problematic. I'll write a fix, test it and post
it if it's ok.

Well spotted!

--
Mel Gorman
SUSE Labs

\
 
 \ /
  Last update: 2019-02-01 16:06    [W:0.082 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site