Skip to content

Commit

Permalink
mm: remove call to find_vma in pagewalk for non-hugetlbfs
Browse files Browse the repository at this point in the history
Commit d33b9f4 ("mm: hugetlb: fix hugepage memory leak in
walk_page_range()") introduces a check if a vma is a hugetlbfs one and
later in 5dc3764 ("mm hugetlb: add hugepage support to pagemap") it is
moved under #ifdef CONFIG_HUGETLB_PAGE but a needless find_vma call is
left behind and its result is not used anywhere else in the function.

The side-effect of caching vma for @addr inside walk->mm is neither
utilized in walk_page_range() nor in called functions.

Signed-off-by: David Sterba <[email protected]>
Reviewed-by: Naoya Horiguchi <[email protected]>
Acked-by: Andi Kleen <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Lee Schermerhorn <[email protected]>
Cc: Matt Mackall <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Cc: Wu Fengguang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kdave authored and torvalds committed Nov 24, 2010
1 parent e9959f0 commit 5f0af70
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mm/pagewalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ int walk_page_range(unsigned long addr, unsigned long end,
pgd_t *pgd;
unsigned long next;
int err = 0;
struct vm_area_struct *vma;

if (addr >= end)
return err;
Expand All @@ -149,15 +148,17 @@ int walk_page_range(unsigned long addr, unsigned long end,

pgd = pgd_offset(walk->mm, addr);
do {
struct vm_area_struct *uninitialized_var(vma);

next = pgd_addr_end(addr, end);

#ifdef CONFIG_HUGETLB_PAGE
/*
* handle hugetlb vma individually because pagetable walk for
* the hugetlb page is dependent on the architecture and
* we can't handled it in the same manner as non-huge pages.
*/
vma = find_vma(walk->mm, addr);
#ifdef CONFIG_HUGETLB_PAGE
if (vma && is_vm_hugetlb_page(vma)) {
if (vma->vm_end < next)
next = vma->vm_end;
Expand Down

0 comments on commit 5f0af70

Please sign in to comment.