diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-27 22:58:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-27 22:58:39 -0400 |
commit | 14970f204b1993af7459d5bd34aaff38dfee6670 (patch) | |
tree | 1103cabe48e2a51fd6a62052600bd1b0cee7cc3e | |
parent | 67463e54beb63114965c3d2c7cb81d1d524e2697 (diff) | |
parent | 8e819101ce6fcc58801c9a813ea99c4da0255eef (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton:
"20 fixes"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
drivers/misc/sgi-gru/grumain.c: remove bogus 0x prefix from printk
cris/arch-v32: cryptocop: print a hex number after a 0x prefix
ipack: print a hex number after a 0x prefix
block: DAC960: print a hex number after a 0x prefix
fs: exofs: print a hex number after a 0x prefix
lib/genalloc.c: start search from start of chunk
mm: memcontrol: do not recurse in direct reclaim
CREDITS: update credit information for Martin Kepplinger
proc: fix NULL dereference when reading /proc/<pid>/auxv
mm: kmemleak: ensure that the task stack is not freed during scanning
lib/stackdepot.c: bump stackdepot capacity from 16MB to 128MB
latent_entropy: raise CONFIG_FRAME_WARN by default
kconfig.h: remove config_enabled() macro
ipc: account for kmem usage on mqueue and msg
mm/slab: improve performance of gathering slabinfo stats
mm: page_alloc: use KERN_CONT where appropriate
mm/list_lru.c: avoid error-path NULL pointer deref
h8300: fix syscall restarting
kcov: properly check if we are in an interrupt
mm/slab: fix kmemcg cache creation delayed issue
-rw-r--r-- | CREDITS | 5 | ||||
-rw-r--r-- | arch/cris/arch-v32/drivers/cryptocop.c | 2 | ||||
-rw-r--r-- | arch/h8300/include/asm/thread_info.h | 4 | ||||
-rw-r--r-- | arch/h8300/kernel/signal.c | 2 | ||||
-rw-r--r-- | arch/x86/mm/kaslr.c | 6 | ||||
-rw-r--r-- | drivers/block/DAC960.c | 4 | ||||
-rw-r--r-- | drivers/ipack/ipack.c | 2 | ||||
-rw-r--r-- | drivers/misc/sgi-gru/grumain.c | 2 | ||||
-rw-r--r-- | fs/exofs/dir.c | 2 | ||||
-rw-r--r-- | fs/proc/base.c | 3 | ||||
-rw-r--r-- | include/asm-generic/export.h | 2 | ||||
-rw-r--r-- | include/linux/kconfig.h | 5 | ||||
-rw-r--r-- | ipc/msgutil.c | 4 | ||||
-rw-r--r-- | kernel/kcov.c | 9 | ||||
-rw-r--r-- | lib/Kconfig.debug | 1 | ||||
-rw-r--r-- | lib/genalloc.c | 3 | ||||
-rw-r--r-- | lib/stackdepot.c | 2 | ||||
-rw-r--r-- | mm/kmemleak.c | 7 | ||||
-rw-r--r-- | mm/list_lru.c | 2 | ||||
-rw-r--r-- | mm/memcontrol.c | 9 | ||||
-rw-r--r-- | mm/page_alloc.c | 16 | ||||
-rw-r--r-- | mm/slab.c | 45 | ||||
-rw-r--r-- | mm/slab.h | 1 | ||||
-rw-r--r-- | mm/vmscan.c | 2 |
24 files changed, 89 insertions, 51 deletions
@@ -1864,10 +1864,11 @@ S: The Netherlands | |||
1864 | 1864 | ||
1865 | N: Martin Kepplinger | 1865 | N: Martin Kepplinger |
1866 | E: martink@posteo.de | 1866 | E: martink@posteo.de |
1867 | E: martin.kepplinger@theobroma-systems.com | 1867 | E: martin.kepplinger@ginzinger.com |
1868 | W: http://www.martinkepplinger.com | 1868 | W: http://www.martinkepplinger.com |
1869 | D: mma8452 accelerators iio driver | 1869 | D: mma8452 accelerators iio driver |
1870 | D: Kernel cleanups | 1870 | D: pegasus_notetaker input driver |
1871 | D: Kernel fixes and cleanups | ||
1871 | S: Garnisonstraße 26 | 1872 | S: Garnisonstraße 26 |
1872 | S: 4020 Linz | 1873 | S: 4020 Linz |
1873 | S: Austria | 1874 | S: Austria |
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c index 099e170a93ee..0068fd411a84 100644 --- a/arch/cris/arch-v32/drivers/cryptocop.c +++ b/arch/cris/arch-v32/drivers/cryptocop.c | |||
@@ -3149,7 +3149,7 @@ static void print_dma_descriptors(struct cryptocop_int_operation *iop) | |||
3149 | printk("print_dma_descriptors start\n"); | 3149 | printk("print_dma_descriptors start\n"); |
3150 | 3150 | ||
3151 | printk("iop:\n"); | 3151 | printk("iop:\n"); |
3152 | printk("\tsid: 0x%lld\n", iop->sid); | 3152 | printk("\tsid: 0x%llx\n", iop->sid); |
3153 | 3153 | ||
3154 | printk("\tcdesc_out: 0x%p\n", iop->cdesc_out); | 3154 | printk("\tcdesc_out: 0x%p\n", iop->cdesc_out); |
3155 | printk("\tcdesc_in: 0x%p\n", iop->cdesc_in); | 3155 | printk("\tcdesc_in: 0x%p\n", iop->cdesc_in); |
diff --git a/arch/h8300/include/asm/thread_info.h b/arch/h8300/include/asm/thread_info.h index b408fe660cf8..3cef06875f5c 100644 --- a/arch/h8300/include/asm/thread_info.h +++ b/arch/h8300/include/asm/thread_info.h | |||
@@ -31,7 +31,6 @@ struct thread_info { | |||
31 | int cpu; /* cpu we're on */ | 31 | int cpu; /* cpu we're on */ |
32 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | 32 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
33 | mm_segment_t addr_limit; | 33 | mm_segment_t addr_limit; |
34 | struct restart_block restart_block; | ||
35 | }; | 34 | }; |
36 | 35 | ||
37 | /* | 36 | /* |
@@ -44,9 +43,6 @@ struct thread_info { | |||
44 | .cpu = 0, \ | 43 | .cpu = 0, \ |
45 | .preempt_count = INIT_PREEMPT_COUNT, \ | 44 | .preempt_count = INIT_PREEMPT_COUNT, \ |
46 | .addr_limit = KERNEL_DS, \ | 45 | .addr_limit = KERNEL_DS, \ |
47 | .restart_block = { \ | ||
48 | .fn = do_no_restart_syscall, \ | ||
49 | }, \ | ||
50 | } | 46 | } |
51 | 47 | ||
52 | #define init_thread_info (init_thread_union.thread_info) | 48 | #define init_thread_info (init_thread_union.thread_info) |
diff --git a/arch/h8300/kernel/signal.c b/arch/h8300/kernel/signal.c index ad1f81f574e5..7138303cbbf2 100644 --- a/arch/h8300/kernel/signal.c +++ b/arch/h8300/kernel/signal.c | |||
@@ -79,7 +79,7 @@ restore_sigcontext(struct sigcontext *usc, int *pd0) | |||
79 | unsigned int er0; | 79 | unsigned int er0; |
80 | 80 | ||
81 | /* Always make any pending restarted system calls return -EINTR */ | 81 | /* Always make any pending restarted system calls return -EINTR */ |
82 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | 82 | current->restart_block.fn = do_no_restart_syscall; |
83 | 83 | ||
84 | /* restore passed registers */ | 84 | /* restore passed registers */ |
85 | #define COPY(r) do { err |= get_user(regs->r, &usc->sc_##r); } while (0) | 85 | #define COPY(r) do { err |= get_user(regs->r, &usc->sc_##r); } while (0) |
diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c index ddd2661c4502..887e57182716 100644 --- a/arch/x86/mm/kaslr.c +++ b/arch/x86/mm/kaslr.c | |||
@@ -104,10 +104,10 @@ void __init kernel_randomize_memory(void) | |||
104 | * consistent with the vaddr_start/vaddr_end variables. | 104 | * consistent with the vaddr_start/vaddr_end variables. |
105 | */ | 105 | */ |
106 | BUILD_BUG_ON(vaddr_start >= vaddr_end); | 106 | BUILD_BUG_ON(vaddr_start >= vaddr_end); |
107 | BUILD_BUG_ON(config_enabled(CONFIG_X86_ESPFIX64) && | 107 | BUILD_BUG_ON(IS_ENABLED(CONFIG_X86_ESPFIX64) && |
108 | vaddr_end >= EFI_VA_START); | 108 | vaddr_end >= EFI_VA_START); |
109 | BUILD_BUG_ON((config_enabled(CONFIG_X86_ESPFIX64) || | 109 | BUILD_BUG_ON((IS_ENABLED(CONFIG_X86_ESPFIX64) || |
110 | config_enabled(CONFIG_EFI)) && | 110 | IS_ENABLED(CONFIG_EFI)) && |
111 | vaddr_end >= __START_KERNEL_map); | 111 | vaddr_end >= __START_KERNEL_map); |
112 | BUILD_BUG_ON(vaddr_end > __START_KERNEL_map); | 112 | BUILD_BUG_ON(vaddr_end > __START_KERNEL_map); |
113 | 113 | ||
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 811e11c82f32..0809cda93cc0 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -2954,7 +2954,7 @@ DAC960_DetectController(struct pci_dev *PCI_Device, | |||
2954 | case DAC960_PD_Controller: | 2954 | case DAC960_PD_Controller: |
2955 | if (!request_region(Controller->IO_Address, 0x80, | 2955 | if (!request_region(Controller->IO_Address, 0x80, |
2956 | Controller->FullModelName)) { | 2956 | Controller->FullModelName)) { |
2957 | DAC960_Error("IO port 0x%d busy for Controller at\n", | 2957 | DAC960_Error("IO port 0x%lx busy for Controller at\n", |
2958 | Controller, Controller->IO_Address); | 2958 | Controller, Controller->IO_Address); |
2959 | goto Failure; | 2959 | goto Failure; |
2960 | } | 2960 | } |
@@ -2990,7 +2990,7 @@ DAC960_DetectController(struct pci_dev *PCI_Device, | |||
2990 | case DAC960_P_Controller: | 2990 | case DAC960_P_Controller: |
2991 | if (!request_region(Controller->IO_Address, 0x80, | 2991 | if (!request_region(Controller->IO_Address, 0x80, |
2992 | Controller->FullModelName)){ | 2992 | Controller->FullModelName)){ |
2993 | DAC960_Error("IO port 0x%d busy for Controller at\n", | 2993 | DAC960_Error("IO port 0x%lx busy for Controller at\n", |
2994 | Controller, Controller->IO_Address); | 2994 | Controller, Controller->IO_Address); |
2995 | goto Failure; | 2995 | goto Failure; |
2996 | } | 2996 | } |
diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c index c0e7b624ce54..12102448fddd 100644 --- a/drivers/ipack/ipack.c +++ b/drivers/ipack/ipack.c | |||
@@ -178,7 +178,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, | |||
178 | idev->id_vendor, idev->id_device); | 178 | idev->id_vendor, idev->id_device); |
179 | } | 179 | } |
180 | 180 | ||
181 | ipack_device_attr(id_format, "0x%hhu\n"); | 181 | ipack_device_attr(id_format, "0x%hhx\n"); |
182 | 182 | ||
183 | static DEVICE_ATTR_RO(id); | 183 | static DEVICE_ATTR_RO(id); |
184 | static DEVICE_ATTR_RO(id_device); | 184 | static DEVICE_ATTR_RO(id_device); |
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c index 1525870f460a..33741ad4a74a 100644 --- a/drivers/misc/sgi-gru/grumain.c +++ b/drivers/misc/sgi-gru/grumain.c | |||
@@ -283,7 +283,7 @@ static void gru_unload_mm_tracker(struct gru_state *gru, | |||
283 | spin_lock(&gru->gs_asid_lock); | 283 | spin_lock(&gru->gs_asid_lock); |
284 | BUG_ON((asids->mt_ctxbitmap & ctxbitmap) != ctxbitmap); | 284 | BUG_ON((asids->mt_ctxbitmap & ctxbitmap) != ctxbitmap); |
285 | asids->mt_ctxbitmap ^= ctxbitmap; | 285 | asids->mt_ctxbitmap ^= ctxbitmap; |
286 | gru_dbg(grudev, "gid %d, gts %p, gms %p, ctxnum 0x%d, asidmap 0x%lx\n", | 286 | gru_dbg(grudev, "gid %d, gts %p, gms %p, ctxnum %d, asidmap 0x%lx\n", |
287 | gru->gs_gid, gts, gms, gts->ts_ctxnum, gms->ms_asidmap[0]); | 287 | gru->gs_gid, gts, gms, gts->ts_ctxnum, gms->ms_asidmap[0]); |
288 | spin_unlock(&gru->gs_asid_lock); | 288 | spin_unlock(&gru->gs_asid_lock); |
289 | spin_unlock(&gms->ms_asid_lock); | 289 | spin_unlock(&gms->ms_asid_lock); |
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c index 79101651fe9e..42f9a0a0c4ca 100644 --- a/fs/exofs/dir.c +++ b/fs/exofs/dir.c | |||
@@ -137,7 +137,7 @@ Espan: | |||
137 | bad_entry: | 137 | bad_entry: |
138 | EXOFS_ERR( | 138 | EXOFS_ERR( |
139 | "ERROR [exofs_check_page]: bad entry in directory(0x%lx): %s - " | 139 | "ERROR [exofs_check_page]: bad entry in directory(0x%lx): %s - " |
140 | "offset=%lu, inode=0x%llu, rec_len=%d, name_len=%d\n", | 140 | "offset=%lu, inode=0x%llx, rec_len=%d, name_len=%d\n", |
141 | dir->i_ino, error, (page->index<<PAGE_SHIFT)+offs, | 141 | dir->i_ino, error, (page->index<<PAGE_SHIFT)+offs, |
142 | _LLU(le64_to_cpu(p->inode_no)), | 142 | _LLU(le64_to_cpu(p->inode_no)), |
143 | rec_len, p->name_len); | 143 | rec_len, p->name_len); |
diff --git a/fs/proc/base.c b/fs/proc/base.c index adfc5b4986f5..ca651ac00660 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1012,6 +1012,9 @@ static ssize_t auxv_read(struct file *file, char __user *buf, | |||
1012 | { | 1012 | { |
1013 | struct mm_struct *mm = file->private_data; | 1013 | struct mm_struct *mm = file->private_data; |
1014 | unsigned int nwords = 0; | 1014 | unsigned int nwords = 0; |
1015 | |||
1016 | if (!mm) | ||
1017 | return 0; | ||
1015 | do { | 1018 | do { |
1016 | nwords += 2; | 1019 | nwords += 2; |
1017 | } while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */ | 1020 | } while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */ |
diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h index 43199a049da5..63554e9f6e0c 100644 --- a/include/asm-generic/export.h +++ b/include/asm-generic/export.h | |||
@@ -70,7 +70,7 @@ KSYM(__kcrctab_\name): | |||
70 | #include <generated/autoksyms.h> | 70 | #include <generated/autoksyms.h> |
71 | 71 | ||
72 | #define __EXPORT_SYMBOL(sym, val, sec) \ | 72 | #define __EXPORT_SYMBOL(sym, val, sec) \ |
73 | __cond_export_sym(sym, val, sec, config_enabled(__KSYM_##sym)) | 73 | __cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym)) |
74 | #define __cond_export_sym(sym, val, sec, conf) \ | 74 | #define __cond_export_sym(sym, val, sec, conf) \ |
75 | ___cond_export_sym(sym, val, sec, conf) | 75 | ___cond_export_sym(sym, val, sec, conf) |
76 | #define ___cond_export_sym(sym, val, sec, enabled) \ | 76 | #define ___cond_export_sym(sym, val, sec, enabled) \ |
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index 15ec117ec537..8f2e059e4d45 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h | |||
@@ -31,7 +31,6 @@ | |||
31 | * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when | 31 | * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when |
32 | * the last step cherry picks the 2nd arg, we get a zero. | 32 | * the last step cherry picks the 2nd arg, we get a zero. |
33 | */ | 33 | */ |
34 | #define config_enabled(cfg) ___is_defined(cfg) | ||
35 | #define __is_defined(x) ___is_defined(x) | 34 | #define __is_defined(x) ___is_defined(x) |
36 | #define ___is_defined(val) ____is_defined(__ARG_PLACEHOLDER_##val) | 35 | #define ___is_defined(val) ____is_defined(__ARG_PLACEHOLDER_##val) |
37 | #define ____is_defined(arg1_or_junk) __take_second_arg(arg1_or_junk 1, 0) | 36 | #define ____is_defined(arg1_or_junk) __take_second_arg(arg1_or_junk 1, 0) |
@@ -41,13 +40,13 @@ | |||
41 | * otherwise. For boolean options, this is equivalent to | 40 | * otherwise. For boolean options, this is equivalent to |
42 | * IS_ENABLED(CONFIG_FOO). | 41 | * IS_ENABLED(CONFIG_FOO). |
43 | */ | 42 | */ |
44 | #define IS_BUILTIN(option) config_enabled(option) | 43 | #define IS_BUILTIN(option) __is_defined(option) |
45 | 44 | ||
46 | /* | 45 | /* |
47 | * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0 | 46 | * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0 |
48 | * otherwise. | 47 | * otherwise. |
49 | */ | 48 | */ |
50 | #define IS_MODULE(option) config_enabled(option##_MODULE) | 49 | #define IS_MODULE(option) __is_defined(option##_MODULE) |
51 | 50 | ||
52 | /* | 51 | /* |
53 | * IS_REACHABLE(CONFIG_FOO) evaluates to 1 if the currently compiled | 52 | * IS_REACHABLE(CONFIG_FOO) evaluates to 1 if the currently compiled |
diff --git a/ipc/msgutil.c b/ipc/msgutil.c index a521999de4f1..bf74eaa5c39f 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c | |||
@@ -53,7 +53,7 @@ static struct msg_msg *alloc_msg(size_t len) | |||
53 | size_t alen; | 53 | size_t alen; |
54 | 54 | ||
55 | alen = min(len, DATALEN_MSG); | 55 | alen = min(len, DATALEN_MSG); |
56 | msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL); | 56 | msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL_ACCOUNT); |
57 | if (msg == NULL) | 57 | if (msg == NULL) |
58 | return NULL; | 58 | return NULL; |
59 | 59 | ||
@@ -65,7 +65,7 @@ static struct msg_msg *alloc_msg(size_t len) | |||
65 | while (len > 0) { | 65 | while (len > 0) { |
66 | struct msg_msgseg *seg; | 66 | struct msg_msgseg *seg; |
67 | alen = min(len, DATALEN_SEG); | 67 | alen = min(len, DATALEN_SEG); |
68 | seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL); | 68 | seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL_ACCOUNT); |
69 | if (seg == NULL) | 69 | if (seg == NULL) |
70 | goto out_err; | 70 | goto out_err; |
71 | *pseg = seg; | 71 | *pseg = seg; |
diff --git a/kernel/kcov.c b/kernel/kcov.c index 8d44b3fea9d0..30e6d05aa5a9 100644 --- a/kernel/kcov.c +++ b/kernel/kcov.c | |||
@@ -53,8 +53,15 @@ void notrace __sanitizer_cov_trace_pc(void) | |||
53 | /* | 53 | /* |
54 | * We are interested in code coverage as a function of a syscall inputs, | 54 | * We are interested in code coverage as a function of a syscall inputs, |
55 | * so we ignore code executed in interrupts. | 55 | * so we ignore code executed in interrupts. |
56 | * The checks for whether we are in an interrupt are open-coded, because | ||
57 | * 1. We can't use in_interrupt() here, since it also returns true | ||
58 | * when we are inside local_bh_disable() section. | ||
59 | * 2. We don't want to use (in_irq() | in_serving_softirq() | in_nmi()), | ||
60 | * since that leads to slower generated code (three separate tests, | ||
61 | * one for each of the flags). | ||
56 | */ | 62 | */ |
57 | if (!t || in_interrupt()) | 63 | if (!t || (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_OFFSET |
64 | | NMI_MASK))) | ||
58 | return; | 65 | return; |
59 | mode = READ_ONCE(t->kcov_mode); | 66 | mode = READ_ONCE(t->kcov_mode); |
60 | if (mode == KCOV_MODE_TRACE) { | 67 | if (mode == KCOV_MODE_TRACE) { |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 33bc56cf60d7..b01e547d4d04 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -198,6 +198,7 @@ config FRAME_WARN | |||
198 | int "Warn for stack frames larger than (needs gcc 4.4)" | 198 | int "Warn for stack frames larger than (needs gcc 4.4)" |
199 | range 0 8192 | 199 | range 0 8192 |
200 | default 0 if KASAN | 200 | default 0 if KASAN |
201 | default 2048 if GCC_PLUGIN_LATENT_ENTROPY | ||
201 | default 1024 if !64BIT | 202 | default 1024 if !64BIT |
202 | default 2048 if 64BIT | 203 | default 2048 if 64BIT |
203 | help | 204 | help |
diff --git a/lib/genalloc.c b/lib/genalloc.c index 0a1139644d32..144fe6b1a03e 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c | |||
@@ -292,7 +292,7 @@ unsigned long gen_pool_alloc_algo(struct gen_pool *pool, size_t size, | |||
292 | struct gen_pool_chunk *chunk; | 292 | struct gen_pool_chunk *chunk; |
293 | unsigned long addr = 0; | 293 | unsigned long addr = 0; |
294 | int order = pool->min_alloc_order; | 294 | int order = pool->min_alloc_order; |
295 | int nbits, start_bit = 0, end_bit, remain; | 295 | int nbits, start_bit, end_bit, remain; |
296 | 296 | ||
297 | #ifndef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG | 297 | #ifndef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG |
298 | BUG_ON(in_nmi()); | 298 | BUG_ON(in_nmi()); |
@@ -307,6 +307,7 @@ unsigned long gen_pool_alloc_algo(struct gen_pool *pool, size_t size, | |||
307 | if (size > atomic_read(&chunk->avail)) | 307 | if (size > atomic_read(&chunk->avail)) |
308 | continue; | 308 | continue; |
309 | 309 | ||
310 | start_bit = 0; | ||
310 | end_bit = chunk_size(chunk) >> order; | 311 | end_bit = chunk_size(chunk) >> order; |
311 | retry: | 312 | retry: |
312 | start_bit = algo(chunk->bits, end_bit, start_bit, | 313 | start_bit = algo(chunk->bits, end_bit, start_bit, |
diff --git a/lib/stackdepot.c b/lib/stackdepot.c index 60f77f1d470a..4d830e299989 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c | |||
@@ -50,7 +50,7 @@ | |||
50 | STACK_ALLOC_ALIGN) | 50 | STACK_ALLOC_ALIGN) |
51 | #define STACK_ALLOC_INDEX_BITS (DEPOT_STACK_BITS - \ | 51 | #define STACK_ALLOC_INDEX_BITS (DEPOT_STACK_BITS - \ |
52 | STACK_ALLOC_NULL_PROTECTION_BITS - STACK_ALLOC_OFFSET_BITS) | 52 | STACK_ALLOC_NULL_PROTECTION_BITS - STACK_ALLOC_OFFSET_BITS) |
53 | #define STACK_ALLOC_SLABS_CAP 1024 | 53 | #define STACK_ALLOC_SLABS_CAP 8192 |
54 | #define STACK_ALLOC_MAX_SLABS \ | 54 | #define STACK_ALLOC_MAX_SLABS \ |
55 | (((1LL << (STACK_ALLOC_INDEX_BITS)) < STACK_ALLOC_SLABS_CAP) ? \ | 55 | (((1LL << (STACK_ALLOC_INDEX_BITS)) < STACK_ALLOC_SLABS_CAP) ? \ |
56 | (1LL << (STACK_ALLOC_INDEX_BITS)) : STACK_ALLOC_SLABS_CAP) | 56 | (1LL << (STACK_ALLOC_INDEX_BITS)) : STACK_ALLOC_SLABS_CAP) |
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index a5e453cf05c4..e5355a5b423f 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
@@ -1453,8 +1453,11 @@ static void kmemleak_scan(void) | |||
1453 | 1453 | ||
1454 | read_lock(&tasklist_lock); | 1454 | read_lock(&tasklist_lock); |
1455 | do_each_thread(g, p) { | 1455 | do_each_thread(g, p) { |
1456 | scan_block(task_stack_page(p), task_stack_page(p) + | 1456 | void *stack = try_get_task_stack(p); |
1457 | THREAD_SIZE, NULL); | 1457 | if (stack) { |
1458 | scan_block(stack, stack + THREAD_SIZE, NULL); | ||
1459 | put_task_stack(p); | ||
1460 | } | ||
1458 | } while_each_thread(g, p); | 1461 | } while_each_thread(g, p); |
1459 | read_unlock(&tasklist_lock); | 1462 | read_unlock(&tasklist_lock); |
1460 | } | 1463 | } |
diff --git a/mm/list_lru.c b/mm/list_lru.c index 1d05cb9d363d..234676e31edd 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c | |||
@@ -554,6 +554,8 @@ int __list_lru_init(struct list_lru *lru, bool memcg_aware, | |||
554 | err = memcg_init_list_lru(lru, memcg_aware); | 554 | err = memcg_init_list_lru(lru, memcg_aware); |
555 | if (err) { | 555 | if (err) { |
556 | kfree(lru->node); | 556 | kfree(lru->node); |
557 | /* Do this so a list_lru_destroy() doesn't crash: */ | ||
558 | lru->node = NULL; | ||
557 | goto out; | 559 | goto out; |
558 | } | 560 | } |
559 | 561 | ||
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index ae052b5e3315..0f870ba43942 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1917,6 +1917,15 @@ retry: | |||
1917 | current->flags & PF_EXITING)) | 1917 | current->flags & PF_EXITING)) |
1918 | goto force; | 1918 | goto force; |
1919 | 1919 | ||
1920 | /* | ||
1921 | * Prevent unbounded recursion when reclaim operations need to | ||
1922 | * allocate memory. This might exceed the limits temporarily, | ||
1923 | * but we prefer facilitating memory reclaim and getting back | ||
1924 | * under the limit over triggering OOM kills in these cases. | ||
1925 | */ | ||
1926 | if (unlikely(current->flags & PF_MEMALLOC)) | ||
1927 | goto force; | ||
1928 | |||
1920 | if (unlikely(task_in_memcg_oom(current))) | 1929 | if (unlikely(task_in_memcg_oom(current))) |
1921 | goto nomem; | 1930 | goto nomem; |
1922 | 1931 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index de7c6e43b1c9..8fd42aa7c4bd 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -4224,7 +4224,7 @@ static void show_migration_types(unsigned char type) | |||
4224 | } | 4224 | } |
4225 | 4225 | ||
4226 | *p = '\0'; | 4226 | *p = '\0'; |
4227 | printk("(%s) ", tmp); | 4227 | printk(KERN_CONT "(%s) ", tmp); |
4228 | } | 4228 | } |
4229 | 4229 | ||
4230 | /* | 4230 | /* |
@@ -4335,7 +4335,8 @@ void show_free_areas(unsigned int filter) | |||
4335 | free_pcp += per_cpu_ptr(zone->pageset, cpu)->pcp.count; | 4335 | free_pcp += per_cpu_ptr(zone->pageset, cpu)->pcp.count; |
4336 | 4336 | ||
4337 | show_node(zone); | 4337 | show_node(zone); |
4338 | printk("%s" | 4338 | printk(KERN_CONT |
4339 | "%s" | ||
4339 | " free:%lukB" | 4340 | " free:%lukB" |
4340 | " min:%lukB" | 4341 | " min:%lukB" |
4341 | " low:%lukB" | 4342 | " low:%lukB" |
@@ -4382,8 +4383,8 @@ void show_free_areas(unsigned int filter) | |||
4382 | K(zone_page_state(zone, NR_FREE_CMA_PAGES))); | 4383 | K(zone_page_state(zone, NR_FREE_CMA_PAGES))); |
4383 | printk("lowmem_reserve[]:"); | 4384 | printk("lowmem_reserve[]:"); |
4384 | for (i = 0; i < MAX_NR_ZONES; i++) | 4385 | for (i = 0; i < MAX_NR_ZONES; i++) |
4385 | printk(" %ld", zone->lowmem_reserve[i]); | 4386 | printk(KERN_CONT " %ld", zone->lowmem_reserve[i]); |
4386 | printk("\n"); | 4387 | printk(KERN_CONT "\n"); |
4387 | } | 4388 | } |
4388 | 4389 | ||
4389 | for_each_populated_zone(zone) { | 4390 | for_each_populated_zone(zone) { |
@@ -4394,7 +4395,7 @@ void show_free_areas(unsigned int filter) | |||
4394 | if (skip_free_areas_node(filter, zone_to_nid(zone))) | 4395 | if (skip_free_areas_node(filter, zone_to_nid(zone))) |
4395 | continue; | 4396 | continue; |
4396 | show_node(zone); | 4397 | show_node(zone); |
4397 | printk("%s: ", zone->name); | 4398 | printk(KERN_CONT "%s: ", zone->name); |
4398 | 4399 | ||
4399 | spin_lock_irqsave(&zone->lock, flags); | 4400 | spin_lock_irqsave(&zone->lock, flags); |
4400 | for (order = 0; order < MAX_ORDER; order++) { | 4401 | for (order = 0; order < MAX_ORDER; order++) { |
@@ -4412,11 +4413,12 @@ void show_free_areas(unsigned int filter) | |||
4412 | } | 4413 | } |
4413 | spin_unlock_irqrestore(&zone->lock, flags); | 4414 | spin_unlock_irqrestore(&zone->lock, flags); |
4414 | for (order = 0; order < MAX_ORDER; order++) { | 4415 | for (order = 0; order < MAX_ORDER; order++) { |
4415 | printk("%lu*%lukB ", nr[order], K(1UL) << order); | 4416 | printk(KERN_CONT "%lu*%lukB ", |
4417 | nr[order], K(1UL) << order); | ||
4416 | if (nr[order]) | 4418 | if (nr[order]) |
4417 | show_migration_types(types[order]); | 4419 | show_migration_types(types[order]); |
4418 | } | 4420 | } |
4419 | printk("= %lukB\n", K(total)); | 4421 | printk(KERN_CONT "= %lukB\n", K(total)); |
4420 | } | 4422 | } |
4421 | 4423 | ||
4422 | hugetlb_show_meminfo(); | 4424 | hugetlb_show_meminfo(); |
@@ -233,6 +233,7 @@ static void kmem_cache_node_init(struct kmem_cache_node *parent) | |||
233 | spin_lock_init(&parent->list_lock); | 233 | spin_lock_init(&parent->list_lock); |
234 | parent->free_objects = 0; | 234 | parent->free_objects = 0; |
235 | parent->free_touched = 0; | 235 | parent->free_touched = 0; |
236 | parent->num_slabs = 0; | ||
236 | } | 237 | } |
237 | 238 | ||
238 | #define MAKE_LIST(cachep, listp, slab, nodeid) \ | 239 | #define MAKE_LIST(cachep, listp, slab, nodeid) \ |
@@ -966,7 +967,7 @@ static int setup_kmem_cache_node(struct kmem_cache *cachep, | |||
966 | * guaranteed to be valid until irq is re-enabled, because it will be | 967 | * guaranteed to be valid until irq is re-enabled, because it will be |
967 | * freed after synchronize_sched(). | 968 | * freed after synchronize_sched(). |
968 | */ | 969 | */ |
969 | if (force_change) | 970 | if (old_shared && force_change) |
970 | synchronize_sched(); | 971 | synchronize_sched(); |
971 | 972 | ||
972 | fail: | 973 | fail: |
@@ -1382,24 +1383,27 @@ slab_out_of_memory(struct kmem_cache *cachep, gfp_t gfpflags, int nodeid) | |||
1382 | for_each_kmem_cache_node(cachep, node, n) { | 1383 | for_each_kmem_cache_node(cachep, node, n) { |
1383 | unsigned long active_objs = 0, num_objs = 0, free_objects = 0; | 1384 | unsigned long active_objs = 0, num_objs = 0, free_objects = 0; |
1384 | unsigned long active_slabs = 0, num_slabs = 0; | 1385 | unsigned long active_slabs = 0, num_slabs = 0; |
1386 | unsigned long num_slabs_partial = 0, num_slabs_free = 0; | ||
1387 | unsigned long num_slabs_full; | ||
1385 | 1388 | ||
1386 | spin_lock_irqsave(&n->list_lock, flags); | 1389 | spin_lock_irqsave(&n->list_lock, flags); |
1387 | list_for_each_entry(page, &n->slabs_full, lru) { | 1390 | num_slabs = n->num_slabs; |
1388 | active_objs += cachep->num; | ||
1389 | active_slabs++; | ||
1390 | } | ||
1391 | list_for_each_entry(page, &n->slabs_partial, lru) { | 1391 | list_for_each_entry(page, &n->slabs_partial, lru) { |
1392 | active_objs += page->active; | 1392 | active_objs += page->active; |
1393 | active_slabs++; | 1393 | num_slabs_partial++; |
1394 | } | 1394 | } |
1395 | list_for_each_entry(page, &n->slabs_free, lru) | 1395 | list_for_each_entry(page, &n->slabs_free, lru) |
1396 | num_slabs++; | 1396 | num_slabs_free++; |
1397 | 1397 | ||
1398 | free_objects += n->free_objects; | 1398 | free_objects += n->free_objects; |
1399 | spin_unlock_irqrestore(&n->list_lock, flags); | 1399 | spin_unlock_irqrestore(&n->list_lock, flags); |
1400 | 1400 | ||
1401 | num_slabs += active_slabs; | ||
1402 | num_objs = num_slabs * cachep->num; | 1401 | num_objs = num_slabs * cachep->num; |
1402 | active_slabs = num_slabs - num_slabs_free; | ||
1403 | num_slabs_full = num_slabs - | ||
1404 | (num_slabs_partial + num_slabs_free); | ||
1405 | active_objs += (num_slabs_full * cachep->num); | ||
1406 | |||
1403 | pr_warn(" node %d: slabs: %ld/%ld, objs: %ld/%ld, free: %ld\n", | 1407 | pr_warn(" node %d: slabs: %ld/%ld, objs: %ld/%ld, free: %ld\n", |
1404 | node, active_slabs, num_slabs, active_objs, num_objs, | 1408 | node, active_slabs, num_slabs, active_objs, num_objs, |
1405 | free_objects); | 1409 | free_objects); |
@@ -2314,6 +2318,7 @@ static int drain_freelist(struct kmem_cache *cache, | |||
2314 | 2318 | ||
2315 | page = list_entry(p, struct page, lru); | 2319 | page = list_entry(p, struct page, lru); |
2316 | list_del(&page->lru); | 2320 | list_del(&page->lru); |
2321 | n->num_slabs--; | ||
2317 | /* | 2322 | /* |
2318 | * Safe to drop the lock. The slab is no longer linked | 2323 | * Safe to drop the lock. The slab is no longer linked |
2319 | * to the cache. | 2324 | * to the cache. |
@@ -2752,6 +2757,8 @@ static void cache_grow_end(struct kmem_cache *cachep, struct page *page) | |||
2752 | list_add_tail(&page->lru, &(n->slabs_free)); | 2757 | list_add_tail(&page->lru, &(n->slabs_free)); |
2753 | else | 2758 | else |
2754 | fixup_slab_list(cachep, n, page, &list); | 2759 | fixup_slab_list(cachep, n, page, &list); |
2760 | |||
2761 | n->num_slabs++; | ||
2755 | STATS_INC_GROWN(cachep); | 2762 | STATS_INC_GROWN(cachep); |
2756 | n->free_objects += cachep->num - page->active; | 2763 | n->free_objects += cachep->num - page->active; |
2757 | spin_unlock(&n->list_lock); | 2764 | spin_unlock(&n->list_lock); |
@@ -3443,6 +3450,7 @@ static void free_block(struct kmem_cache *cachep, void **objpp, | |||
3443 | 3450 | ||
3444 | page = list_last_entry(&n->slabs_free, struct page, lru); | 3451 | page = list_last_entry(&n->slabs_free, struct page, lru); |
3445 | list_move(&page->lru, list); | 3452 | list_move(&page->lru, list); |
3453 | n->num_slabs--; | ||
3446 | } | 3454 | } |
3447 | } | 3455 | } |
3448 | 3456 | ||
@@ -4099,6 +4107,8 @@ void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo) | |||
4099 | unsigned long num_objs; | 4107 | unsigned long num_objs; |
4100 | unsigned long active_slabs = 0; | 4108 | unsigned long active_slabs = 0; |
4101 | unsigned long num_slabs, free_objects = 0, shared_avail = 0; | 4109 | unsigned long num_slabs, free_objects = 0, shared_avail = 0; |
4110 | unsigned long num_slabs_partial = 0, num_slabs_free = 0; | ||
4111 | unsigned long num_slabs_full = 0; | ||
4102 | const char *name; | 4112 | const char *name; |
4103 | char *error = NULL; | 4113 | char *error = NULL; |
4104 | int node; | 4114 | int node; |
@@ -4111,33 +4121,34 @@ void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo) | |||
4111 | check_irq_on(); | 4121 | check_irq_on(); |
4112 | spin_lock_irq(&n->list_lock); | 4122 | spin_lock_irq(&n->list_lock); |
4113 | 4123 | ||
4114 | list_for_each_entry(page, &n->slabs_full, lru) { | 4124 | num_slabs += n->num_slabs; |
4115 | if (page->active != cachep->num && !error) | 4125 | |
4116 | error = "slabs_full accounting error"; | ||
4117 | active_objs += cachep->num; | ||
4118 | active_slabs++; | ||
4119 | } | ||
4120 | list_for_each_entry(page, &n->slabs_partial, lru) { | 4126 | list_for_each_entry(page, &n->slabs_partial, lru) { |
4121 | if (page->active == cachep->num && !error) | 4127 | if (page->active == cachep->num && !error) |
4122 | error = "slabs_partial accounting error"; | 4128 | error = "slabs_partial accounting error"; |
4123 | if (!page->active && !error) | 4129 | if (!page->active && !error) |
4124 | error = "slabs_partial accounting error"; | 4130 | error = "slabs_partial accounting error"; |
4125 | active_objs += page->active; | 4131 | active_objs += page->active; |
4126 | active_slabs++; | 4132 | num_slabs_partial++; |
4127 | } | 4133 | } |
4134 | |||
4128 | list_for_each_entry(page, &n->slabs_free, lru) { | 4135 | list_for_each_entry(page, &n->slabs_free, lru) { |
4129 | if (page->active && !error) | 4136 | if (page->active && !error) |
4130 | error = "slabs_free accounting error"; | 4137 | error = "slabs_free accounting error"; |
4131 | num_slabs++; | 4138 | num_slabs_free++; |
4132 | } | 4139 | } |
4140 | |||
4133 | free_objects += n->free_objects; | 4141 | free_objects += n->free_objects; |
4134 | if (n->shared) | 4142 | if (n->shared) |
4135 | shared_avail += n->shared->avail; | 4143 | shared_avail += n->shared->avail; |
4136 | 4144 | ||
4137 | spin_unlock_irq(&n->list_lock); | 4145 | spin_unlock_irq(&n->list_lock); |
4138 | } | 4146 | } |
4139 | num_slabs += active_slabs; | ||
4140 | num_objs = num_slabs * cachep->num; | 4147 | num_objs = num_slabs * cachep->num; |
4148 | active_slabs = num_slabs - num_slabs_free; | ||
4149 | num_slabs_full = num_slabs - (num_slabs_partial + num_slabs_free); | ||
4150 | active_objs += (num_slabs_full * cachep->num); | ||
4151 | |||
4141 | if (num_objs - active_objs != free_objects && !error) | 4152 | if (num_objs - active_objs != free_objects && !error) |
4142 | error = "free_objects accounting error"; | 4153 | error = "free_objects accounting error"; |
4143 | 4154 | ||
@@ -432,6 +432,7 @@ struct kmem_cache_node { | |||
432 | struct list_head slabs_partial; /* partial list first, better asm code */ | 432 | struct list_head slabs_partial; /* partial list first, better asm code */ |
433 | struct list_head slabs_full; | 433 | struct list_head slabs_full; |
434 | struct list_head slabs_free; | 434 | struct list_head slabs_free; |
435 | unsigned long num_slabs; | ||
435 | unsigned long free_objects; | 436 | unsigned long free_objects; |
436 | unsigned int free_limit; | 437 | unsigned int free_limit; |
437 | unsigned int colour_next; /* Per-node cache coloring */ | 438 | unsigned int colour_next; /* Per-node cache coloring */ |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 744f926af442..76fda2268148 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -3043,7 +3043,9 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg, | |||
3043 | sc.gfp_mask, | 3043 | sc.gfp_mask, |
3044 | sc.reclaim_idx); | 3044 | sc.reclaim_idx); |
3045 | 3045 | ||
3046 | current->flags |= PF_MEMALLOC; | ||
3046 | nr_reclaimed = do_try_to_free_pages(zonelist, &sc); | 3047 | nr_reclaimed = do_try_to_free_pages(zonelist, &sc); |
3048 | current->flags &= ~PF_MEMALLOC; | ||
3047 | 3049 | ||
3048 | trace_mm_vmscan_memcg_reclaim_end(nr_reclaimed); | 3050 | trace_mm_vmscan_memcg_reclaim_end(nr_reclaimed); |
3049 | 3051 | ||