+ revert-mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch added to -mm tree
Subsystems (2)
[email protected]
maintainerSubject: + revert-mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch added to -mm tree
To: [email protected],[email protected],[email protected]
From: [email protected]
Date: Fri, 24 Jan 2014 12:23:55 -0800
The patch titled
Subject: Revert "mm/vmalloc: interchage the implementation of vmalloc_to_{pfn,page}"
has been added to the -mm tree. Its filename is
revert-mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/revert-mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/revert-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: malc <[email protected]>
Subject: Revert "mm/vmalloc: interchage the implementation of vmalloc_to_{pfn,page}"
Revert ece86e222db48d04bda, which was intended as a small performance improvement.
Despite the claim that the patch doesn't introduce any functional changes in fact it does.
The "no page" path behaves different now. Originally, vmalloc_to_page might return NULL under some conditions, with new implementation it returns pfn_to_page(0) which is not the same as NULL.
Simple test shows the difference.
test.c
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
int __init myi(void)
{
struct page *p;
void *v;
v = vmalloc(PAGE_SIZE);
/* trigger the "no page" path in vmalloc_to_page*/
vfree(v);
p = vmalloc_to_page(v);
pr_err("expected val = NULL, returned val = %p", p);
return -EBUSY;
}void __exit mye(void)
{
}module_init(myi)module_exit(mye)
Before interchange:
expected val = NULL, returned val = (null)
After interchange:
expected val = NULL, returned val = c7ebe000
---
mm/vmalloc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
mm/vmalloc.c renamed from mm/vmalloc.c~revert-mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage +10 -10
@@ -220,12 +220,12 @@ int is_vmalloc_or_module_addr(const void }/* -* Walk a vmap address to the physical pfn it maps to. +* Walk a vmap address to the struct page it maps. */ -unsigned long vmalloc_to_pfn (const void *vmalloc_addr) +struct page *vmalloc_to_page (const void *vmalloc_addr) {unsigned long addr = (unsigned long ) vmalloc_addr; -unsigned long pfn =0 ; +struct page *page =NULL ;pgd_t *pgd =pgd_offset_k (addr);/*
@@ -244,23 +244,23 @@ unsigned long vmalloc_to_pfn(const void ptep =pte_offset_map (pmd, addr); pte = *ptep;if (pte_present (pte)) - pfn =pte_pfn (pte); + page =pte_page (pte);pte_unmap (ptep); } } } -return pfn; +return page; } -EXPORT_SYMBOL (vmalloc_to_pfn); +EXPORT_SYMBOL (vmalloc_to_page);/* -* Map a vmalloc()-space virtual address to the struct page. +* Map a vmalloc()-space virtual address to the physical page frame number. */ -struct page *vmalloc_to_page (const void *vmalloc_addr) +unsigned long vmalloc_to_pfn (const void *vmalloc_addr) { -return pfn_to_page (vmalloc_to_pfn (vmalloc_addr)); +return page_to_pfn (vmalloc_to_page (vmalloc_addr)); } -EXPORT_SYMBOL (vmalloc_to_page); +EXPORT_SYMBOL (vmalloc_to_pfn);/*** Global kva allocator ***/
_
Patches currently in -mm which might be from [email protected] are
revert-mm-vmalloc-interchage-the-implementation-of-vmalloc_to_pfnpage.patch arm-move-arm_dma_limit-to-setup_dma_zone.patch