Skip to content

Commit

Permalink
mm/mlock.c: use page_zone() instead of page_zone_id()
Browse files Browse the repository at this point in the history
page_zone_id() is a specialized function to compare the zone for the pages
that are within the section range.  If the section of the pages are
different, page_zone_id() can be different even if their zone is the same.
This wrong usage doesn't cause any actual problem since
__munlock_pagevec_fill() would be called again with failed index.
However, it's better to use more appropriate function here.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Joonsoo Kim <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Minchan Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoonsooKim authored and torvalds committed Sep 9, 2017
1 parent 6380322 commit 9472f23
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mm/mlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
* @start + PAGE_SIZE when no page could be added by the pte walk.
*/
static unsigned long __munlock_pagevec_fill(struct pagevec *pvec,
struct vm_area_struct *vma, int zoneid, unsigned long start,
unsigned long end)
struct vm_area_struct *vma, struct zone *zone,
unsigned long start, unsigned long end)
{
pte_t *pte;
spinlock_t *ptl;
Expand Down Expand Up @@ -394,7 +394,7 @@ static unsigned long __munlock_pagevec_fill(struct pagevec *pvec,
* Break if page could not be obtained or the page's node+zone does not
* match
*/
if (!page || page_zone_id(page) != zoneid)
if (!page || page_zone(page) != zone)
break;

/*
Expand Down Expand Up @@ -446,7 +446,6 @@ void munlock_vma_pages_range(struct vm_area_struct *vma,
unsigned long page_increm;
struct pagevec pvec;
struct zone *zone;
int zoneid;

pagevec_init(&pvec, 0);
/*
Expand Down Expand Up @@ -481,7 +480,6 @@ void munlock_vma_pages_range(struct vm_area_struct *vma,
*/
pagevec_add(&pvec, page);
zone = page_zone(page);
zoneid = page_zone_id(page);

/*
* Try to fill the rest of pagevec using fast
Expand All @@ -490,7 +488,7 @@ void munlock_vma_pages_range(struct vm_area_struct *vma,
* pagevec.
*/
start = __munlock_pagevec_fill(&pvec, vma,
zoneid, start, end);
zone, start, end);
__munlock_pagevec(&pvec, zone);
goto next;
}
Expand Down

0 comments on commit 9472f23

Please sign in to comment.