lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1290127197-20360-1-git-send-email-dsterba@suse.cz>
Date:	Fri, 19 Nov 2010 01:39:57 +0100
From:	David Sterba <dsterba@...e.cz>
To:	linux-kernel@...r.kernel.org
Cc:	linux-mm@...ck.org, David Sterba <dsterba@...e.cz>,
	Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
	Andi Kleen <ak@...ux.intel.com>,
	Andy Whitcroft <apw@...onical.com>,
	David Rientjes <rientjes@...gle.com>,
	Hugh Dickins <hugh.dickins@...cali.co.uk>,
	Lee Schermerhorn <lee.schermerhorn@...com>,
	Matt Mackall <mpm@...enic.com>, Mel Gorman <mel@....ul.ie>,
	Wu Fengguang <fengguang.wu@...el.com>
Subject: [PATCH] mm: remove call to find_vma in pagewalk for non-hugetlbfs

Commit d33b9f45 introduces a check if a vma is a hugetlbfs one and
later in 5dc37642 is moved under #ifdef CONFIG_HUGETLB_PAGE but
a needless find_vma call is left behind and it's result not used
anywhere else in the function.

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

Signed-off-by: David Sterba <dsterba@...e.cz>
Cc: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Andy Whitcroft <apw@...onical.com>
Cc: David Rientjes <rientjes@...gle.com>
Cc: Hugh Dickins <hugh.dickins@...cali.co.uk>
Cc: Lee Schermerhorn <lee.schermerhorn@...com>
Cc: Matt Mackall <mpm@...enic.com>
Cc: Mel Gorman <mel@....ul.ie>
Cc: Wu Fengguang <fengguang.wu@...el.com>
---
 mm/pagewalk.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/pagewalk.c b/mm/pagewalk.c
index 8b1a2ce..38cc58b 100644
--- a/mm/pagewalk.c
+++ b/mm/pagewalk.c
@@ -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;
@@ -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;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