lkml.org 
[lkml]   [2018]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] mm, page_alloc: Fix has_unmovable_pages for HugePages
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

\
 
 \ /
  Last update: 2018-12-20 16:52    [W:0.072 / U:3.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site