Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

headers: untangle kmemleak.h from mm.h

Currently <linux/slab.h> #includes <linux/kmemleak.h> for no obvious
reason. It looks like it's only a convenience, so remove kmemleak.h
from slab.h and add <linux/kmemleak.h> to any users of kmemleak_* that
don't already #include it. Also remove <linux/kmemleak.h> from source
files that do not use it.

This is tested on i386 allmodconfig and x86_64 allmodconfig. It would
be good to run it through the 0day bot for other $ARCHes. I have
neither the horsepower nor the storage space for the other $ARCHes.

Update: This patch has been extensively build-tested by both the 0day
bot & kisskb/ozlabs build farms. Both of them reported 2 build failures
for which patches are included here (in v2).

[ slab.h is the second most used header file after module.h; kernel.h is
right there with slab.h. There could be some minor error in the
counting due to some #includes having comments after them and I didn't
combine all of those. ]

[akpm@linux-foundation.org: security/keys/big_key.c needs vmalloc.h, per sfr]
Link: http://lkml.kernel.org/r/e4309f98-3749-93e1-4bb7-d9501a39d015@infradead.org
Link: http://kisskb.ellerman.id.au/kisskb/head/13396/
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Reported-by: Michael Ellerman <mpe@ellerman.id.au> [2 build failures]
Reported-by: Fengguang Wu <fengguang.wu@intel.com> [2 build failures]
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Wei Yongjun <weiyongjun1@huawei.com>
Cc: Luis R. Rodriguez <mcgrof@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: John Johansen <john.johansen@canonical.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Randy Dunlap and committed by
Linus Torvalds
514c6032 91241681

