Skip to contentSkip to conversation

+ mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Dec 3, 2013

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch added to -mm tree
To: [email protected],[email protected]
From: [email protected]
Date: Mon, 02 Dec 2013 16:01:28 -0800

The patch titled

     Subject: mm/vmalloc: interchage the implementation of vmalloc_to_{pfn,page}

has been added to the -mm tree. Its filename is
mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Jianyu Zhan <[email protected]>
Subject: mm/vmalloc: interchage the implementation of vmalloc_to_{pfn,page}

Currently we are implementing vmalloc_to_pfn() as a wrapper around vmalloc_to_page(), which is implemented as follow:

1. walks the page talbes to generates the corresponding pfn,
2. then converts the pfn to struct page,
3. returns it.

And vmalloc_to_pfn() re-wraps vmalloc_to_page() to get the pfn.

This seems too circuitous, so this patch reverses the way: implement vmalloc_to_page() as a wrapper around vmalloc_to_pfn(). This makes vmalloc_to_pfn() and vmalloc_to_page() slightly more efficient.

No functional change.

---

 mm/vmalloc.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage +10 -10
diff -puN mm/vmalloc.c~mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage mm/vmalloc.c
@@ -220,12 +220,12 @@ int is_vmalloc_or_module_addr(const void
 }
 
 /*
- * Walk a vmap address to the struct page it maps.
+ * Walk a vmap address to the physical pfn it maps to.
  */
-struct page *vmalloc_to_page(const void *vmalloc_addr)
+unsigned long vmalloc_to_pfn(const void *vmalloc_addr)
 {
 	unsigned long addr = (unsigned long) vmalloc_addr;
-	struct page *page = NULL;
+	unsigned long pfn;
 	pgd_t *pgd = pgd_offset_k(addr);
 
 	/*
@@ -244,23 +244,23 @@ struct page *vmalloc_to_page(const void
 				ptep = pte_offset_map(pmd, addr);
 				pte = *ptep;
 				if (pte_present(pte))
-					page = pte_page(pte);
+					pfn = pte_page(pte);
 				pte_unmap(ptep);
 			}
 		}
 	}
-	return page;
+	return pfn;
 }
-EXPORT_SYMBOL(vmalloc_to_page);
+EXPORT_SYMBOL(vmalloc_to_pfn);
 
 /*
- * Map a vmalloc()-space virtual address to the physical page frame number.
+ * Map a vmalloc()-space virtual address to the struct page.
  */
-unsigned long vmalloc_to_pfn(const void *vmalloc_addr)
+struct page *vmalloc_to_page(const void *vmalloc_addr)
 {
-	return page_to_pfn(vmalloc_to_page(vmalloc_addr));
+	return pfn_to_page(vmalloc_to_pfn(vmalloc_addr));
 }
-EXPORT_SYMBOL(vmalloc_to_pfn);
+EXPORT_SYMBOL(vmalloc_to_page);
 
 
 /*** Global kva allocator ***/

_

Patches currently in -mm which might be from [email protected] are

mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage-fix.patch