@@ -1583,6 +1583,13 @@ void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
1583
1583
}
1584
1584
EXPORT_SYMBOL (__vmalloc );
1585
1585
1586
+ static inline void * __vmalloc_node_flags (unsigned long size ,
1587
+ int node , gfp_t flags )
1588
+ {
1589
+ return __vmalloc_node (size , 1 , flags , PAGE_KERNEL ,
1590
+ node , __builtin_return_address (0 ));
1591
+ }
1592
+
1586
1593
/**
1587
1594
* vmalloc - allocate virtually contiguous memory
1588
1595
* @size: allocation size
@@ -1594,11 +1601,27 @@ EXPORT_SYMBOL(__vmalloc);
1594
1601
*/
1595
1602
void * vmalloc (unsigned long size )
1596
1603
{
1597
- return __vmalloc_node (size , 1 , GFP_KERNEL | __GFP_HIGHMEM , PAGE_KERNEL ,
1598
- -1 , __builtin_return_address (0 ));
1604
+ return __vmalloc_node_flags (size , -1 , GFP_KERNEL | __GFP_HIGHMEM );
1599
1605
}
1600
1606
EXPORT_SYMBOL (vmalloc );
1601
1607
1608
+ /**
1609
+ * vzalloc - allocate virtually contiguous memory with zero fill
1610
+ * @size: allocation size
1611
+ * Allocate enough pages to cover @size from the page level
1612
+ * allocator and map them into contiguous kernel virtual space.
1613
+ * The memory allocated is set to zero.
1614
+ *
1615
+ * For tight control over page level allocator and protection flags
1616
+ * use __vmalloc() instead.
1617
+ */
1618
+ void * vzalloc (unsigned long size )
1619
+ {
1620
+ return __vmalloc_node_flags (size , -1 ,
1621
+ GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO );
1622
+ }
1623
+ EXPORT_SYMBOL (vzalloc );
1624
+
1602
1625
/**
1603
1626
* vmalloc_user - allocate zeroed virtually contiguous memory for userspace
1604
1627
* @size: allocation size
@@ -1640,6 +1663,25 @@ void *vmalloc_node(unsigned long size, int node)
1640
1663
}
1641
1664
EXPORT_SYMBOL (vmalloc_node );
1642
1665
1666
+ /**
1667
+ * vzalloc_node - allocate memory on a specific node with zero fill
1668
+ * @size: allocation size
1669
+ * @node: numa node
1670
+ *
1671
+ * Allocate enough pages to cover @size from the page level
1672
+ * allocator and map them into contiguous kernel virtual space.
1673
+ * The memory allocated is set to zero.
1674
+ *
1675
+ * For tight control over page level allocator and protection flags
1676
+ * use __vmalloc_node() instead.
1677
+ */
1678
+ void * vzalloc_node (unsigned long size , int node )
1679
+ {
1680
+ return __vmalloc_node_flags (size , node ,
1681
+ GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO );
1682
+ }
1683
+ EXPORT_SYMBOL (vzalloc_node );
1684
+
1643
1685
#ifndef PAGE_KERNEL_EXEC
1644
1686
# define PAGE_KERNEL_EXEC PAGE_KERNEL
1645
1687
#endif
0 commit comments