On Thu, Dec 20, 2018 at 03:32:37PM +0000, Wei Yang wrote: > Now let's go back to see how to calculate new_iter. From the chart > above, we can see this formula stands for all three cases: > > new_iter = round_up(iter + 1, page_size(HugePage)) > > So it looks the first version is correct. Let us assume: * iter = 0 (page first of the pageblock) * page is a tail * hugepage is 2mb So we have the following: iter = round_up(iter + 1, 1<<compound_order(head)) - 1; which translates to: iter = round_up(1, 512) - 1 = 511; Then iter will be incremented to 512, and we break the loop. The outcome of this is that ouf ot 512 pages, we only scanned 1, and we skipped all the other 511 pages by mistake. -- Oscar Salvador SUSE L3