aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMichal Hocko2017-05-08 17:57:12 -0500
committerLinus Torvalds2017-05-08 19:15:12 -0500
commit1f5307b1e094bfffa83c65c40ac6e3415c108780 (patch)
treea0a06a2b555ecdddaac7e8ac540310b7dbd3f49e /mm
parenta7c3e901a46ff54c016d040847eda598a9e3e653 (diff)
downloadkernel-1f5307b1e094bfffa83c65c40ac6e3415c108780.tar.gz
kernel-1f5307b1e094bfffa83c65c40ac6e3415c108780.tar.xz
kernel-1f5307b1e094bfffa83c65c40ac6e3415c108780.zip
mm, vmalloc: properly track vmalloc users
__vmalloc_node_flags used to be static inline but this has changed by "mm: introduce kv[mz]alloc helpers" because kvmalloc_node needs to use it as well and the code is outside of the vmalloc proper. I haven't realized that changing this will lead to a subtle bug though. The function is responsible to track the caller as well. This caller is then printed by /proc/vmallocinfo. If __vmalloc_node_flags is not inline then we would get only direct users of __vmalloc_node_flags as callers (e.g. v[mz]alloc) which reduces usefulness of this debugging feature considerably. It simply doesn't help to see that the given range belongs to vmalloc as a caller: 0xffffc90002c79000-0xffffc90002c7d000 16384 vmalloc+0x16/0x18 pages=3 vmalloc N0=3 0xffffc90002c81000-0xffffc90002c85000 16384 vmalloc+0x16/0x18 pages=3 vmalloc N1=3 0xffffc90002c8d000-0xffffc90002c91000 16384 vmalloc+0x16/0x18 pages=3 vmalloc N1=3 0xffffc90002c95000-0xffffc90002c99000 16384 vmalloc+0x16/0x18 pages=3 vmalloc N1=3 We really want to catch the _caller_ of the vmalloc function. Fix this issue by making __vmalloc_node_flags static inline again. Link: http://lkml.kernel.org/r/20170502134657.12381-1-mhocko@kernel.org Signed-off-by: Michal Hocko <mhocko@suse.com> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmalloc.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 33603239560e..717b1e8b942c 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1649,9 +1649,6 @@ 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{
@@ -1794,7 +1791,7 @@ fail:
1794 * with mm people. 1791 * with mm people.
1795 * 1792 *
1796 */ 1793 */
1797static void *__vmalloc_node(unsigned long size, unsigned long align, 1794void *__vmalloc_node(unsigned long size, unsigned long align,
1798 gfp_t gfp_mask, pgprot_t prot, 1795 gfp_t gfp_mask, pgprot_t prot,
1799 int node, const void *caller) 1796 int node, const void *caller)
1800{ 1797{
@@ -1809,13 +1806,6 @@ void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
1809} 1806}
1810EXPORT_SYMBOL(__vmalloc); 1807EXPORT_SYMBOL(__vmalloc);
1811 1808
1812void *__vmalloc_node_flags(unsigned long size,
1813 int node, gfp_t flags)
1814{
1815 return __vmalloc_node(size, 1, flags, PAGE_KERNEL,
1816 node, __builtin_return_address(0));
1817}
1818
1819/** 1809/**
1820 * vmalloc - allocate virtually contiguous memory 1810 * vmalloc - allocate virtually contiguous memory
1821 * @size: allocation size 1811 * @size: allocation size