# Re: \[PATCH v2\] mm/compactoin: Fix misbehaviors of fast\_find\_migrateblock()

- From: Vlastimil Babka \<hidden\>
- Date: 2021-01-28 14:40:38 
- List: linux-mm
- Page: https://ratatoskr.run/linux-mm/2021/01/6505932
- Thread: https://ratatoskr.run/linux-mm/2021/01/6505925/t.md

```text
On 1/28/21 3:31 PM, Wonhyuk Yang wrote:
> On Thu, Jan 28, 2021 at 11:23 PM Mel Gorman [ref] wrote:
>>
>> On Thu, Jan 28, 2021 at 03:01:27PM +0100, Vlastimil Babka wrote:
>> > On 1/28/21 2:50 PM, Wonhyuk Yang wrote:
>> > > On Thu, Jan 28, 2021 at 10:25 PM Mel Gorman [ref] wrote:
>> > >>
>> > >> As nr_scanned is post-incremented, this will still consider if the page
>> > >> should be used when the limit is reached. ++nr_scanned?
>> > >
>> > > Hi,
>> > >
>> > > Let's consider that limit is 4, nr_scanned is 0 and loop until reach the limit.
>> > > 1) pre-increment: it will search three times.(0,1,2)
>> > > 2) post-increment: it will search four times. (0,1,2,3)
>> > >
>> > > So you mean that searching three times is correct?
>> >
>> > 1) will match the outer loop's "nr_scanned < limit;" condition. It doesn't
>> > matter that much in practice, but for consistency sake, it should be 1)

Got confused there, it's 2) that matches the outer loop condition, so your patch
is fine.

>> Ok, while I find it a little strange to enter the loop and then break
>> immediately due to the limit, it's a marginal difference and in general,
>> the patch makes sense.
>>
> 
> Then, should I change post-increment to pre-increment?

IMHO, nope.

> If so, should I send a new version? It seems like it's too tiny change...





```
