aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 0b057628a7ba..1dda6d8a200a 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1579,7 +1579,7 @@ void vfree_atomic(const void *addr)
1579 * have CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG, but making the calling 1579 * have CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG, but making the calling
1580 * conventions for vfree() arch-depenedent would be a really bad idea) 1580 * conventions for vfree() arch-depenedent would be a really bad idea)
1581 * 1581 *
1582 * NOTE: assumes that the object at *addr has a size >= sizeof(llist_node) 1582 * NOTE: assumes that the object at @addr has a size >= sizeof(llist_node)
1583 */ 1583 */
1584void vfree(const void *addr) 1584void vfree(const void *addr)
1585{ 1585{
@@ -1649,16 +1649,13 @@ void *vmap(struct page **pages, unsigned int count,
1649} 1649}
1650EXPORT_SYMBOL(vmap); 1650EXPORT_SYMBOL(vmap);
1651 1651
1652static void *__vmalloc_node(unsigned long size, unsigned long align,
1653 gfp_t gfp_mask, pgprot_t prot,
1654 int node, const void *caller);
1655static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, 1652static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
1656 pgprot_t prot, int node) 1653 pgprot_t prot, int node)
1657{ 1654{
1658 struct page **pages; 1655 struct page **pages;
1659 unsigned int nr_pages, array_size, i; 1656 unsigned int nr_pages, array_size, i;
1660 const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO; 1657 const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO;
1661 const gfp_t alloc_mask = gfp_mask | __GFP_NOWARN; 1658 const gfp_t alloc_mask = gfp_mask | __GFP_HIGHMEM | __GFP_NOWARN;
1662 1659
1663 nr_pages = get_vm_area_size(area) >> PAGE_SHIFT; 1660 nr_pages = get_vm_area_size(area) >> PAGE_SHIFT;
1664 array_size = (nr_pages * sizeof(struct page *)); 1661 array_size = (nr_pages * sizeof(struct page *));
@@ -1786,8 +1783,15 @@ fail:
1786 * Allocate enough pages to cover @size from the page level 1783 * Allocate enough pages to cover @size from the page level
1787 * allocator with @gfp_mask flags. Map them into contiguous 1784 * allocator with @gfp_mask flags. Map them into contiguous
1788 * kernel virtual space, using a pagetable protection of @prot. 1785 * kernel virtual space, using a pagetable protection of @prot.
1786 *
1787 * Reclaim modifiers in @gfp_mask - __GFP_NORETRY, __GFP_REPEAT
1788 * and __GFP_NOFAIL are not supported
1789 *
1790 * Any use of gfp flags outside of GFP_KERNEL should be consulted
1791 * with mm people.
1792 *
1789 */ 1793 */
1790static void *__vmalloc_node(unsigned long size, unsigned long align, 1794void *__vmalloc_node(unsigned long size, unsigned long align,
1791 gfp_t gfp_mask, pgprot_t prot, 1795 gfp_t gfp_mask, pgprot_t prot,
1792 int node, const void *caller) 1796 int node, const void *caller)
1793{ 1797{
@@ -1802,13 +1806,6 @@ void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
1802} 1806}
1803EXPORT_SYMBOL(__vmalloc); 1807EXPORT_SYMBOL(__vmalloc);
1804 1808
1805static inline void *__vmalloc_node_flags(unsigned long size,
1806 int node, gfp_t flags)
1807{
1808 return __vmalloc_node(size, 1, flags, PAGE_KERNEL,
1809 node, __builtin_return_address(0));
1810}
1811
1812/** 1809/**
1813 * vmalloc - allocate virtually contiguous memory 1810 * vmalloc - allocate virtually contiguous memory
1814 * @size: allocation size 1811 * @size: allocation size
@@ -1821,7 +1818,7 @@ static inline void *__vmalloc_node_flags(unsigned long size,
1821void *vmalloc(unsigned long size) 1818void *vmalloc(unsigned long size)
1822{ 1819{
1823 return __vmalloc_node_flags(size, NUMA_NO_NODE, 1820 return __vmalloc_node_flags(size, NUMA_NO_NODE,
1824 GFP_KERNEL | __GFP_HIGHMEM); 1821 GFP_KERNEL);
1825} 1822}
1826EXPORT_SYMBOL(vmalloc); 1823EXPORT_SYMBOL(vmalloc);
1827 1824
@@ -1838,7 +1835,7 @@ EXPORT_SYMBOL(vmalloc);
1838void *vzalloc(unsigned long size) 1835void *vzalloc(unsigned long size)
1839{ 1836{
1840 return __vmalloc_node_flags(size, NUMA_NO_NODE, 1837 return __vmalloc_node_flags(size, NUMA_NO_NODE,
1841 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); 1838 GFP_KERNEL | __GFP_ZERO);
1842} 1839}
1843EXPORT_SYMBOL(vzalloc); 1840EXPORT_SYMBOL(vzalloc);
1844 1841
@@ -1855,7 +1852,7 @@ void *vmalloc_user(unsigned long size)
1855 void *ret; 1852 void *ret;
1856 1853
1857 ret = __vmalloc_node(size, SHMLBA, 1854 ret = __vmalloc_node(size, SHMLBA,
1858 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, 1855 GFP_KERNEL | __GFP_ZERO,
1859 PAGE_KERNEL, NUMA_NO_NODE, 1856 PAGE_KERNEL, NUMA_NO_NODE,
1860 __builtin_return_address(0)); 1857 __builtin_return_address(0));
1861 if (ret) { 1858 if (ret) {
@@ -1879,7 +1876,7 @@ EXPORT_SYMBOL(vmalloc_user);
1879 */ 1876 */
1880void *vmalloc_node(unsigned long size, int node) 1877void *vmalloc_node(unsigned long size, int node)
1881{ 1878{
1882 return __vmalloc_node(size, 1, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL, 1879 return __vmalloc_node(size, 1, GFP_KERNEL, PAGE_KERNEL,
1883 node, __builtin_return_address(0)); 1880 node, __builtin_return_address(0));
1884} 1881}
1885EXPORT_SYMBOL(vmalloc_node); 1882EXPORT_SYMBOL(vmalloc_node);
@@ -1899,7 +1896,7 @@ EXPORT_SYMBOL(vmalloc_node);
1899void *vzalloc_node(unsigned long size, int node) 1896void *vzalloc_node(unsigned long size, int node)
1900{ 1897{
1901 return __vmalloc_node_flags(size, node, 1898 return __vmalloc_node_flags(size, node,
1902 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); 1899 GFP_KERNEL | __GFP_ZERO);
1903} 1900}
1904EXPORT_SYMBOL(vzalloc_node); 1901EXPORT_SYMBOL(vzalloc_node);
1905 1902
@@ -1921,7 +1918,7 @@ EXPORT_SYMBOL(vzalloc_node);
1921 1918
1922void *vmalloc_exec(unsigned long size) 1919void *vmalloc_exec(unsigned long size)
1923{ 1920{
1924 return __vmalloc_node(size, 1, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC, 1921 return __vmalloc_node(size, 1, GFP_KERNEL, PAGE_KERNEL_EXEC,
1925 NUMA_NO_NODE, __builtin_return_address(0)); 1922 NUMA_NO_NODE, __builtin_return_address(0));
1926} 1923}
1927 1924