On Thu, Jan 31, 2019 at 03:52:10PM +0100, Vlastimil Babka wrote: > > -/* Reorder the free list to reduce repeated future searches */ > > +/* > > + * Used when scanning for a suitable migration target which scans freelists > > + * in reverse. Reorders the list such as the unscanned pages are scanned > > + * first on the next iteration of the free scanner > > + */ > > +static void > > +move_freelist_head(struct list_head *freelist, struct page *freepage) > > +{ > > + LIST_HEAD(sublist); > > + > > + if (!list_is_last(freelist, &freepage->lru)) { > > Shouldn't there be list_is_first() for symmetry? > I don't think it would help. We're reverse traversing the list when this is called. If it's the last entry, it's moving just one page before breaking off the search and a shuffle has minimal impact. If it's the first page then list_cut_before moves the entire list to sublist before splicing it back so it's a pointless operation. -- Mel Gorman SUSE Labs