+11 -14
+1
arch/powerpc/sysdev/dart_iommu.c
··· 38 38 #include <linux/suspend.h> 39 39 #include <linux/memblock.h> 40 40 #include <linux/gfp.h> 41 + #include <linux/kmemleak.h> 41 42 #include <asm/io.h> 42 43 #include <asm/prom.h> 43 44 #include <asm/iommu.h>
+1
arch/powerpc/sysdev/msi_bitmap.c
··· 10 10 11 11 #include <linux/slab.h> 12 12 #include <linux/kernel.h> 13 + #include <linux/kmemleak.h> 13 14 #include <linux/bitmap.h> 14 15 #include <linux/bootmem.h> 15 16 #include <asm/msi_bitmap.h>
+1 -1
arch/s390/kernel/nmi.c
··· 15 15 #include <linux/hardirq.h> 16 16 #include <linux/log2.h> 17 17 #include <linux/kprobes.h> 18 - #include <linux/slab.h> 18 + #include <linux/kmemleak.h> 19 19 #include <linux/time.h> 20 20 #include <linux/module.h> 21 21 #include <linux/sched/signal.h>
-1
arch/s390/kernel/smp.c
··· 27 27 #include <linux/err.h> 28 28 #include <linux/spinlock.h> 29 29 #include <linux/kernel_stat.h> 30 - #include <linux/kmemleak.h> 31 30 #include <linux/delay.h> 32 31 #include <linux/interrupt.h> 33 32 #include <linux/irqflags.h>
-1
arch/sparc/kernel/irq_64.c
··· 22 22 #include <linux/seq_file.h> 23 23 #include <linux/ftrace.h> 24 24 #include <linux/irq.h> 25 - #include <linux/kmemleak.h> 26 25 27 26 #include <asm/ptrace.h> 28 27 #include <asm/processor.h>
-1
arch/x86/kernel/pci-dma.c
··· 6 6 #include <linux/bootmem.h> 7 7 #include <linux/gfp.h> 8 8 #include <linux/pci.h> 9 - #include <linux/kmemleak.h> 10 9 11 10 #include <asm/proto.h> 12 11 #include <asm/dma.h>
+1
drivers/iommu/exynos-iommu.c
··· 17 17 #include <linux/io.h> 18 18 #include <linux/iommu.h> 19 19 #include <linux/interrupt.h> 20 + #include <linux/kmemleak.h> 20 21 #include <linux/list.h> 21 22 #include <linux/of.h> 22 23 #include <linux/of_iommu.h>
-1
drivers/iommu/mtk_iommu_v1.c
··· 25 25 #include <linux/io.h> 26 26 #include <linux/iommu.h> 27 27 #include <linux/iopoll.h> 28 - #include <linux/kmemleak.h> 29 28 #include <linux/list.h> 30 29 #include <linux/of_address.h> 31 30 #include <linux/of_iommu.h>
+1
drivers/net/ethernet/ti/cpsw.c
··· 35 35 #include <linux/of_net.h> 36 36 #include <linux/of_device.h> 37 37 #include <linux/if_vlan.h> 38 + #include <linux/kmemleak.h> 38 39 39 40 #include <linux/pinctrl/consumer.h> 40 41
-1
drivers/net/wireless/realtek/rtlwifi/pci.c
··· 31 31 #include "efuse.h" 32 32 #include <linux/interrupt.h> 33 33 #include <linux/export.h> 34 - #include <linux/kmemleak.h> 35 34 #include <linux/module.h> 36 35 37 36 MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>");
-1
drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
··· 32 32 #include "../rtl8192ce/def.h" 33 33 #include "fw_common.h" 34 34 #include <linux/export.h> 35 - #include <linux/kmemleak.h> 36 35 37 36 static void _rtl92c_enable_fw_download(struct ieee80211_hw *hw, bool enable) 38 37 {
+1 -1
drivers/staging/rtl8188eu/hal/fw.c
··· 30 30 #include "rtl8188e_hal.h" 31 31 32 32 #include <linux/firmware.h> 33 - #include <linux/kmemleak.h> 33 + #include <linux/slab.h> 34 34 35 35 static void _rtl88e_enable_fw_download(struct adapter *adapt, bool enable) 36 36 {
-1
drivers/staging/rtlwifi/pci.c
··· 31 31 #include "efuse.h" 32 32 #include <linux/interrupt.h> 33 33 #include <linux/export.h> 34 - #include <linux/kmemleak.h> 35 34 #include <linux/module.h> 36 35 37 36 MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>");
-1
drivers/virtio/virtio_ring.c
··· 23 23 #include <linux/slab.h> 24 24 #include <linux/module.h> 25 25 #include <linux/hrtimer.h> 26 - #include <linux/kmemleak.h> 27 26 #include <linux/dma-mapping.h> 28 27 #include <xen/xen.h> 29 28
-1
include/linux/slab.h
··· 125 125 #define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \ 126 126 (unsigned long)ZERO_SIZE_PTR) 127 127 128 - #include <linux/kmemleak.h> 129 128 #include <linux/kasan.h> 130 129 131 130 struct mem_cgroup;
+1
kernel/ucount.c
··· 10 10 #include <linux/slab.h> 11 11 #include <linux/cred.h> 12 12 #include <linux/hash.h> 13 + #include <linux/kmemleak.h> 13 14 #include <linux/user_namespace.h> 14 15 15 16 #define UCOUNTS_HASHTABLE_BITS 10
+1
lib/test_firmware.c
··· 21 21 #include <linux/uaccess.h> 22 22 #include <linux/delay.h> 23 23 #include <linux/kthread.h> 24 + #include <linux/vmalloc.h> 24 25 25 26 #define TEST_FIRMWARE_NAME "test-firmware.bin" 26 27 #define TEST_FIRMWARE_NUM_REQS 4
+1
mm/cma.c
··· 35 35 #include <linux/cma.h> 36 36 #include <linux/highmem.h> 37 37 #include <linux/io.h> 38 + #include <linux/kmemleak.h> 38 39 #include <trace/events/cma.h> 39 40 40 41 #include "cma.h"
+1
mm/memblock.c
··· 17 17 #include <linux/poison.h> 18 18 #include <linux/pfn.h> 19 19 #include <linux/debugfs.h> 20 + #include <linux/kmemleak.h> 20 21 #include <linux/seq_file.h> 21 22 #include <linux/memblock.h> 22 23
-1
net/core/sysctl_net_core.c
··· 15 15 #include <linux/vmalloc.h> 16 16 #include <linux/init.h> 17 17 #include <linux/slab.h> 18 - #include <linux/kmemleak.h> 19 18 20 19 #include <net/ip.h> 21 20 #include <net/sock.h>
-1
net/ipv4/route.c
··· 108 108 #include <net/rtnetlink.h> 109 109 #ifdef CONFIG_SYSCTL 110 110 #include <linux/sysctl.h> 111 - #include <linux/kmemleak.h> 112 111 #endif 113 112 #include <net/secure_seq.h> 114 113 #include <net/ip_tunnels.h>
-1
security/apparmor/lsm.c
··· 23 23 #include <linux/sysctl.h> 24 24 #include <linux/audit.h> 25 25 #include <linux/user_namespace.h> 26 - #include <linux/kmemleak.h> 27 26 #include <net/sock.h> 28 27 29 28 #include "include/apparmor.h"
+1
security/keys/big_key.c
··· 18 18 #include <linux/err.h> 19 19 #include <linux/scatterlist.h> 20 20 #include <linux/random.h> 21 + #include <linux/vmalloc.h> 21 22 #include <keys/user-type.h> 22 23 #include <keys/big_key-type.h> 23 24 #include <crypto/aead.h>