History

Merge branch 'akpm' (patches from Andrew)

Merge fixes from Andrew Morton: "26 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (26 commits) userfaultfd: remove wrong comment from userfaultfd_ctx_get() fat: fix using uninitialized fields of fat_inode/fsinfo_inode sh: cayman: IDE support fix kasan: fix races in quarantine_remove_cache() kasan: resched in quarantine_remove_cache() mm: do not call mem_cgroup_free() from within mem_cgroup_alloc() thp: fix another corner case of munlock() vs. THPs rmap: fix NULL-pointer dereference on THP munlocking mm/memblock.c: fix memblock_next_valid_pfn() userfaultfd: selftest: vm: allow to build in vm/ directory userfaultfd: non-cooperative: userfaultfd_remove revalidate vma in MADV_DONTNEED userfaultfd: non-cooperative: fix fork fctx->new memleak mm/cgroup: avoid panic when init with low memory drivers/md/bcache/util.h: remove duplicate inclusion of blkdev.h mm/vmstats: add thp_split_pud event for clarity include/linux/fs.h: fix unsigned enum warning with gcc-4.2 userfaultfd: non-cooperative: release all ctx in dup_userfaultfd_complete userfaultfd: non-cooperative: robustness check userfaultfd: non-cooperative: rollback userfaultfd_exit x86, mm: unify exit paths in gup_pte_range() ...

Linus Torvalds committed 9 years ago

Commit 8fe3cca2 parents 9db61d6 2378cd654 files · +277 −185Browse files

Unified · Split

54 files
  1. Documentation/dev-tools/kcov.rst +1 −1
  2. Documentation/devicetree/bindings/regulator/ti-abb-regulator.txt +1 −1
  3. Documentation/vm/userfaultfd.txt +0 −4
  4. arch/cris/arch-v32/drivers/cryptocop.c +1 −1
  5. arch/powerpc/include/asm/book3s/64/pgtable.h +55 −30
  6. arch/powerpc/kvm/book3s_64_mmu_hv.c +1 −1
  7. arch/powerpc/kvm/book3s_hv_rm_mmu.c +1 −1
  8. arch/sh/boards/mach-cayman/setup.c +0 −2
  9. arch/x86/kernel/ftrace.c +1 −1
  10. arch/x86/mm/gup.c +21 −16
  11. drivers/block/paride/pcd.c +1 −1
  12. drivers/block/paride/pd.c +1 −1
  13. drivers/block/paride/pf.c +1 −1
  14. drivers/block/paride/pg.c +1 −1
  15. drivers/block/paride/pt.c +1 −1
  16. drivers/crypto/ux500/cryp/cryp.c +1 −1
  17. drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 −1
  18. drivers/hv/channel.c +1 −1
  19. drivers/isdn/hisax/st5481_b.c +1 −1
  20. drivers/md/bcache/util.h +0 −1
  21. drivers/media/dvb-frontends/drx39xyj/drx_driver.h +3 −5
  22. drivers/mtd/spi-nor/spi-nor.c +1 −1
  23. drivers/net/ethernet/qlogic/qlge/qlge.h +2 −2
  24. drivers/scsi/aic7xxx/aic79xx_core.c +1 −1
  25. drivers/usb/gadget/legacy/inode.c +1 −2
  26. drivers/usb/host/xhci.c +2 −2
  27. fs/fat/inode.c +12 −1
  28. fs/userfaultfd.c +21 −48
  29. include/dt-bindings/sound/cs42l42.h +1 −1
  30. include/linux/fs.h +1 −1
  31. include/linux/regulator/machine.h +1 −1
  32. include/linux/userfaultfd_k.h +3 −10
  33. include/linux/vm_event_item.h +3 −0
  34. include/net/irda/timer.h +1 −1
  35. include/uapi/linux/userfaultfd.h +1 −4
  36. kernel/cgroup/cgroup.c +1 −1
  37. kernel/events/core.c +1 −1
  38. kernel/exit.c +0 −1
  39. kernel/trace/trace_stack.c +1 −1
  40. mm/huge_memory.c +1 −1
  41. mm/kasan/quarantine.c +44 −7
  42. mm/madvise.c +41 −3
  43. mm/memblock.c +4 −1
  44. mm/memcontrol.c +13 −5
  45. mm/mlock.c +4 −5
  46. mm/rmap.c +7 −6
  47. mm/vmstat.c +3 −0
  48. scripts/spelling.txt +3 −0
  49. sound/soc/amd/acp-pcm-dma.c +1 −1
  50. tools/lguest/lguest.c +1 −1
  51. tools/lib/bpf/Makefile +1 −1
  52. tools/lib/traceevent/Makefile +1 −1
  53. tools/lib/traceevent/event-parse.h +1 −1
  54. tools/testing/selftests/vm/Makefile +4 −0
Documentation/dev-tools/kcov.rst+1−1
@@ -10,7 +10,7 @@ Note that kcov does not aim to collect as much coverage as possible. It aims · 9 unmodified lines
1010 to collect more or less stable coverage that is function of syscall inputs.
1111 To achieve this goal it does not collect coverage in soft/hard interrupts
1212 and instrumentation of some inherently non-deterministic parts of kernel is
13−disbled (e.g. scheduler, locking).
13+disabled (e.g. scheduler, locking).
1414
1515 Usage
1616 -----
Documentation/devicetree/bindings/regulator/ti-abb-regulator.txt+1−1
@@ -45,7 +45,7 @@ Required Properties: · 44 unmodified lines
4545 Optional Properties:
4646 - reg-names: In addition to the required properties, the following are optional
4747 - "efuse-address" - Contains efuse base address used to pick up ABB info.
48− - "ldo-address" - Contains address of ABB LDO overide register address.
48+ - "ldo-address" - Contains address of ABB LDO override register.
4949 "efuse-address" is required for this.
5050 - ti,ldovbb-vset-mask - Required if ldo-address is set, mask for LDO override
5151 register to provide override vset value.
Documentation/vm/userfaultfd.txt+0−4
@@ -172,10 +172,6 @@ the same read(2) protocol as for the page fault notifications. The · 171 unmodified lines
172172 manager has to explicitly enable these events by setting appropriate
173173 bits in uffdio_api.features passed to UFFDIO_API ioctl:
174174
175−UFFD_FEATURE_EVENT_EXIT - enable notification about exit() of the
176−non-cooperative process. When the monitored process exits, the uffd
177−manager will get UFFD_EVENT_EXIT.
178−
179175 UFFD_FEATURE_EVENT_FORK - enable userfaultfd hooks for fork(). When
180176 this feature is enabled, the userfaultfd context of the parent process
181177 is duplicated into the newly created process. The manager receives
arch/cris/arch-v32/drivers/cryptocop.c+1−1
@@ -2086,7 +2086,7 @@ static void cryptocop_job_queue_close(void) · 2085 unmodified lines
20862086 dma_in_cfg.en = regk_dma_no;
20872087 REG_WR(dma, IN_DMA_INST, rw_cfg, dma_in_cfg);
20882088
2089− /* Disble the cryptocop. */
2089+ /* Disable the cryptocop. */
20902090 rw_cfg = REG_RD(strcop, regi_strcop, rw_cfg);
20912091 rw_cfg.en = 0;
20922092 REG_WR(strcop, regi_strcop, rw_cfg, rw_cfg);
arch/powerpc/include/asm/book3s/64/pgtable.h+55−30
@@ -347,23 +347,58 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm, · 346 unmodified lines
347347 __r; \
348348 })
349349
350+static inline int __pte_write(pte_t pte)
351+{
352+ return !!(pte_raw(pte) & cpu_to_be64(_PAGE_WRITE));
353+}
354+
355+#ifdef CONFIG_NUMA_BALANCING
356+#define pte_savedwrite pte_savedwrite
357+static inline bool pte_savedwrite(pte_t pte)
358+{
359+ /*
360+ * Saved write ptes are prot none ptes that doesn't have
361+ * privileged bit sit. We mark prot none as one which has
362+ * present and pviliged bit set and RWX cleared. To mark
363+ * protnone which used to have _PAGE_WRITE set we clear
364+ * the privileged bit.
365+ */
366+ return !(pte_raw(pte) & cpu_to_be64(_PAGE_RWX | _PAGE_PRIVILEGED));
367+}
368+#else
369+#define pte_savedwrite pte_savedwrite
370+static inline bool pte_savedwrite(pte_t pte)
371+{
372+ return false;
373+}
374+#endif
375+
376+static inline int pte_write(pte_t pte)
377+{
378+ return __pte_write(pte) || pte_savedwrite(pte);
379+}
380+
350381 #define __HAVE_ARCH_PTEP_SET_WRPROTECT
351382 static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
352383 pte_t *ptep)
353384 {
354− if ((pte_raw(*ptep) & cpu_to_be64(_PAGE_WRITE)) == 0)
355− return;
356−
357− pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 0);
385+ if (__pte_write(*ptep))
386+ pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 0);
387+ else if (unlikely(pte_savedwrite(*ptep)))
388+ pte_update(mm, addr, ptep, 0, _PAGE_PRIVILEGED, 0);
358389 }
359390
360391 static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
361392 unsigned long addr, pte_t *ptep)
362393 {
363− if ((pte_raw(*ptep) & cpu_to_be64(_PAGE_WRITE)) == 0)
364− return;
365−
366− pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 1);
394+ /*
395+ * We should not find protnone for hugetlb, but this complete the
396+ * interface.
397+ */
398+ if (__pte_write(*ptep))
399+ pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 1);
400+ else if (unlikely(pte_savedwrite(*ptep)))
401+ pte_update(mm, addr, ptep, 0, _PAGE_PRIVILEGED, 1);
367402 }
368403
369404 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
@@ -397,11 +432,6 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, · 27 unmodified lines
397432 pte_update(mm, addr, ptep, ~0UL, 0, 0);
398433 }
399434
400−static inline int pte_write(pte_t pte)
401−{
402− return !!(pte_raw(pte) & cpu_to_be64(_PAGE_WRITE));
403−}
404−
405435 static inline int pte_dirty(pte_t pte)
406436 {
407437 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_DIRTY));
@@ -465,19 +495,12 @@ static inline pte_t pte_clear_savedwrite(pte_t pte) · 57 unmodified lines
465495 VM_BUG_ON(!pte_protnone(pte));
466496 return __pte(pte_val(pte) | _PAGE_PRIVILEGED);
467497 }
468−
469−#define pte_savedwrite pte_savedwrite
470−static inline bool pte_savedwrite(pte_t pte)
498+#else
499+#define pte_clear_savedwrite pte_clear_savedwrite
500+static inline pte_t pte_clear_savedwrite(pte_t pte)
471501 {
472− /*
473− * Saved write ptes are prot none ptes that doesn't have
474− * privileged bit sit. We mark prot none as one which has
475− * present and pviliged bit set and RWX cleared. To mark
476− * protnone which used to have _PAGE_WRITE set we clear
477− * the privileged bit.
478− */
479− VM_BUG_ON(!pte_protnone(pte));
480− return !(pte_raw(pte) & cpu_to_be64(_PAGE_RWX | _PAGE_PRIVILEGED));
502+ VM_WARN_ON(1);
503+ return __pte(pte_val(pte) & ~_PAGE_WRITE);
481504 }
482505 #endif /* CONFIG_NUMA_BALANCING */
483506
@@ -506,6 +529,8 @@ static inline unsigned long pte_pfn(pte_t pte) · 22 unmodified lines
506529 /* Generic modifiers for PTE bits */
507530 static inline pte_t pte_wrprotect(pte_t pte)
508531 {
532+ if (unlikely(pte_savedwrite(pte)))
533+ return pte_clear_savedwrite(pte);
509534 return __pte(pte_val(pte) & ~_PAGE_WRITE);
510535 }
511536
@@ -926,6 +951,7 @@ static inline int pmd_protnone(pmd_t pmd) · 414 unmodified lines
926951
927952 #define __HAVE_ARCH_PMD_WRITE
928953 #define pmd_write(pmd) pte_write(pmd_pte(pmd))
954+#define __pmd_write(pmd) __pte_write(pmd_pte(pmd))
929955 #define pmd_savedwrite(pmd) pte_savedwrite(pmd_pte(pmd))
930956
931957 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -982,11 +1008,10 @@ static inline int __pmdp_test_and_clear_young(struct mm_struct *mm, · 50 unmodified lines
9821008 static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr,
9831009 pmd_t *pmdp)
9841010 {
985−
986− if ((pmd_raw(*pmdp) & cpu_to_be64(_PAGE_WRITE)) == 0)
987− return;
988−
989− pmd_hugepage_update(mm, addr, pmdp, _PAGE_WRITE, 0);
1011+ if (__pmd_write((*pmdp)))
1012+ pmd_hugepage_update(mm, addr, pmdp, _PAGE_WRITE, 0);
1013+ else if (unlikely(pmd_savedwrite(*pmdp)))
1014+ pmd_hugepage_update(mm, addr, pmdp, 0, _PAGE_PRIVILEGED);
9901015 }
9911016
9921017 static inline int pmd_trans_huge(pmd_t pmd)
arch/powerpc/kvm/book3s_64_mmu_hv.c+1−1
@@ -601,7 +601,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu, · 600 unmodified lines
601601 hva, NULL, NULL);
602602 if (ptep) {
603603 pte = kvmppc_read_update_linux_pte(ptep, 1);
604− if (pte_write(pte))
604+ if (__pte_write(pte))
605605 write_ok = 1;
606606 }
607607 local_irq_restore(flags);
arch/powerpc/kvm/book3s_hv_rm_mmu.c+1−1
@@ -256,7 +256,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags, · 255 unmodified lines
256256 }
257257 pte = kvmppc_read_update_linux_pte(ptep, writing);
258258 if (pte_present(pte) && !pte_protnone(pte)) {
259− if (writing && !pte_write(pte))
259+ if (writing && !__pte_write(pte))
260260 /* make the actual HPTE be read-only */
261261 ptel = hpte_make_readonly(ptel);
262262 is_ci = pte_ci(pte);
arch/sh/boards/mach-cayman/setup.c+0−2
@@ -128,7 +128,6 @@ static int __init smsc_superio_setup(void) · 127 unmodified lines
128128 SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_PRIMARY_INT_INDEX);
129129 SMSC_SUPERIO_WRITE_INDEXED(12, SMSC_SECONDARY_INT_INDEX);
130130
131−#ifdef CONFIG_IDE
132131 /*
133132 * Only IDE1 exists on the Cayman
134133 */
@@ -158,7 +157,6 @@ static int __init smsc_superio_setup(void) · 23 unmodified lines
158157 SMSC_SUPERIO_WRITE_INDEXED(0x01, 0xc5); /* GP45 = IDE1_IRQ */
159158 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc6); /* GP46 = nIOROP */
160159 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */
161−#endif
162160
163161 /* Exit the configuration state */
164162 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
arch/x86/kernel/ftrace.c+1−1
@@ -535,7 +535,7 @@ static void run_sync(void) · 534 unmodified lines
535535 {
536536 int enable_irqs = irqs_disabled();
537537
538− /* We may be called with interrupts disbled (on bootup). */
538+ /* We may be called with interrupts disabled (on bootup). */
539539 if (enable_irqs)
540540 local_irq_enable();
541541 on_each_cpu(do_sync_core, NULL, 1);
arch/x86/mm/gup.c+21−16
@@ -106,32 +106,35 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr, · 105 unmodified lines
106106 unsigned long end, int write, struct page **pages, int *nr)
107107 {
108108 struct dev_pagemap *pgmap = NULL;
109− int nr_start = *nr;
110− pte_t *ptep;
109+ int nr_start = *nr, ret = 0;
110+ pte_t *ptep, *ptem;
111111
112− ptep = pte_offset_map(&pmd, addr);
112+ /*
113+ * Keep the original mapped PTE value (ptem) around since we
114+ * might increment ptep off the end of the page when finishing
115+ * our loop iteration.
116+ */
117+ ptem = ptep = pte_offset_map(&pmd, addr);
113118 do {
114119 pte_t pte = gup_get_pte(ptep);
115120 struct page *page;
116121
117122 /* Similar to the PMD case, NUMA hinting must take slow path */
118− if (pte_protnone(pte)) {
119− pte_unmap(ptep);
120− return 0;
121− }
123+ if (pte_protnone(pte))
124+ break;
125+
126+ if (!pte_allows_gup(pte_val(pte), write))
127+ break;
122128
123129 if (pte_devmap(pte)) {
124130 pgmap = get_dev_pagemap(pte_pfn(pte), pgmap);
125131 if (unlikely(!pgmap)) {
126132 undo_dev_pagemap(nr, nr_start, pages);
127− pte_unmap(ptep);
128− return 0;
133+ break;
129134 }
130− } else if (!pte_allows_gup(pte_val(pte), write) ||
131− pte_special(pte)) {
132− pte_unmap(ptep);
133− return 0;
134− }
135+ } else if (pte_special(pte))
136+ break;
137+
135138 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
136139 page = pte_page(pte);
137140 get_page(page);
@@ -141,9 +144,11 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr, · 3 unmodified lines
141144 (*nr)++;
142145
143146 } while (ptep++, addr += PAGE_SIZE, addr != end);
144− pte_unmap(ptep - 1);
147+ if (addr == end)
148+ ret = 1;
149+ pte_unmap(ptem);
145150
146− return 1;
151+ return ret;
147152 }
148153
149154 static inline void get_head_page_multiple(struct page *page, int nr)
drivers/block/paride/pcd.c+1−1
@@ -50,7 +50,7 @@ · 49 unmodified lines
5050 the slower the port i/o. In some cases, setting
5151 this to zero will speed up the device. (default -1)
5252
53− major You may use this parameter to overide the
53+ major You may use this parameter to override the
5454 default major number (46) that this driver
5555 will use. Be sure to change the device
5656 name as well.
drivers/block/paride/pd.c+1−1
@@ -61,7 +61,7 @@ · 60 unmodified lines
6161 first drive found.
6262
6363
64− major You may use this parameter to overide the
64+ major You may use this parameter to override the
6565 default major number (45) that this driver
6666 will use. Be sure to change the device
6767 name as well.
drivers/block/paride/pf.c+1−1
@@ -59,7 +59,7 @@ · 58 unmodified lines
5959 the slower the port i/o. In some cases, setting
6060 this to zero will speed up the device. (default -1)
6161
62− major You may use this parameter to overide the
62+ major You may use this parameter to override the
6363 default major number (47) that this driver
6464 will use. Be sure to change the device
6565 name as well.
drivers/block/paride/pg.c+1−1
@@ -84,7 +84,7 @@ · 83 unmodified lines
8484 the slower the port i/o. In some cases, setting
8585 this to zero will speed up the device. (default -1)
8686
87− major You may use this parameter to overide the
87+ major You may use this parameter to override the
8888 default major number (97) that this driver
8989 will use. Be sure to change the device
9090 name as well.
drivers/block/paride/pt.c+1−1
@@ -61,7 +61,7 @@ · 60 unmodified lines
6161 the slower the port i/o. In some cases, setting
6262 this to zero will speed up the device. (default -1)
6363
64− major You may use this parameter to overide the
64+ major You may use this parameter to override the
6565 default major number (96) that this driver
6666 will use. Be sure to change the device
6767 name as well.
drivers/crypto/ux500/cryp/cryp.c+1−1
@@ -82,7 +82,7 @@ void cryp_activity(struct cryp_device_data *device_data, · 81 unmodified lines
8282 void cryp_flush_inoutfifo(struct cryp_device_data *device_data)
8383 {
8484 /*
85− * We always need to disble the hardware before trying to flush the
85+ * We always need to disable the hardware before trying to flush the
8686 * FIFO. This is something that isn't written in the design
8787 * specification, but we have been informed by the hardware designers
8888 * that this must be done.
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c+1−1
@@ -788,7 +788,7 @@ static int sdma_v3_0_start(struct amdgpu_device *adev) · 787 unmodified lines
788788 }
789789 }
790790
791− /* disble sdma engine before programing it */
791+ /* disable sdma engine before programing it */
792792 sdma_v3_0_ctx_switch_enable(adev, false);
793793 sdma_v3_0_enable(adev, false);
794794
drivers/hv/channel.c+1−1
@@ -543,7 +543,7 @@ static int vmbus_close_internal(struct vmbus_channel *channel) · 542 unmodified lines
543543 /*
544544 * In case a device driver's probe() fails (e.g.,
545545 * util_probe() -> vmbus_open() returns -ENOMEM) and the device is
546− * rescinded later (e.g., we dynamically disble an Integrated Service
546+ * rescinded later (e.g., we dynamically disable an Integrated Service
547547 * in Hyper-V Manager), the driver's remove() invokes vmbus_close():
548548 * here we should skip most of the below cleanup work.
549549 */
drivers/isdn/hisax/st5481_b.c+1−1
@@ -239,7 +239,7 @@ static void st5481B_mode(struct st5481_bcs *bcs, int mode) · 238 unmodified lines
239239 }
240240 }
241241 } else {
242− // Disble B channel interrupts
242+ // Disable B channel interrupts
243243 st5481_usb_device_ctrl_msg(adapter, FFMSK_B1+(bcs->channel * 2), 0, NULL, NULL);
244244
245245 // Disable B channel FIFOs
drivers/md/bcache/util.h+0−1
@@ -4,7 +4,6 @@ · 3 unmodified lines
44
55 #include <linux/blkdev.h>
66 #include <linux/errno.h>
7−#include <linux/blkdev.h>
87 #include <linux/kernel.h>
98 #include <linux/sched/clock.h>
109 #include <linux/llist.h>
drivers/media/dvb-frontends/drx39xyj/drx_driver.h+3−5
@@ -256,8 +256,7 @@ int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner, · 255 unmodified lines
256256 *
257257 * The actual DAP implementation may be restricted to only one of the modes.
258258 * A compiler warning or error will be generated if the DAP implementation
259−* overides or cannot handle the mode defined below.
260−*
259+* overrides or cannot handle the mode defined below.
261260 */
262261 #ifndef DRXDAP_SINGLE_MASTER
263262 #define DRXDAP_SINGLE_MASTER 1
@@ -272,7 +271,7 @@ int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner, · 8 unmodified lines
272271 *
273272 * This maximum size may be restricted by the actual DAP implementation.
274273 * A compiler warning or error will be generated if the DAP implementation
275−* overides or cannot handle the chunksize defined below.
274+* overrides or cannot handle the chunksize defined below.
276275 *
277276 * Beware that the DAP uses DRXDAP_MAX_WCHUNKSIZE to create a temporary data
278277 * buffer. Do not undefine or choose too large, unless your system is able to
@@ -292,8 +291,7 @@ int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner, · 13 unmodified lines
292291 *
293292 * This maximum size may be restricted by the actual DAP implementation.
294293 * A compiler warning or error will be generated if the DAP implementation
295−* overides or cannot handle the chunksize defined below.
296−*
294+* overrides or cannot handle the chunksize defined below.
297295 */
298296 #ifndef DRXDAP_MAX_RCHUNKSIZE
299297 #define DRXDAP_MAX_RCHUNKSIZE 60
drivers/mtd/spi-nor/spi-nor.c+1−1
@@ -186,7 +186,7 @@ static inline int write_enable(struct spi_nor *nor) · 185 unmodified lines
186186 }
187187
188188 /*
189− * Send write disble instruction to the chip.
189+ * Send write disable instruction to the chip.
190190 */
191191 static inline int write_disable(struct spi_nor *nor)
192192 {
drivers/net/ethernet/qlogic/qlge/qlge.h+2−2
@@ -1162,8 +1162,8 @@ struct ob_mac_tso_iocb_rsp { · 1161 unmodified lines
11621162 struct ib_mac_iocb_rsp {
11631163 u8 opcode; /* 0x20 */
11641164 u8 flags1;
1165−#define IB_MAC_IOCB_RSP_OI 0x01 /* Overide intr delay */
1166−#define IB_MAC_IOCB_RSP_I 0x02 /* Disble Intr Generation */
1165+#define IB_MAC_IOCB_RSP_OI 0x01 /* Override intr delay */
1166+#define IB_MAC_IOCB_RSP_I 0x02 /* Disable Intr Generation */
11671167 #define IB_MAC_CSUM_ERR_MASK 0x1c /* A mask to use for csum errs */
11681168 #define IB_MAC_IOCB_RSP_TE 0x04 /* Checksum error */
11691169 #define IB_MAC_IOCB_RSP_NU 0x08 /* No checksum rcvd */
drivers/scsi/aic7xxx/aic79xx_core.c+1−1
@@ -6278,7 +6278,7 @@ ahd_reset(struct ahd_softc *ahd, int reinit) · 6277 unmodified lines
62786278 * does not disable its parity logic prior to
62796279 * the start of the reset. This may cause a
62806280 * parity error to be detected and thus a
6281− * spurious SERR or PERR assertion. Disble
6281+ * spurious SERR or PERR assertion. Disable
62826282 * PERR and SERR responses during the CHIPRST.
62836283 */
62846284 mod_cmd = cmd & ~(PCIM_CMD_PERRESPEN|PCIM_CMD_SERRESPEN);
drivers/usb/gadget/legacy/inode.c+1−2
@@ -84,8 +84,7 @@ static int ep_open(struct inode *, struct file *); · 83 unmodified lines
8484
8585 /* /dev/gadget/$CHIP represents ep0 and the whole device */
8686 enum ep0_state {
87− /* DISBLED is the initial state.
88− */
87+ /* DISABLED is the initial state. */
8988 STATE_DEV_DISABLED = 0,
9089
9190 /* Only one open() of /dev/gadget/$CHIP; only one file tracks
drivers/usb/host/xhci.c+2−2
@@ -868,7 +868,7 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) · 867 unmodified lines
868868
869869 spin_lock_irqsave(&xhci->lock, flags);
870870
871− /* disble usb3 ports Wake bits*/
871+ /* disable usb3 ports Wake bits */
872872 port_index = xhci->num_usb3_ports;
873873 port_array = xhci->usb3_ports;
874874 while (port_index--) {
@@ -879,7 +879,7 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) · 4 unmodified lines
879879 writel(t2, port_array[port_index]);
880880 }
881881
882− /* disble usb2 ports Wake bits*/
882+ /* disable usb2 ports Wake bits */
883883 port_index = xhci->num_usb2_ports;
884884 port_array = xhci->usb2_ports;
885885 while (port_index--) {
fs/fat/inode.c+12−1
@@ -1359,6 +1359,16 @@ out: · 1358 unmodified lines
13591359 return 0;
13601360 }
13611361
1362+static void fat_dummy_inode_init(struct inode *inode)
1363+{
1364+ /* Initialize this dummy inode to work as no-op. */
1365+ MSDOS_I(inode)->mmu_private = 0;
1366+ MSDOS_I(inode)->i_start = 0;
1367+ MSDOS_I(inode)->i_logstart = 0;
1368+ MSDOS_I(inode)->i_attrs = 0;
1369+ MSDOS_I(inode)->i_pos = 0;
1370+}
1371+
13621372 static int fat_read_root(struct inode *inode)
13631373 {
13641374 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
@@ -1803,12 +1813,13 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, · 438 unmodified lines
18031813 fat_inode = new_inode(sb);
18041814 if (!fat_inode)
18051815 goto out_fail;
1806− MSDOS_I(fat_inode)->i_pos = 0;
1816+ fat_dummy_inode_init(fat_inode);
18071817 sbi->fat_inode = fat_inode;
18081818
18091819 fsinfo_inode = new_inode(sb);
18101820 if (!fsinfo_inode)
18111821 goto out_fail;
1822+ fat_dummy_inode_init(fsinfo_inode);
18121823 fsinfo_inode->i_ino = MSDOS_FSINFO_INO;
18131824 sbi->fsinfo_inode = fsinfo_inode;
18141825 insert_inode_hash(fsinfo_inode);
fs/userfaultfd.c+21−48
@@ -138,8 +138,6 @@ out: · 137 unmodified lines
138138 * userfaultfd_ctx_get - Acquires a reference to the internal userfaultfd
139139 * context.
140140 * @ctx: [in] Pointer to the userfaultfd context.
141− *
142− * Returns: In case of success, returns not zero.
143141 */
144142 static void userfaultfd_ctx_get(struct userfaultfd_ctx *ctx)
145143 {
@@ -490,7 +488,7 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason) · 344 unmodified lines
490488 * in such case.
491489 */
492490 down_read(&mm->mmap_sem);
493− ret = 0;
491+ ret = VM_FAULT_NOPAGE;
494492 }
495493 }
496494
@@ -527,10 +525,11 @@ out: · 30 unmodified lines
527525 return ret;
528526 }
529527
530−static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
531− struct userfaultfd_wait_queue *ewq)
528+static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
529+ struct userfaultfd_wait_queue *ewq)
532530 {
533− int ret = 0;
531+ if (WARN_ON_ONCE(current->flags & PF_EXITING))
532+ goto out;
534533
535534 ewq->ctx = ctx;
536535 init_waitqueue_entry(&ewq->wq, current);
@@ -547,8 +546,16 @@ static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, · 10 unmodified lines
547546 break;
548547 if (ACCESS_ONCE(ctx->released) ||
549548 fatal_signal_pending(current)) {
550− ret = -1;
551549 __remove_wait_queue(&ctx->event_wqh, &ewq->wq);
550+ if (ewq->msg.event == UFFD_EVENT_FORK) {
551+ struct userfaultfd_ctx *new;
552+
553+ new = (struct userfaultfd_ctx *)
554+ (unsigned long)
555+ ewq->msg.arg.reserved.reserved1;
556+
557+ userfaultfd_ctx_put(new);
558+ }
552559 break;
553560 }
554561
@@ -566,9 +573,8 @@ static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, · 11 unmodified lines
566573 * ctx may go away after this if the userfault pseudo fd is
567574 * already released.
568575 */
569−
576+out:
570577 userfaultfd_ctx_put(ctx);
571− return ret;
572578 }
573579
574580 static void userfaultfd_event_complete(struct userfaultfd_ctx *ctx,
@@ -626,7 +632,7 @@ int dup_userfaultfd(struct vm_area_struct *vma, struct list_head *fcs) · 51 unmodified lines
626632 return 0;
627633 }
628634
629−static int dup_fctx(struct userfaultfd_fork_ctx *fctx)
635+static void dup_fctx(struct userfaultfd_fork_ctx *fctx)
630636 {
631637 struct userfaultfd_ctx *ctx = fctx->orig;
632638 struct userfaultfd_wait_queue ewq;
@@ -636,17 +642,15 @@ static int dup_fctx(struct userfaultfd_fork_ctx *fctx) · 3 unmodified lines
636642 ewq.msg.event = UFFD_EVENT_FORK;
637643 ewq.msg.arg.reserved.reserved1 = (unsigned long)fctx->new;
638644
639− return userfaultfd_event_wait_completion(ctx, &ewq);
645+ userfaultfd_event_wait_completion(ctx, &ewq);
640646 }
641647
642648 void dup_userfaultfd_complete(struct list_head *fcs)
643649 {
644− int ret = 0;
645650 struct userfaultfd_fork_ctx *fctx, *n;
646651
647652 list_for_each_entry_safe(fctx, n, fcs, list) {
648− if (!ret)
649− ret = dup_fctx(fctx);
653+ dup_fctx(fctx);
650654 list_del(&fctx->list);
651655 kfree(fctx);
652656 }
@@ -689,8 +693,7 @@ void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *vm_ctx, · 36 unmodified lines
689693 userfaultfd_event_wait_completion(ctx, &ewq);
690694 }
691695
692−void userfaultfd_remove(struct vm_area_struct *vma,
693− struct vm_area_struct **prev,
696+bool userfaultfd_remove(struct vm_area_struct *vma,
694697 unsigned long start, unsigned long end)
695698 {
696699 struct mm_struct *mm = vma->vm_mm;
@@ -699,13 +702,11 @@ void userfaultfd_remove(struct vm_area_struct *vma, · 2 unmodified lines
699702
700703 ctx = vma->vm_userfaultfd_ctx.ctx;
701704 if (!ctx || !(ctx->features & UFFD_FEATURE_EVENT_REMOVE))
702− return;
705+ return true;
703706
704707 userfaultfd_ctx_get(ctx);
705708 up_read(&mm->mmap_sem);
706709
707− *prev = NULL; /* We wait for ACK w/o the mmap semaphore */
708−
709710 msg_init(&ewq.msg);
710711
711712 ewq.msg.event = UFFD_EVENT_REMOVE;
@@ -714,7 +715,7 @@ void userfaultfd_remove(struct vm_area_struct *vma, · 2 unmodified lines
714715
715716 userfaultfd_event_wait_completion(ctx, &ewq);
716717
717− down_read(&mm->mmap_sem);
718+ return false;
718719 }
719720
720721 static bool has_unmap_ctx(struct userfaultfd_ctx *ctx, struct list_head *unmaps,
@@ -775,34 +776,6 @@ void userfaultfd_unmap_complete(struct mm_struct *mm, struct list_head *uf) · 54 unmodified lines
775776 }
776777 }
777778
778−void userfaultfd_exit(struct mm_struct *mm)
779−{
780− struct vm_area_struct *vma = mm->mmap;
781−
782− /*
783− * We can do the vma walk without locking because the caller
784− * (exit_mm) knows it now has exclusive access
785− */
786− while (vma) {
787− struct userfaultfd_ctx *ctx = vma->vm_userfaultfd_ctx.ctx;
788−
789− if (ctx && (ctx->features & UFFD_FEATURE_EVENT_EXIT)) {
790− struct userfaultfd_wait_queue ewq;
791−
792− userfaultfd_ctx_get(ctx);
793−
794− msg_init(&ewq.msg);
795− ewq.msg.event = UFFD_EVENT_EXIT;
796−
797− userfaultfd_event_wait_completion(ctx, &ewq);
798−
799− ctx->features &= ~UFFD_FEATURE_EVENT_EXIT;
800− }
801−
802− vma = vma->vm_next;
803− }
804−}
805−
806779 static int userfaultfd_release(struct inode *inode, struct file *file)
807780 {
808781 struct userfaultfd_ctx *ctx = file->private_data;
include/dt-bindings/sound/cs42l42.h+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 #define CS42L42_HPOUT_LOAD_1NF 0
2121 #define CS42L42_HPOUT_LOAD_10NF 1
2222
23−/* HPOUT Clamp to GND Overide */
23+/* HPOUT Clamp to GND Override */
2424 #define CS42L42_HPOUT_CLAMP_EN 0
2525 #define CS42L42_HPOUT_CLAMP_DIS 1
2626
include/linux/fs.h+1−1
@@ -2678,7 +2678,7 @@ static const char * const kernel_read_file_str[] = { · 2677 unmodified lines
26782678
26792679 static inline const char *kernel_read_file_id_str(enum kernel_read_file_id id)
26802680 {
2681− if (id < 0 || id >= READING_MAX_ID)
2681+ if ((unsigned)id >= READING_MAX_ID)
26822682 return kernel_read_file_str[READING_UNKNOWN];
26832683
26842684 return kernel_read_file_str[id];
include/linux/regulator/machine.h+1−1
@@ -65,7 +65,7 @@ struct regulator_state { · 64 unmodified lines
6565 int uV; /* suspend voltage */
6666 unsigned int mode; /* suspend regulator operating mode */
6767 int enabled; /* is regulator enabled in this suspend state */
68− int disabled; /* is the regulator disbled in this suspend state */
68+ int disabled; /* is the regulator disabled in this suspend state */
6969 };
7070
7171 /**
include/linux/userfaultfd_k.h+3−10
@@ -61,8 +61,7 @@ extern void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *, · 60 unmodified lines
6161 unsigned long from, unsigned long to,
6262 unsigned long len);
6363
64−extern void userfaultfd_remove(struct vm_area_struct *vma,
65− struct vm_area_struct **prev,
64+extern bool userfaultfd_remove(struct vm_area_struct *vma,
6665 unsigned long start,
6766 unsigned long end);
6867
@@ -72,8 +71,6 @@ extern int userfaultfd_unmap_prep(struct vm_area_struct *vma, · 3 unmodified lines
7271 extern void userfaultfd_unmap_complete(struct mm_struct *mm,
7372 struct list_head *uf);
7473
75−extern void userfaultfd_exit(struct mm_struct *mm);
76−
7774 #else /* CONFIG_USERFAULTFD */
7875
7976 /* mm helpers */
@@ -120,11 +117,11 @@ static inline void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *ctx, · 40 unmodified lines
120117 {
121118 }
122119
123−static inline void userfaultfd_remove(struct vm_area_struct *vma,
124− struct vm_area_struct **prev,
120+static inline bool userfaultfd_remove(struct vm_area_struct *vma,
125121 unsigned long start,
126122 unsigned long end)
127123 {
124+ return true;
128125 }
129126
130127 static inline int userfaultfd_unmap_prep(struct vm_area_struct *vma,
@@ -139,10 +136,6 @@ static inline void userfaultfd_unmap_complete(struct mm_struct *mm, · 8 unmodified lines
139136 {
140137 }
141138
142−static inline void userfaultfd_exit(struct mm_struct *mm)
143−{
144−}
145−
146139 #endif /* CONFIG_USERFAULTFD */
147140
148141 #endif /* _LINUX_USERFAULTFD_K_H */
include/linux/vm_event_item.h+3−0
@@ -79,6 +79,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, · 78 unmodified lines
7979 THP_SPLIT_PAGE_FAILED,
8080 THP_DEFERRED_SPLIT_PAGE,
8181 THP_SPLIT_PMD,
82+#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
83+ THP_SPLIT_PUD,
84+#endif
8285 THP_ZERO_PAGE_ALLOC,
8386 THP_ZERO_PAGE_ALLOC_FAILED,
8487 #endif
include/net/irda/timer.h+1−1
@@ -59,7 +59,7 @@ struct lap_cb; · 58 unmodified lines
5959 * Slot timer must never exceed 85 ms, and must always be at least 25 ms,
6060 * suggested to 75-85 msec by IrDA lite. This doesn't work with a lot of
6161 * devices, and other stackes uses a lot more, so it's best we do it as well
62− * (Note : this is the default value and sysctl overides it - Jean II)
62+ * (Note : this is the default value and sysctl overrides it - Jean II)
6363 */
6464 #define SLOT_TIMEOUT (90*HZ/1000)
6565
include/uapi/linux/userfaultfd.h+1−4
@@ -18,8 +18,7 @@ · 17 unmodified lines
1818 * means the userland is reading).
1919 */
2020 #define UFFD_API ((__u64)0xAA)
21−#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_EXIT | \
22− UFFD_FEATURE_EVENT_FORK | \
21+#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK | \
2322 UFFD_FEATURE_EVENT_REMAP | \
2423 UFFD_FEATURE_EVENT_REMOVE | \
2524 UFFD_FEATURE_EVENT_UNMAP | \
@@ -113,7 +112,6 @@ struct uffd_msg { · 87 unmodified lines
113112 #define UFFD_EVENT_REMAP 0x14
114113 #define UFFD_EVENT_REMOVE 0x15
115114 #define UFFD_EVENT_UNMAP 0x16
116−#define UFFD_EVENT_EXIT 0x17
117115
118116 /* flags for UFFD_EVENT_PAGEFAULT */
119117 #define UFFD_PAGEFAULT_FLAG_WRITE (1<<0) /* If this was a write fault */
@@ -163,7 +161,6 @@ struct uffdio_api { · 43 unmodified lines
163161 #define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4)
164162 #define UFFD_FEATURE_MISSING_SHMEM (1<<5)
165163 #define UFFD_FEATURE_EVENT_UNMAP (1<<6)
166−#define UFFD_FEATURE_EVENT_EXIT (1<<7)
167164 __u64 features;
168165
169166 __u64 ioctls;
kernel/cgroup/cgroup.c+1−1
@@ -2669,7 +2669,7 @@ static bool css_visible(struct cgroup_subsys_state *css) · 2668 unmodified lines
26692669 *
26702670 * Returns 0 on success, -errno on failure. On failure, csses which have
26712671 * been processed already aren't cleaned up. The caller is responsible for
2672− * cleaning up with cgroup_apply_control_disble().
2672+ * cleaning up with cgroup_apply_control_disable().
26732673 */
26742674 static int cgroup_apply_control_enable(struct cgroup *cgrp)
26752675 {
kernel/events/core.c+1−1
@@ -998,7 +998,7 @@ list_update_cgroup_event(struct perf_event *event, · 997 unmodified lines
998998 */
999999 #define PERF_CPU_HRTIMER (1000 / HZ)
10001000 /*
1001− * function must be called with interrupts disbled
1001+ * function must be called with interrupts disabled
10021002 */
10031003 static enum hrtimer_restart perf_mux_hrtimer_handler(struct hrtimer *hr)
10041004 {
kernel/exit.c+0−1
@@ -554,7 +554,6 @@ static void exit_mm(void) · 553 unmodified lines
554554 enter_lazy_tlb(mm, current);
555555 task_unlock(current);
556556 mm_update_next_owner(mm);
557− userfaultfd_exit(mm);
558557 mmput(mm);
559558 if (test_thread_flag(TIF_MEMDIE))
560559 exit_oom_victim();
kernel/trace/trace_stack.c+1−1
@@ -65,7 +65,7 @@ void stack_trace_print(void) · 64 unmodified lines
6565 }
6666
6767 /*
68− * When arch-specific code overides this function, the following
68+ * When arch-specific code overrides this function, the following
6969 * data should be filled up, assuming stack_trace_max_lock is held to
7070 * prevent concurrent updates.
7171 * stack_trace_index[]
mm/huge_memory.c+1−1
@@ -1828,7 +1828,7 @@ static void __split_huge_pud_locked(struct vm_area_struct *vma, pud_t *pud, · 1827 unmodified lines
18281828 VM_BUG_ON_VMA(vma->vm_end < haddr + HPAGE_PUD_SIZE, vma);
18291829 VM_BUG_ON(!pud_trans_huge(*pud) && !pud_devmap(*pud));
18301830
1831− count_vm_event(THP_SPLIT_PMD);
1831+ count_vm_event(THP_SPLIT_PUD);
18321832
18331833 pudp_huge_clear_flush_notify(vma, haddr, pud);
18341834 }
mm/kasan/quarantine.c+44−7
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <linux/printk.h>
2626 #include <linux/shrinker.h>
2727 #include <linux/slab.h>
28+#include <linux/srcu.h>
2829 #include <linux/string.h>
2930 #include <linux/types.h>
3031
@@ -103,6 +104,7 @@ static int quarantine_tail; · 72 unmodified lines
103104 /* Total size of all objects in global_quarantine across all batches. */
104105 static unsigned long quarantine_size;
105106 static DEFINE_SPINLOCK(quarantine_lock);
107+DEFINE_STATIC_SRCU(remove_cache_srcu);
106108
107109 /* Maximum size of the global queue. */
108110 static unsigned long quarantine_max_size;
@@ -173,17 +175,22 @@ void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache) · 64 unmodified lines
173175 struct qlist_head *q;
174176 struct qlist_head temp = QLIST_INIT;
175177
178+ /*
179+ * Note: irq must be disabled until after we move the batch to the
180+ * global quarantine. Otherwise quarantine_remove_cache() can miss
181+ * some objects belonging to the cache if they are in our local temp
182+ * list. quarantine_remove_cache() executes on_each_cpu() at the
183+ * beginning which ensures that it either sees the objects in per-cpu
184+ * lists or in the global quarantine.
185+ */
176186 local_irq_save(flags);
177187
178188 q = this_cpu_ptr(&cpu_quarantine);
179189 qlist_put(q, &info->quarantine_link, cache->size);
180− if (unlikely(q->bytes > QUARANTINE_PERCPU_SIZE))
190+ if (unlikely(q->bytes > QUARANTINE_PERCPU_SIZE)) {
181191 qlist_move_all(q, &temp);
182192
183− local_irq_restore(flags);
184−
185− if (unlikely(!qlist_empty(&temp))) {
186− spin_lock_irqsave(&quarantine_lock, flags);
193+ spin_lock(&quarantine_lock);
187194 WRITE_ONCE(quarantine_size, quarantine_size + temp.bytes);
188195 qlist_move_all(&temp, &global_quarantine[quarantine_tail]);
189196 if (global_quarantine[quarantine_tail].bytes >=
@@ -196,20 +203,33 @@ void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache) · 6 unmodified lines
196203 if (new_tail != quarantine_head)
197204 quarantine_tail = new_tail;
198205 }
199− spin_unlock_irqrestore(&quarantine_lock, flags);
206+ spin_unlock(&quarantine_lock);
200207 }
208+
209+ local_irq_restore(flags);
201210 }
202211
203212 void quarantine_reduce(void)
204213 {
205214 size_t total_size, new_quarantine_size, percpu_quarantines;
206215 unsigned long flags;
216+ int srcu_idx;
207217 struct qlist_head to_free = QLIST_INIT;
208218
209219 if (likely(READ_ONCE(quarantine_size) <=
210220 READ_ONCE(quarantine_max_size)))
211221 return;
212222
223+ /*
224+ * srcu critical section ensures that quarantine_remove_cache()
225+ * will not miss objects belonging to the cache while they are in our
226+ * local to_free list. srcu is chosen because (1) it gives us private
227+ * grace period domain that does not interfere with anything else,
228+ * and (2) it allows synchronize_srcu() to return without waiting
229+ * if there are no pending read critical sections (which is the
230+ * expected case).
231+ */
232+ srcu_idx = srcu_read_lock(&remove_cache_srcu);
213233 spin_lock_irqsave(&quarantine_lock, flags);
214234
215235 /*
@@ -237,6 +257,7 @@ void quarantine_reduce(void) · 21 unmodified lines
237257 spin_unlock_irqrestore(&quarantine_lock, flags);
238258
239259 qlist_free_all(&to_free, NULL);
260+ srcu_read_unlock(&remove_cache_srcu, srcu_idx);
240261 }
241262
242263 static void qlist_move_cache(struct qlist_head *from,
@@ -280,12 +301,28 @@ void quarantine_remove_cache(struct kmem_cache *cache) · 37 unmodified lines
280301 unsigned long flags, i;
281302 struct qlist_head to_free = QLIST_INIT;
282303
304+ /*
305+ * Must be careful to not miss any objects that are being moved from
306+ * per-cpu list to the global quarantine in quarantine_put(),
307+ * nor objects being freed in quarantine_reduce(). on_each_cpu()
308+ * achieves the first goal, while synchronize_srcu() achieves the
309+ * second.
310+ */
283311 on_each_cpu(per_cpu_remove_cache, cache, 1);
284312
285313 spin_lock_irqsave(&quarantine_lock, flags);
286− for (i = 0; i < QUARANTINE_BATCHES; i++)
314+ for (i = 0; i < QUARANTINE_BATCHES; i++) {
315+ if (qlist_empty(&global_quarantine[i]))
316+ continue;
287317 qlist_move_cache(&global_quarantine[i], &to_free, cache);
318+ /* Scanning whole quarantine can take a while. */
319+ spin_unlock_irqrestore(&quarantine_lock, flags);
320+ cond_resched();
321+ spin_lock_irqsave(&quarantine_lock, flags);
322+ }
288323 spin_unlock_irqrestore(&quarantine_lock, flags);
289324
290325 qlist_free_all(&to_free, cache);
326+
327+ synchronize_srcu(&remove_cache_srcu);
291328 }
mm/madvise.c+41−3
@@ -513,7 +513,43 @@ static long madvise_dontneed(struct vm_area_struct *vma, · 512 unmodified lines
513513 if (!can_madv_dontneed_vma(vma))
514514 return -EINVAL;
515515
516− userfaultfd_remove(vma, prev, start, end);
516+ if (!userfaultfd_remove(vma, start, end)) {
517+ *prev = NULL; /* mmap_sem has been dropped, prev is stale */
518+
519+ down_read(&current->mm->mmap_sem);
520+ vma = find_vma(current->mm, start);
521+ if (!vma)
522+ return -ENOMEM;
523+ if (start < vma->vm_start) {
524+ /*
525+ * This "vma" under revalidation is the one
526+ * with the lowest vma->vm_start where start
527+ * is also < vma->vm_end. If start <
528+ * vma->vm_start it means an hole materialized
529+ * in the user address space within the
530+ * virtual range passed to MADV_DONTNEED.
531+ */
532+ return -ENOMEM;
533+ }
534+ if (!can_madv_dontneed_vma(vma))
535+ return -EINVAL;
536+ if (end > vma->vm_end) {
537+ /*
538+ * Don't fail if end > vma->vm_end. If the old
539+ * vma was splitted while the mmap_sem was
540+ * released the effect of the concurrent
541+ * operation may not cause MADV_DONTNEED to
542+ * have an undefined result. There may be an
543+ * adjacent next vma that we'll walk
544+ * next. userfaultfd_remove() will generate an
545+ * UFFD_EVENT_REMOVE repetition on the
546+ * end-vma->vm_end range, but the manager can
547+ * handle a repetition fine.
548+ */
549+ end = vma->vm_end;
550+ }
551+ VM_WARN_ON(start >= end);
552+ }
517553 zap_page_range(vma, start, end - start);
518554 return 0;
519555 }
@@ -554,8 +590,10 @@ static long madvise_remove(struct vm_area_struct *vma, · 34 unmodified lines
554590 * mmap_sem.
555591 */
556592 get_file(f);
557− userfaultfd_remove(vma, prev, start, end);
558− up_read(&current->mm->mmap_sem);
593+ if (userfaultfd_remove(vma, start, end)) {
594+ /* mmap_sem was not released by userfaultfd_remove() */
595+ up_read(&current->mm->mmap_sem);
596+ }
559597 error = vfs_fallocate(f,
560598 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
561599 offset, end - start);
mm/memblock.c+4−1
@@ -1118,7 +1118,10 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn, · 1117 unmodified lines
11181118 }
11191119 } while (left < right);
11201120
1121− return min(PHYS_PFN(type->regions[right].base), max_pfn);
1121+ if (right == type->cnt)
1122+ return max_pfn;
1123+ else
1124+ return min(PHYS_PFN(type->regions[right].base), max_pfn);
11221125 }
11231126
11241127 /**
mm/memcontrol.c+13−5
@@ -466,6 +466,8 @@ static void mem_cgroup_update_tree(struct mem_cgroup *memcg, struct page *page) · 465 unmodified lines
466466 struct mem_cgroup_tree_per_node *mctz;
467467
468468 mctz = soft_limit_tree_from_page(page);
469+ if (!mctz)
470+ return;
469471 /*
470472 * Necessary to update all ancestors when hierarchy is used.
471473 * because their event counter is not touched.
@@ -503,7 +505,8 @@ static void mem_cgroup_remove_from_trees(struct mem_cgroup *memcg) · 31 unmodified lines
503505 for_each_node(nid) {
504506 mz = mem_cgroup_nodeinfo(memcg, nid);
505507 mctz = soft_limit_tree_node(nid);
506− mem_cgroup_remove_exceeded(mz, mctz);
508+ if (mctz)
509+ mem_cgroup_remove_exceeded(mz, mctz);
507510 }
508511 }
509512
@@ -2558,7 +2561,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, · 2048 unmodified lines
25582561 * is empty. Do it lockless to prevent lock bouncing. Races
25592562 * are acceptable as soft limit is best effort anyway.
25602563 */
2561− if (RB_EMPTY_ROOT(&mctz->rb_root))
2564+ if (!mctz || RB_EMPTY_ROOT(&mctz->rb_root))
25622565 return 0;
25632566
25642567 /*
@@ -4135,17 +4138,22 @@ static void free_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) · 1570 unmodified lines
41354138 kfree(memcg->nodeinfo[node]);
41364139 }
41374140
4138−static void mem_cgroup_free(struct mem_cgroup *memcg)
4141+static void __mem_cgroup_free(struct mem_cgroup *memcg)
41394142 {
41404143 int node;
41414144
4142− memcg_wb_domain_exit(memcg);
41434145 for_each_node(node)
41444146 free_mem_cgroup_per_node_info(memcg, node);
41454147 free_percpu(memcg->stat);
41464148 kfree(memcg);
41474149 }
41484150
4151+static void mem_cgroup_free(struct mem_cgroup *memcg)
4152+{
4153+ memcg_wb_domain_exit(memcg);
4154+ __mem_cgroup_free(memcg);
4155+}
4156+
41494157 static struct mem_cgroup *mem_cgroup_alloc(void)
41504158 {
41514159 struct mem_cgroup *memcg;
@@ -4196,7 +4204,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void) · 44 unmodified lines
41964204 fail:
41974205 if (memcg->id.id > 0)
41984206 idr_remove(&mem_cgroup_idr, memcg->id.id);
4199− mem_cgroup_free(memcg);
4207+ __mem_cgroup_free(memcg);
42004208 return NULL;
42014209 }
42024210
mm/mlock.c+4−5
@@ -442,7 +442,7 @@ void munlock_vma_pages_range(struct vm_area_struct *vma, · 441 unmodified lines
442442
443443 while (start < end) {
444444 struct page *page;
445− unsigned int page_mask;
445+ unsigned int page_mask = 0;
446446 unsigned long page_increm;
447447 struct pagevec pvec;
448448 struct zone *zone;
@@ -456,8 +456,7 @@ void munlock_vma_pages_range(struct vm_area_struct *vma, · 7 unmodified lines
456456 * suits munlock very well (and if somehow an abnormal page
457457 * has sneaked into the range, we won't oops here: great).
458458 */
459− page = follow_page_mask(vma, start, FOLL_GET | FOLL_DUMP,
460− &page_mask);
459+ page = follow_page(vma, start, FOLL_GET | FOLL_DUMP);
461460
462461 if (page && !IS_ERR(page)) {
463462 if (PageTransTail(page)) {
@@ -468,8 +467,8 @@ void munlock_vma_pages_range(struct vm_area_struct *vma, · 4 unmodified lines
468467 /*
469468 * Any THP page found by follow_page_mask() may
470469 * have gotten split before reaching
471− * munlock_vma_page(), so we need to recompute
472− * the page_mask here.
470+ * munlock_vma_page(), so we need to compute
471+ * the page_mask here instead.
473472 */
474473 page_mask = munlock_vma_page(page);
475474 unlock_page(page);
mm/rmap.c+7−6
@@ -1316,12 +1316,6 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, · 1315 unmodified lines
13161316 }
13171317
13181318 while (page_vma_mapped_walk(&pvmw)) {
1319− subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte);
1320− address = pvmw.address;
1321−
1322− /* Unexpected PMD-mapped THP? */
1323− VM_BUG_ON_PAGE(!pvmw.pte, page);
1324−
13251319 /*
13261320 * If the page is mlock()d, we cannot swap it out.
13271321 * If it's recently referenced (perhaps page_referenced
@@ -1345,6 +1339,13 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma, · 17 unmodified lines
13451339 continue;
13461340 }
13471341
1342+ /* Unexpected PMD-mapped THP? */
1343+ VM_BUG_ON_PAGE(!pvmw.pte, page);
1344+
1345+ subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte);
1346+ address = pvmw.address;
1347+
1348+
13481349 if (!(flags & TTU_IGNORE_ACCESS)) {
13491350 if (ptep_clear_flush_young_notify(vma, address,
13501351 pvmw.pte)) {
mm/vmstat.c+3−0
@@ -1065,6 +1065,9 @@ const char * const vmstat_text[] = { · 1064 unmodified lines
10651065 "thp_split_page_failed",
10661066 "thp_deferred_split_page",
10671067 "thp_split_pmd",
1068+#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
1069+ "thp_split_pud",
1070+#endif
10681071 "thp_zero_page_alloc",
10691072 "thp_zero_page_alloc_failed",
10701073 #endif
scripts/spelling.txt+3−0
@@ -372,6 +372,8 @@ disassocation||disassociation · 371 unmodified lines
372372 disapear||disappear
373373 disapeared||disappeared
374374 disappared||disappeared
375+disble||disable
376+disbled||disabled
375377 disconnet||disconnect
376378 discontinous||discontinuous
377379 dispertion||dispersion
@@ -732,6 +734,7 @@ oustanding||outstanding · 354 unmodified lines
732734 overaall||overall
733735 overhread||overhead
734736 overlaping||overlapping
737+overide||override
735738 overrided||overridden
736739 overriden||overridden
737740 overun||overrun
sound/soc/amd/acp-pcm-dma.c+1−1
@@ -89,7 +89,7 @@ static void acp_reg_write(u32 val, void __iomem *acp_mmio, u32 reg) · 88 unmodified lines
8989 writel(val, acp_mmio + (reg * 4));
9090 }
9191
92−/* Configure a given dma channel parameters - enable/disble,
92+/* Configure a given dma channel parameters - enable/disable,
9393 * number of descriptors, priority
9494 */
9595 static void config_acp_dma_channel(void __iomem *acp_mmio, u8 ch_num,
tools/lguest/lguest.c+1−1
@@ -1387,7 +1387,7 @@ static bool pci_data_iowrite(u16 port, u32 mask, u32 val) · 1386 unmodified lines
13871387 /* Allow writing to any other BAR, or expansion ROM */
13881388 iowrite(portoff, val, mask, &d->config_words[reg]);
13891389 return true;
1390− /* We let them overide latency timer and cacheline size */
1390+ /* We let them override latency timer and cacheline size */
13911391 } else if (&d->config_words[reg] == (void *)&d->config.cacheline_size) {
13921392 /* Only let them change the first two fields. */
13931393 if (mask == 0xFFFFFFFF)
tools/lib/bpf/Makefile+1−1
@@ -132,7 +132,7 @@ else · 131 unmodified lines
132132 Q = @
133133 endif
134134
135−# Disable command line variables (CFLAGS) overide from top
135+# Disable command line variables (CFLAGS) override from top
136136 # level Makefile (perf), otherwise build Makefile will get
137137 # the same command line setup.
138138 MAKEOVERRIDES=
tools/lib/traceevent/Makefile+1−1
@@ -135,7 +135,7 @@ else · 134 unmodified lines
135135 Q = @
136136 endif
137137
138−# Disable command line variables (CFLAGS) overide from top
138+# Disable command line variables (CFLAGS) override from top
139139 # level Makefile (perf), otherwise build Makefile will get
140140 # the same command line setup.
141141 MAKEOVERRIDES=
tools/lib/traceevent/event-parse.h+1−1
@@ -140,7 +140,7 @@ struct pevent_plugin_option { · 139 unmodified lines
140140 * struct pevent_plugin_option PEVENT_PLUGIN_OPTIONS[] = {
141141 * {
142142 * .name = "option-name",
143− * .plugin_alias = "overide-file-name", (optional)
143+ * .plugin_alias = "override-file-name", (optional)
144144 * .description = "description of option to show users",
145145 * },
146146 * {
tools/testing/selftests/vm/Makefile+4−0
@@ -1,5 +1,9 @@
11 # Makefile for vm selftests
22
3+ifndef OUTPUT
4+ OUTPUT := $(shell pwd)
5+endif
6+
37 CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
48 LDLIBS = -lrt
59 TEST_GEN_FILES = compaction_test