aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/dev-tools/kcov.rst2
-rw-r--r--Documentation/devicetree/bindings/regulator/ti-abb-regulator.txt2
-rw-r--r--Documentation/vm/userfaultfd.txt4
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c2
-rw-r--r--arch/powerpc/include/asm/book3s/64/pgtable.h85
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c2
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c2
-rw-r--r--arch/sh/boards/mach-cayman/setup.c2
-rw-r--r--arch/x86/kernel/ftrace.c2
-rw-r--r--arch/x86/mm/gup.c37
-rw-r--r--drivers/block/paride/pcd.c2
-rw-r--r--drivers/block/paride/pd.c2
-rw-r--r--drivers/block/paride/pf.c2
-rw-r--r--drivers/block/paride/pg.c2
-rw-r--r--drivers/block/paride/pt.c2
-rw-r--r--drivers/crypto/ux500/cryp/cryp.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c2
-rw-r--r--drivers/hv/channel.c2
-rw-r--r--drivers/isdn/hisax/st5481_b.c2
-rw-r--r--drivers/md/bcache/util.h1
-rw-r--r--drivers/media/dvb-frontends/drx39xyj/drx_driver.h8
-rw-r--r--drivers/mtd/spi-nor/spi-nor.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge.h4
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_core.c2
-rw-r--r--drivers/usb/gadget/legacy/inode.c3
-rw-r--r--drivers/usb/host/xhci.c4
-rw-r--r--fs/fat/inode.c13
-rw-r--r--fs/userfaultfd.c69
-rw-r--r--include/dt-bindings/sound/cs42l42.h2
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/regulator/machine.h2
-rw-r--r--include/linux/userfaultfd_k.h13
-rw-r--r--include/linux/vm_event_item.h3
-rw-r--r--include/net/irda/timer.h2
-rw-r--r--include/uapi/linux/userfaultfd.h5
-rw-r--r--kernel/cgroup/cgroup.c2
-rw-r--r--kernel/events/core.c2
-rw-r--r--kernel/exit.c1
-rw-r--r--kernel/trace/trace_stack.c2
-rw-r--r--mm/huge_memory.c2
-rw-r--r--mm/kasan/quarantine.c51
-rw-r--r--mm/madvise.c44
-rw-r--r--mm/memblock.c5
-rw-r--r--mm/memcontrol.c18
-rw-r--r--mm/mlock.c9
-rw-r--r--mm/rmap.c13
-rw-r--r--mm/vmstat.c3
-rw-r--r--scripts/spelling.txt3
-rw-r--r--sound/soc/amd/acp-pcm-dma.c2
-rw-r--r--tools/lguest/lguest.c2
-rw-r--r--tools/lib/bpf/Makefile2
-rw-r--r--tools/lib/traceevent/Makefile2
-rw-r--r--tools/lib/traceevent/event-parse.h2
-rw-r--r--tools/testing/selftests/vm/Makefile4
54 files changed, 277 insertions, 185 deletions
diff --git a/Documentation/dev-tools/kcov.rst b/Documentation/dev-tools/kcov.rst
index 2c41b713841f..44886c91e112 100644
--- a/Documentation/dev-tools/kcov.rst
+++ b/Documentation/dev-tools/kcov.rst
@@ -10,7 +10,7 @@ Note that kcov does not aim to collect as much coverage as possible. It aims
10to collect more or less stable coverage that is function of syscall inputs. 10to collect more or less stable coverage that is function of syscall inputs.
11To achieve this goal it does not collect coverage in soft/hard interrupts 11To achieve this goal it does not collect coverage in soft/hard interrupts
12and instrumentation of some inherently non-deterministic parts of kernel is 12and instrumentation of some inherently non-deterministic parts of kernel is
13disbled (e.g. scheduler, locking). 13disabled (e.g. scheduler, locking).
14 14
15Usage 15Usage
16----- 16-----
diff --git a/Documentation/devicetree/bindings/regulator/ti-abb-regulator.txt b/Documentation/devicetree/bindings/regulator/ti-abb-regulator.txt
index c3f6546ebac7..6a23ad9ac53a 100644
--- a/Documentation/devicetree/bindings/regulator/ti-abb-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/ti-abb-regulator.txt
@@ -45,7 +45,7 @@ Required Properties:
45Optional Properties: 45Optional Properties:
46- reg-names: In addition to the required properties, the following are optional 46- reg-names: In addition to the required properties, the following are optional
47 - "efuse-address" - Contains efuse base address used to pick up ABB info. 47 - "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.
49 "efuse-address" is required for this. 49 "efuse-address" is required for this.
50- ti,ldovbb-vset-mask - Required if ldo-address is set, mask for LDO override 50- ti,ldovbb-vset-mask - Required if ldo-address is set, mask for LDO override
51 register to provide override vset value. 51 register to provide override vset value.
diff --git a/Documentation/vm/userfaultfd.txt b/Documentation/vm/userfaultfd.txt
index 0e5543a920e5..bb2f945f87ab 100644
--- a/Documentation/vm/userfaultfd.txt
+++ b/Documentation/vm/userfaultfd.txt
@@ -172,10 +172,6 @@ the same read(2) protocol as for the page fault notifications. The
172manager has to explicitly enable these events by setting appropriate 172manager has to explicitly enable these events by setting appropriate
173bits in uffdio_api.features passed to UFFDIO_API ioctl: 173bits in uffdio_api.features passed to UFFDIO_API ioctl:
174 174
175UFFD_FEATURE_EVENT_EXIT - enable notification about exit() of the
176non-cooperative process. When the monitored process exits, the uffd
177manager will get UFFD_EVENT_EXIT.
178
179UFFD_FEATURE_EVENT_FORK - enable userfaultfd hooks for fork(). When 175UFFD_FEATURE_EVENT_FORK - enable userfaultfd hooks for fork(). When
180this feature is enabled, the userfaultfd context of the parent process 176this feature is enabled, the userfaultfd context of the parent process
181is duplicated into the newly created process. The manager receives 177is duplicated into the newly created process. The manager receives
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
index ae6903d7fdbe..14970f11bbf2 100644
--- a/arch/cris/arch-v32/drivers/cryptocop.c
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -2086,7 +2086,7 @@ static void cryptocop_job_queue_close(void)
2086 dma_in_cfg.en = regk_dma_no; 2086 dma_in_cfg.en = regk_dma_no;
2087 REG_WR(dma, IN_DMA_INST, rw_cfg, dma_in_cfg); 2087 REG_WR(dma, IN_DMA_INST, rw_cfg, dma_in_cfg);
2088 2088
2089 /* Disble the cryptocop. */ 2089 /* Disable the cryptocop. */
2090 rw_cfg = REG_RD(strcop, regi_strcop, rw_cfg); 2090 rw_cfg = REG_RD(strcop, regi_strcop, rw_cfg);
2091 rw_cfg.en = 0; 2091 rw_cfg.en = 0;
2092 REG_WR(strcop, regi_strcop, rw_cfg, rw_cfg); 2092 REG_WR(strcop, regi_strcop, rw_cfg, rw_cfg);
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
index 1eeeb72c7015..ec1e731e6a2d 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -347,23 +347,58 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
347 __r; \ 347 __r; \
348}) 348})
349 349
350static 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
357static 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
370static inline bool pte_savedwrite(pte_t pte)
371{
372 return false;
373}
374#endif
375
376static inline int pte_write(pte_t pte)
377{
378 return __pte_write(pte) || pte_savedwrite(pte);
379}
380
350#define __HAVE_ARCH_PTEP_SET_WRPROTECT 381#define __HAVE_ARCH_PTEP_SET_WRPROTECT
351static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, 382static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
352 pte_t *ptep) 383 pte_t *ptep)
353{ 384{
354 if ((pte_raw(*ptep) & cpu_to_be64(_PAGE_WRITE)) == 0) 385 if (__pte_write(*ptep))
355 return; 386 pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 0);
356 387 else if (unlikely(pte_savedwrite(*ptep)))
357 pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 0); 388 pte_update(mm, addr, ptep, 0, _PAGE_PRIVILEGED, 0);
358} 389}
359 390
360static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, 391static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
361 unsigned long addr, pte_t *ptep) 392 unsigned long addr, pte_t *ptep)
362{ 393{
363 if ((pte_raw(*ptep) & cpu_to_be64(_PAGE_WRITE)) == 0) 394 /*
364 return; 395 * We should not find protnone for hugetlb, but this complete the
365 396 * interface.
366 pte_update(mm, addr, ptep, _PAGE_WRITE, 0, 1); 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);
367} 402}
368 403
369#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 404#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
@@ -397,11 +432,6 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
397 pte_update(mm, addr, ptep, ~0UL, 0, 0); 432 pte_update(mm, addr, ptep, ~0UL, 0, 0);
398} 433}
399 434
400static inline int pte_write(pte_t pte)
401{
402 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_WRITE));
403}
404
405static inline int pte_dirty(pte_t pte) 435static inline int pte_dirty(pte_t pte)
406{ 436{
407 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_DIRTY)); 437 return !!(pte_raw(pte) & cpu_to_be64(_PAGE_DIRTY));
@@ -465,19 +495,12 @@ static inline pte_t pte_clear_savedwrite(pte_t pte)
465 VM_BUG_ON(!pte_protnone(pte)); 495 VM_BUG_ON(!pte_protnone(pte));
466 return __pte(pte_val(pte) | _PAGE_PRIVILEGED); 496 return __pte(pte_val(pte) | _PAGE_PRIVILEGED);
467} 497}
468 498#else
469#define pte_savedwrite pte_savedwrite 499#define pte_clear_savedwrite pte_clear_savedwrite
470static inline bool pte_savedwrite(pte_t pte) 500static inline pte_t pte_clear_savedwrite(pte_t pte)
471{ 501{
472 /* 502 VM_WARN_ON(1);
473 * Saved write ptes are prot none ptes that doesn't have 503 return __pte(pte_val(pte) & ~_PAGE_WRITE);
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));
481} 504}
482#endif /* CONFIG_NUMA_BALANCING */ 505#endif /* CONFIG_NUMA_BALANCING */
483 506
@@ -506,6 +529,8 @@ static inline unsigned long pte_pfn(pte_t pte)
506/* Generic modifiers for PTE bits */ 529/* Generic modifiers for PTE bits */
507static inline pte_t pte_wrprotect(pte_t pte) 530static inline pte_t pte_wrprotect(pte_t pte)
508{ 531{
532 if (unlikely(pte_savedwrite(pte)))
533 return pte_clear_savedwrite(pte);
509 return __pte(pte_val(pte) & ~_PAGE_WRITE); 534 return __pte(pte_val(pte) & ~_PAGE_WRITE);
510} 535}
511 536
@@ -926,6 +951,7 @@ static inline int pmd_protnone(pmd_t pmd)
926 951
927#define __HAVE_ARCH_PMD_WRITE 952#define __HAVE_ARCH_PMD_WRITE
928#define pmd_write(pmd) pte_write(pmd_pte(pmd)) 953#define pmd_write(pmd) pte_write(pmd_pte(pmd))
954#define __pmd_write(pmd) __pte_write(pmd_pte(pmd))
929#define pmd_savedwrite(pmd) pte_savedwrite(pmd_pte(pmd)) 955#define pmd_savedwrite(pmd) pte_savedwrite(pmd_pte(pmd))
930 956
931#ifdef CONFIG_TRANSPARENT_HUGEPAGE 957#ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -982,11 +1008,10 @@ static inline int __pmdp_test_and_clear_young(struct mm_struct *mm,
982static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr, 1008static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr,
983 pmd_t *pmdp) 1009 pmd_t *pmdp)
984{ 1010{
985 1011 if (__pmd_write((*pmdp)))
986 if ((pmd_raw(*pmdp) & cpu_to_be64(_PAGE_WRITE)) == 0) 1012 pmd_hugepage_update(mm, addr, pmdp, _PAGE_WRITE, 0);
987 return; 1013 else if (unlikely(pmd_savedwrite(*pmdp)))
988 1014 pmd_hugepage_update(mm, addr, pmdp, 0, _PAGE_PRIVILEGED);
989 pmd_hugepage_update(mm, addr, pmdp, _PAGE_WRITE, 0);
990} 1015}
991 1016
992static inline int pmd_trans_huge(pmd_t pmd) 1017static inline int pmd_trans_huge(pmd_t pmd)
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index f3158fb16de3..8c68145ba1bd 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -601,7 +601,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
601 hva, NULL, NULL); 601 hva, NULL, NULL);
602 if (ptep) { 602 if (ptep) {
603 pte = kvmppc_read_update_linux_pte(ptep, 1); 603 pte = kvmppc_read_update_linux_pte(ptep, 1);
604 if (pte_write(pte)) 604 if (__pte_write(pte))
605 write_ok = 1; 605 write_ok = 1;
606 } 606 }
607 local_irq_restore(flags); 607 local_irq_restore(flags);
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 6fca970373ee..ce6f2121fffe 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -256,7 +256,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
256 } 256 }
257 pte = kvmppc_read_update_linux_pte(ptep, writing); 257 pte = kvmppc_read_update_linux_pte(ptep, writing);
258 if (pte_present(pte) && !pte_protnone(pte)) { 258 if (pte_present(pte) && !pte_protnone(pte)) {
259 if (writing && !pte_write(pte)) 259 if (writing && !__pte_write(pte))
260 /* make the actual HPTE be read-only */ 260 /* make the actual HPTE be read-only */
261 ptel = hpte_make_readonly(ptel); 261 ptel = hpte_make_readonly(ptel);
262 is_ci = pte_ci(pte); 262 is_ci = pte_ci(pte);
diff --git a/arch/sh/boards/mach-cayman/setup.c b/arch/sh/boards/mach-cayman/setup.c
index 340fd40b381d..9c292c27e0d7 100644
--- a/arch/sh/boards/mach-cayman/setup.c
+++ b/arch/sh/boards/mach-cayman/setup.c
@@ -128,7 +128,6 @@ static int __init smsc_superio_setup(void)
128 SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_PRIMARY_INT_INDEX); 128 SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_PRIMARY_INT_INDEX);
129 SMSC_SUPERIO_WRITE_INDEXED(12, SMSC_SECONDARY_INT_INDEX); 129 SMSC_SUPERIO_WRITE_INDEXED(12, SMSC_SECONDARY_INT_INDEX);
130 130
131#ifdef CONFIG_IDE
132 /* 131 /*
133 * Only IDE1 exists on the Cayman 132 * Only IDE1 exists on the Cayman
134 */ 133 */
@@ -158,7 +157,6 @@ static int __init smsc_superio_setup(void)
158 SMSC_SUPERIO_WRITE_INDEXED(0x01, 0xc5); /* GP45 = IDE1_IRQ */ 157 SMSC_SUPERIO_WRITE_INDEXED(0x01, 0xc5); /* GP45 = IDE1_IRQ */
159 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc6); /* GP46 = nIOROP */ 158 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc6); /* GP46 = nIOROP */
160 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */ 159 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */
161#endif
162 160
163 /* Exit the configuration state */ 161 /* Exit the configuration state */
164 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR); 162 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 8639bb2ae058..8f3d9cf26ff9 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -535,7 +535,7 @@ static void run_sync(void)
535{ 535{
536 int enable_irqs = irqs_disabled(); 536 int enable_irqs = irqs_disabled();
537 537
538 /* We may be called with interrupts disbled (on bootup). */ 538 /* We may be called with interrupts disabled (on bootup). */
539 if (enable_irqs) 539 if (enable_irqs)
540 local_irq_enable(); 540 local_irq_enable();
541 on_each_cpu(do_sync_core, NULL, 1); 541 on_each_cpu(do_sync_core, NULL, 1);
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 99c7805a9693..1f3b6ef105cd 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -106,32 +106,35 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
106 unsigned long end, int write, struct page **pages, int *nr) 106 unsigned long end, int write, struct page **pages, int *nr)
107{ 107{
108 struct dev_pagemap *pgmap = NULL; 108 struct dev_pagemap *pgmap = NULL;
109 int nr_start = *nr; 109 int nr_start = *nr, ret = 0;
110 pte_t *ptep; 110 pte_t *ptep, *ptem;
111 111
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);
113 do { 118 do {
114 pte_t pte = gup_get_pte(ptep); 119 pte_t pte = gup_get_pte(ptep);
115 struct page *page; 120 struct page *page;
116 121
117 /* Similar to the PMD case, NUMA hinting must take slow path */ 122 /* Similar to the PMD case, NUMA hinting must take slow path */
118 if (pte_protnone(pte)) { 123 if (pte_protnone(pte))
119 pte_unmap(ptep); 124 break;
120 return 0; 125
121 } 126 if (!pte_allows_gup(pte_val(pte), write))
127 break;
122 128
123 if (pte_devmap(pte)) { 129 if (pte_devmap(pte)) {
124 pgmap = get_dev_pagemap(pte_pfn(pte), pgmap); 130 pgmap = get_dev_pagemap(pte_pfn(pte), pgmap);
125 if (unlikely(!pgmap)) { 131 if (unlikely(!pgmap)) {
126 undo_dev_pagemap(nr, nr_start, pages); 132 undo_dev_pagemap(nr, nr_start, pages);
127 pte_unmap(ptep); 133 break;
128 return 0;
129 } 134 }
130 } else if (!pte_allows_gup(pte_val(pte), write) || 135 } else if (pte_special(pte))
131 pte_special(pte)) { 136 break;
132 pte_unmap(ptep); 137
133 return 0;
134 }
135 VM_BUG_ON(!pfn_valid(pte_pfn(pte))); 138 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
136 page = pte_page(pte); 139 page = pte_page(pte);
137 get_page(page); 140 get_page(page);
@@ -141,9 +144,11 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
141 (*nr)++; 144 (*nr)++;
142 145
143 } while (ptep++, addr += PAGE_SIZE, addr != end); 146 } while (ptep++, addr += PAGE_SIZE, addr != end);
144 pte_unmap(ptep - 1); 147 if (addr == end)
148 ret = 1;
149 pte_unmap(ptem);
145 150
146 return 1; 151 return ret;
147} 152}
148 153
149static inline void get_head_page_multiple(struct page *page, int nr) 154static inline void get_head_page_multiple(struct page *page, int nr)
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 10aed84244f5..939641d6e262 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -50,7 +50,7 @@
50 the slower the port i/o. In some cases, setting 50 the slower the port i/o. In some cases, setting
51 this to zero will speed up the device. (default -1) 51 this to zero will speed up the device. (default -1)
52 52
53 major You may use this parameter to overide the 53 major You may use this parameter to override the
54 default major number (46) that this driver 54 default major number (46) that this driver
55 will use. Be sure to change the device 55 will use. Be sure to change the device
56 name as well. 56 name as well.
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 644ba0888bd4..9cfd2e06a649 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -61,7 +61,7 @@
61 first drive found. 61 first drive found.
62 62
63 63
64 major You may use this parameter to overide the 64 major You may use this parameter to override the
65 default major number (45) that this driver 65 default major number (45) that this driver
66 will use. Be sure to change the device 66 will use. Be sure to change the device
67 name as well. 67 name as well.
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index ed93e8badf56..14c5d32f5d8b 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -59,7 +59,7 @@
59 the slower the port i/o. In some cases, setting 59 the slower the port i/o. In some cases, setting
60 this to zero will speed up the device. (default -1) 60 this to zero will speed up the device. (default -1)
61 61
62 major You may use this parameter to overide the 62 major You may use this parameter to override the
63 default major number (47) that this driver 63 default major number (47) that this driver
64 will use. Be sure to change the device 64 will use. Be sure to change the device
65 name as well. 65 name as well.
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 5db955fe3a94..3b5882bfb736 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -84,7 +84,7 @@
84 the slower the port i/o. In some cases, setting 84 the slower the port i/o. In some cases, setting
85 this to zero will speed up the device. (default -1) 85 this to zero will speed up the device. (default -1)
86 86
87 major You may use this parameter to overide the 87 major You may use this parameter to override the
88 default major number (97) that this driver 88 default major number (97) that this driver
89 will use. Be sure to change the device 89 will use. Be sure to change the device
90 name as well. 90 name as well.
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 61fc6824299a..e815312a00ad 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -61,7 +61,7 @@
61 the slower the port i/o. In some cases, setting 61 the slower the port i/o. In some cases, setting
62 this to zero will speed up the device. (default -1) 62 this to zero will speed up the device. (default -1)
63 63
64 major You may use this parameter to overide the 64 major You may use this parameter to override the
65 default major number (96) that this driver 65 default major number (96) that this driver
66 will use. Be sure to change the device 66 will use. Be sure to change the device
67 name as well. 67 name as well.
diff --git a/drivers/crypto/ux500/cryp/cryp.c b/drivers/crypto/ux500/cryp/cryp.c
index 43a0c8a26ab0..00a16ab601cb 100644
--- a/drivers/crypto/ux500/cryp/cryp.c
+++ b/drivers/crypto/ux500/cryp/cryp.c
@@ -82,7 +82,7 @@ void cryp_activity(struct cryp_device_data *device_data,
82void cryp_flush_inoutfifo(struct cryp_device_data *device_data) 82void cryp_flush_inoutfifo(struct cryp_device_data *device_data)
83{ 83{
84 /* 84 /*
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
86 * FIFO. This is something that isn't written in the design 86 * FIFO. This is something that isn't written in the design
87 * specification, but we have been informed by the hardware designers 87 * specification, but we have been informed by the hardware designers
88 * that this must be done. 88 * that this must be done.
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index 31375bdde6f1..011800f621c6 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
@@ -788,7 +788,7 @@ static int sdma_v3_0_start(struct amdgpu_device *adev)
788 } 788 }
789 } 789 }
790 790
791 /* disble sdma engine before programing it */ 791 /* disable sdma engine before programing it */
792 sdma_v3_0_ctx_switch_enable(adev, false); 792 sdma_v3_0_ctx_switch_enable(adev, false);
793 sdma_v3_0_enable(adev, false); 793 sdma_v3_0_enable(adev, false);
794 794
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 81a80c82f1bd..bd0d1988feb2 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -543,7 +543,7 @@ static int vmbus_close_internal(struct vmbus_channel *channel)
543 /* 543 /*
544 * In case a device driver's probe() fails (e.g., 544 * In case a device driver's probe() fails (e.g.,
545 * util_probe() -> vmbus_open() returns -ENOMEM) and the device is 545 * 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
547 * in Hyper-V Manager), the driver's remove() invokes vmbus_close(): 547 * in Hyper-V Manager), the driver's remove() invokes vmbus_close():
548 * here we should skip most of the below cleanup work. 548 * here we should skip most of the below cleanup work.
549 */ 549 */
diff --git a/drivers/isdn/hisax/st5481_b.c b/drivers/isdn/hisax/st5481_b.c
index 409849165838..f64a36007800 100644
--- a/drivers/isdn/hisax/st5481_b.c
+++ b/drivers/isdn/hisax/st5481_b.c
@@ -239,7 +239,7 @@ static void st5481B_mode(struct st5481_bcs *bcs, int mode)
239 } 239 }
240 } 240 }
241 } else { 241 } else {
242 // Disble B channel interrupts 242 // Disable B channel interrupts
243 st5481_usb_device_ctrl_msg(adapter, FFMSK_B1+(bcs->channel * 2), 0, NULL, NULL); 243 st5481_usb_device_ctrl_msg(adapter, FFMSK_B1+(bcs->channel * 2), 0, NULL, NULL);
244 244
245 // Disable B channel FIFOs 245 // Disable B channel FIFOs
diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h
index a126919ed102..5d13930f0f22 100644
--- a/drivers/md/bcache/util.h
+++ b/drivers/md/bcache/util.h
@@ -4,7 +4,6 @@
4 4
5#include <linux/blkdev.h> 5#include <linux/blkdev.h>
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/blkdev.h>
8#include <linux/kernel.h> 7#include <linux/kernel.h>
9#include <linux/sched/clock.h> 8#include <linux/sched/clock.h>
10#include <linux/llist.h> 9#include <linux/llist.h>
diff --git a/drivers/media/dvb-frontends/drx39xyj/drx_driver.h b/drivers/media/dvb-frontends/drx39xyj/drx_driver.h
index 7a681d8202c7..4442e478db72 100644
--- a/drivers/media/dvb-frontends/drx39xyj/drx_driver.h
+++ b/drivers/media/dvb-frontends/drx39xyj/drx_driver.h
@@ -256,8 +256,7 @@ int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner,
256* 256*
257* The actual DAP implementation may be restricted to only one of the modes. 257* The actual DAP implementation may be restricted to only one of the modes.
258* A compiler warning or error will be generated if the DAP implementation 258* A compiler warning or error will be generated if the DAP implementation
259* overides or cannot handle the mode defined below. 259* overrides or cannot handle the mode defined below.
260*
261*/ 260*/
262#ifndef DRXDAP_SINGLE_MASTER 261#ifndef DRXDAP_SINGLE_MASTER
263#define DRXDAP_SINGLE_MASTER 1 262#define DRXDAP_SINGLE_MASTER 1
@@ -272,7 +271,7 @@ int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner,
272* 271*
273* This maximum size may be restricted by the actual DAP implementation. 272* This maximum size may be restricted by the actual DAP implementation.
274* A compiler warning or error will be generated if the DAP implementation 273* 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.
276* 275*
277* Beware that the DAP uses DRXDAP_MAX_WCHUNKSIZE to create a temporary data 276* Beware that the DAP uses DRXDAP_MAX_WCHUNKSIZE to create a temporary data
278* buffer. Do not undefine or choose too large, unless your system is able to 277* 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,
292* 291*
293* This maximum size may be restricted by the actual DAP implementation. 292* This maximum size may be restricted by the actual DAP implementation.
294* A compiler warning or error will be generated if the DAP implementation 293* A compiler warning or error will be generated if the DAP implementation
295* overides or cannot handle the chunksize defined below. 294* overrides or cannot handle the chunksize defined below.
296*
297*/ 295*/
298#ifndef DRXDAP_MAX_RCHUNKSIZE 296#ifndef DRXDAP_MAX_RCHUNKSIZE
299#define DRXDAP_MAX_RCHUNKSIZE 60 297#define DRXDAP_MAX_RCHUNKSIZE 60
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 1ae872bfc3ba..747645c74134 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -186,7 +186,7 @@ static inline int write_enable(struct spi_nor *nor)
186} 186}
187 187
188/* 188/*
189 * Send write disble instruction to the chip. 189 * Send write disable instruction to the chip.
190 */ 190 */
191static inline int write_disable(struct spi_nor *nor) 191static inline int write_disable(struct spi_nor *nor)
192{ 192{
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h
index 6d31f92ef2b6..84ac50f92c9c 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge.h
+++ b/drivers/net/ethernet/qlogic/qlge/qlge.h
@@ -1162,8 +1162,8 @@ struct ob_mac_tso_iocb_rsp {
1162struct ib_mac_iocb_rsp { 1162struct ib_mac_iocb_rsp {
1163 u8 opcode; /* 0x20 */ 1163 u8 opcode; /* 0x20 */
1164 u8 flags1; 1164 u8 flags1;
1165#define IB_MAC_IOCB_RSP_OI 0x01 /* Overide intr delay */ 1165#define IB_MAC_IOCB_RSP_OI 0x01 /* Override intr delay */
1166#define IB_MAC_IOCB_RSP_I 0x02 /* Disble Intr Generation */ 1166#define IB_MAC_IOCB_RSP_I 0x02 /* Disable Intr Generation */
1167#define IB_MAC_CSUM_ERR_MASK 0x1c /* A mask to use for csum errs */ 1167#define IB_MAC_CSUM_ERR_MASK 0x1c /* A mask to use for csum errs */
1168#define IB_MAC_IOCB_RSP_TE 0x04 /* Checksum error */ 1168#define IB_MAC_IOCB_RSP_TE 0x04 /* Checksum error */
1169#define IB_MAC_IOCB_RSP_NU 0x08 /* No checksum rcvd */ 1169#define IB_MAC_IOCB_RSP_NU 0x08 /* No checksum rcvd */
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 109e2c99e6c1..95d8f25cbcca 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -6278,7 +6278,7 @@ ahd_reset(struct ahd_softc *ahd, int reinit)
6278 * does not disable its parity logic prior to 6278 * does not disable its parity logic prior to
6279 * the start of the reset. This may cause a 6279 * the start of the reset. This may cause a
6280 * parity error to be detected and thus a 6280 * parity error to be detected and thus a
6281 * spurious SERR or PERR assertion. Disble 6281 * spurious SERR or PERR assertion. Disable
6282 * PERR and SERR responses during the CHIPRST. 6282 * PERR and SERR responses during the CHIPRST.
6283 */ 6283 */
6284 mod_cmd = cmd & ~(PCIM_CMD_PERRESPEN|PCIM_CMD_SERRESPEN); 6284 mod_cmd = cmd & ~(PCIM_CMD_PERRESPEN|PCIM_CMD_SERRESPEN);
diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
index a2615d64d07c..79a2d8fba6b6 100644
--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -84,8 +84,7 @@ static int ep_open(struct inode *, struct file *);
84 84
85/* /dev/gadget/$CHIP represents ep0 and the whole device */ 85/* /dev/gadget/$CHIP represents ep0 and the whole device */
86enum ep0_state { 86enum ep0_state {
87 /* DISBLED is the initial state. 87 /* DISABLED is the initial state. */
88 */
89 STATE_DEV_DISABLED = 0, 88 STATE_DEV_DISABLED = 0,
90 89
91 /* Only one open() of /dev/gadget/$CHIP; only one file tracks 90 /* Only one open() of /dev/gadget/$CHIP; only one file tracks
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6d6c46000e56..50aee8b7718b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -868,7 +868,7 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci)
868 868
869 spin_lock_irqsave(&xhci->lock, flags); 869 spin_lock_irqsave(&xhci->lock, flags);
870 870
871 /* disble usb3 ports Wake bits*/ 871 /* disable usb3 ports Wake bits */
872 port_index = xhci->num_usb3_ports; 872 port_index = xhci->num_usb3_ports;
873 port_array = xhci->usb3_ports; 873 port_array = xhci->usb3_ports;
874 while (port_index--) { 874 while (port_index--) {
@@ -879,7 +879,7 @@ static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci)
879 writel(t2, port_array[port_index]); 879 writel(t2, port_array[port_index]);
880 } 880 }
881 881
882 /* disble usb2 ports Wake bits*/ 882 /* disable usb2 ports Wake bits */
883 port_index = xhci->num_usb2_ports; 883 port_index = xhci->num_usb2_ports;
884 port_array = xhci->usb2_ports; 884 port_array = xhci->usb2_ports;
885 while (port_index--) { 885 while (port_index--) {
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 338d2f73eb29..a2c05f2ada6d 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1359,6 +1359,16 @@ out:
1359 return 0; 1359 return 0;
1360} 1360}
1361 1361
1362static 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
1362static int fat_read_root(struct inode *inode) 1372static int fat_read_root(struct inode *inode)
1363{ 1373{
1364 struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); 1374 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,
1803 fat_inode = new_inode(sb); 1813 fat_inode = new_inode(sb);
1804 if (!fat_inode) 1814 if (!fat_inode)
1805 goto out_fail; 1815 goto out_fail;
1806 MSDOS_I(fat_inode)->i_pos = 0; 1816 fat_dummy_inode_init(fat_inode);
1807 sbi->fat_inode = fat_inode; 1817 sbi->fat_inode = fat_inode;
1808 1818
1809 fsinfo_inode = new_inode(sb); 1819 fsinfo_inode = new_inode(sb);
1810 if (!fsinfo_inode) 1820 if (!fsinfo_inode)
1811 goto out_fail; 1821 goto out_fail;
1822 fat_dummy_inode_init(fsinfo_inode);
1812 fsinfo_inode->i_ino = MSDOS_FSINFO_INO; 1823 fsinfo_inode->i_ino = MSDOS_FSINFO_INO;
1813 sbi->fsinfo_inode = fsinfo_inode; 1824 sbi->fsinfo_inode = fsinfo_inode;
1814 insert_inode_hash(fsinfo_inode); 1825 insert_inode_hash(fsinfo_inode);
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 973607df579d..2bb1c72380f2 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -138,8 +138,6 @@ out:
138 * userfaultfd_ctx_get - Acquires a reference to the internal userfaultfd 138 * userfaultfd_ctx_get - Acquires a reference to the internal userfaultfd
139 * context. 139 * context.
140 * @ctx: [in] Pointer to the userfaultfd context. 140 * @ctx: [in] Pointer to the userfaultfd context.
141 *
142 * Returns: In case of success, returns not zero.
143 */ 141 */
144static void userfaultfd_ctx_get(struct userfaultfd_ctx *ctx) 142static void userfaultfd_ctx_get(struct userfaultfd_ctx *ctx)
145{ 143{
@@ -490,7 +488,7 @@ int handle_userfault(struct vm_fault *vmf, unsigned long reason)
490 * in such case. 488 * in such case.
491 */ 489 */
492 down_read(&mm->mmap_sem); 490 down_read(&mm->mmap_sem);
493 ret = 0; 491 ret = VM_FAULT_NOPAGE;
494 } 492 }
495 } 493 }
496 494
@@ -527,10 +525,11 @@ out:
527 return ret; 525 return ret;
528} 526}
529 527
530static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, 528static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
531 struct userfaultfd_wait_queue *ewq) 529 struct userfaultfd_wait_queue *ewq)
532{ 530{
533 int ret = 0; 531 if (WARN_ON_ONCE(current->flags & PF_EXITING))
532 goto out;
534 533
535 ewq->ctx = ctx; 534 ewq->ctx = ctx;
536 init_waitqueue_entry(&ewq->wq, current); 535 init_waitqueue_entry(&ewq->wq, current);
@@ -547,8 +546,16 @@ static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
547 break; 546 break;
548 if (ACCESS_ONCE(ctx->released) || 547 if (ACCESS_ONCE(ctx->released) ||
549 fatal_signal_pending(current)) { 548 fatal_signal_pending(current)) {
550 ret = -1;
551 __remove_wait_queue(&ctx->event_wqh, &ewq->wq); 549 __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 }
552 break; 559 break;
553 } 560 }
554 561
@@ -566,9 +573,8 @@ static int userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx,
566 * ctx may go away after this if the userfault pseudo fd is 573 * ctx may go away after this if the userfault pseudo fd is
567 * already released. 574 * already released.
568 */ 575 */
569 576out:
570 userfaultfd_ctx_put(ctx); 577 userfaultfd_ctx_put(ctx);
571 return ret;
572} 578}
573 579
574static void userfaultfd_event_complete(struct userfaultfd_ctx *ctx, 580static void userfaultfd_event_complete(struct userfaultfd_ctx *ctx,
@@ -626,7 +632,7 @@ int dup_userfaultfd(struct vm_area_struct *vma, struct list_head *fcs)
626 return 0; 632 return 0;
627} 633}
628 634
629static int dup_fctx(struct userfaultfd_fork_ctx *fctx) 635static void dup_fctx(struct userfaultfd_fork_ctx *fctx)
630{ 636{
631 struct userfaultfd_ctx *ctx = fctx->orig; 637 struct userfaultfd_ctx *ctx = fctx->orig;
632 struct userfaultfd_wait_queue ewq; 638 struct userfaultfd_wait_queue ewq;
@@ -636,17 +642,15 @@ static int dup_fctx(struct userfaultfd_fork_ctx *fctx)
636 ewq.msg.event = UFFD_EVENT_FORK; 642 ewq.msg.event = UFFD_EVENT_FORK;
637 ewq.msg.arg.reserved.reserved1 = (unsigned long)fctx->new; 643 ewq.msg.arg.reserved.reserved1 = (unsigned long)fctx->new;
638 644
639 return userfaultfd_event_wait_completion(ctx, &ewq); 645 userfaultfd_event_wait_completion(ctx, &ewq);
640} 646}
641 647
642void dup_userfaultfd_complete(struct list_head *fcs) 648void dup_userfaultfd_complete(struct list_head *fcs)
643{ 649{
644 int ret = 0;
645 struct userfaultfd_fork_ctx *fctx, *n; 650 struct userfaultfd_fork_ctx *fctx, *n;
646 651
647 list_for_each_entry_safe(fctx, n, fcs, list) { 652 list_for_each_entry_safe(fctx, n, fcs, list) {
648 if (!ret) 653 dup_fctx(fctx);
649 ret = dup_fctx(fctx);
650 list_del(&fctx->list); 654 list_del(&fctx->list);
651 kfree(fctx); 655 kfree(fctx);
652 } 656 }
@@ -689,8 +693,7 @@ void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *vm_ctx,
689 userfaultfd_event_wait_completion(ctx, &ewq); 693 userfaultfd_event_wait_completion(ctx, &ewq);
690} 694}
691 695
692void userfaultfd_remove(struct vm_area_struct *vma, 696bool userfaultfd_remove(struct vm_area_struct *vma,
693 struct vm_area_struct **prev,
694 unsigned long start, unsigned long end) 697 unsigned long start, unsigned long end)
695{ 698{
696 struct mm_struct *mm = vma->vm_mm; 699 struct mm_struct *mm = vma->vm_mm;
@@ -699,13 +702,11 @@ void userfaultfd_remove(struct vm_area_struct *vma,
699 702
700 ctx = vma->vm_userfaultfd_ctx.ctx; 703 ctx = vma->vm_userfaultfd_ctx.ctx;
701 if (!ctx || !(ctx->features & UFFD_FEATURE_EVENT_REMOVE)) 704 if (!ctx || !(ctx->features & UFFD_FEATURE_EVENT_REMOVE))
702 return; 705 return true;
703 706
704 userfaultfd_ctx_get(ctx); 707 userfaultfd_ctx_get(ctx);
705 up_read(&mm->mmap_sem); 708 up_read(&mm->mmap_sem);
706 709
707 *prev = NULL; /* We wait for ACK w/o the mmap semaphore */
708
709 msg_init(&ewq.msg); 710 msg_init(&ewq.msg);
710 711
711 ewq.msg.event = UFFD_EVENT_REMOVE; 712 ewq.msg.event = UFFD_EVENT_REMOVE;
@@ -714,7 +715,7 @@ void userfaultfd_remove(struct vm_area_struct *vma,
714 715
715 userfaultfd_event_wait_completion(ctx, &ewq); 716 userfaultfd_event_wait_completion(ctx, &ewq);
716 717
717 down_read(&mm->mmap_sem); 718 return false;
718} 719}
719 720
720static bool has_unmap_ctx(struct userfaultfd_ctx *ctx, struct list_head *unmaps, 721static 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)
775 } 776 }
776} 777}
777 778
778void 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
806static int userfaultfd_release(struct inode *inode, struct file *file) 779static int userfaultfd_release(struct inode *inode, struct file *file)
807{ 780{
808 struct userfaultfd_ctx *ctx = file->private_data; 781 struct userfaultfd_ctx *ctx = file->private_data;
diff --git a/include/dt-bindings/sound/cs42l42.h b/include/dt-bindings/sound/cs42l42.h
index 399a123aed58..db69d84ed7d1 100644
--- a/include/dt-bindings/sound/cs42l42.h
+++ b/include/dt-bindings/sound/cs42l42.h
@@ -20,7 +20,7 @@
20#define CS42L42_HPOUT_LOAD_1NF 0 20#define CS42L42_HPOUT_LOAD_1NF 0
21#define CS42L42_HPOUT_LOAD_10NF 1 21#define CS42L42_HPOUT_LOAD_10NF 1
22 22
23/* HPOUT Clamp to GND Overide */ 23/* HPOUT Clamp to GND Override */
24#define CS42L42_HPOUT_CLAMP_EN 0 24#define CS42L42_HPOUT_CLAMP_EN 0
25#define CS42L42_HPOUT_CLAMP_DIS 1 25#define CS42L42_HPOUT_CLAMP_DIS 1
26 26
diff --git a/include/linux/fs.h b/include/linux/fs.h
index aad3fd0ff5f8..7251f7bb45e8 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2678,7 +2678,7 @@ static const char * const kernel_read_file_str[] = {
2678 2678
2679static inline const char *kernel_read_file_id_str(enum kernel_read_file_id id) 2679static inline const char *kernel_read_file_id_str(enum kernel_read_file_id id)
2680{ 2680{
2681 if (id < 0 || id >= READING_MAX_ID) 2681 if ((unsigned)id >= READING_MAX_ID)
2682 return kernel_read_file_str[READING_UNKNOWN]; 2682 return kernel_read_file_str[READING_UNKNOWN];
2683 2683
2684 return kernel_read_file_str[id]; 2684 return kernel_read_file_str[id];
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index ad3e5158e586..c9f795e9a2ee 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -65,7 +65,7 @@ struct regulator_state {
65 int uV; /* suspend voltage */ 65 int uV; /* suspend voltage */
66 unsigned int mode; /* suspend regulator operating mode */ 66 unsigned int mode; /* suspend regulator operating mode */
67 int enabled; /* is regulator enabled in this suspend state */ 67 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 */
69}; 69};
70 70
71/** 71/**
diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h
index 0468548acebf..48a3483dccb1 100644
--- a/include/linux/userfaultfd_k.h
+++ b/include/linux/userfaultfd_k.h
@@ -61,8 +61,7 @@ extern void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *,
61 unsigned long from, unsigned long to, 61 unsigned long from, unsigned long to,
62 unsigned long len); 62 unsigned long len);
63 63
64extern void userfaultfd_remove(struct vm_area_struct *vma, 64extern bool userfaultfd_remove(struct vm_area_struct *vma,
65 struct vm_area_struct **prev,
66 unsigned long start, 65 unsigned long start,
67 unsigned long end); 66 unsigned long end);
68 67
@@ -72,8 +71,6 @@ extern int userfaultfd_unmap_prep(struct vm_area_struct *vma,
72extern void userfaultfd_unmap_complete(struct mm_struct *mm, 71extern void userfaultfd_unmap_complete(struct mm_struct *mm,
73 struct list_head *uf); 72 struct list_head *uf);
74 73
75extern void userfaultfd_exit(struct mm_struct *mm);
76
77#else /* CONFIG_USERFAULTFD */ 74#else /* CONFIG_USERFAULTFD */
78 75
79/* mm helpers */ 76/* mm helpers */
@@ -120,11 +117,11 @@ static inline void mremap_userfaultfd_complete(struct vm_userfaultfd_ctx *ctx,
120{ 117{
121} 118}
122 119
123static inline void userfaultfd_remove(struct vm_area_struct *vma, 120static inline bool userfaultfd_remove(struct vm_area_struct *vma,
124 struct vm_area_struct **prev,
125 unsigned long start, 121 unsigned long start,
126 unsigned long end) 122 unsigned long end)
127{ 123{
124 return true;
128} 125}
129 126
130static inline int userfaultfd_unmap_prep(struct vm_area_struct *vma, 127static inline int userfaultfd_unmap_prep(struct vm_area_struct *vma,
@@ -139,10 +136,6 @@ static inline void userfaultfd_unmap_complete(struct mm_struct *mm,
139{ 136{
140} 137}
141 138
142static inline void userfaultfd_exit(struct mm_struct *mm)
143{
144}
145
146#endif /* CONFIG_USERFAULTFD */ 139#endif /* CONFIG_USERFAULTFD */
147 140
148#endif /* _LINUX_USERFAULTFD_K_H */ 141#endif /* _LINUX_USERFAULTFD_K_H */
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 6aa1b6cb5828..a80b7b59cf33 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -79,6 +79,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
79 THP_SPLIT_PAGE_FAILED, 79 THP_SPLIT_PAGE_FAILED,
80 THP_DEFERRED_SPLIT_PAGE, 80 THP_DEFERRED_SPLIT_PAGE,
81 THP_SPLIT_PMD, 81 THP_SPLIT_PMD,
82#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
83 THP_SPLIT_PUD,
84#endif
82 THP_ZERO_PAGE_ALLOC, 85 THP_ZERO_PAGE_ALLOC,
83 THP_ZERO_PAGE_ALLOC_FAILED, 86 THP_ZERO_PAGE_ALLOC_FAILED,
84#endif 87#endif
diff --git a/include/net/irda/timer.h b/include/net/irda/timer.h
index cb2615ccf761..d784f242cf7b 100644
--- a/include/net/irda/timer.h
+++ b/include/net/irda/timer.h
@@ -59,7 +59,7 @@ struct lap_cb;
59 * Slot timer must never exceed 85 ms, and must always be at least 25 ms, 59 * Slot timer must never exceed 85 ms, and must always be at least 25 ms,
60 * suggested to 75-85 msec by IrDA lite. This doesn't work with a lot of 60 * suggested to 75-85 msec by IrDA lite. This doesn't work with a lot of
61 * devices, and other stackes uses a lot more, so it's best we do it as well 61 * 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)
63 */ 63 */
64#define SLOT_TIMEOUT (90*HZ/1000) 64#define SLOT_TIMEOUT (90*HZ/1000)
65 65
diff --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h
index c055947c5c98..3b059530dac9 100644
--- a/include/uapi/linux/userfaultfd.h
+++ b/include/uapi/linux/userfaultfd.h
@@ -18,8 +18,7 @@
18 * means the userland is reading). 18 * means the userland is reading).
19 */ 19 */
20#define UFFD_API ((__u64)0xAA) 20#define UFFD_API ((__u64)0xAA)
21#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_EXIT | \ 21#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK | \
22 UFFD_FEATURE_EVENT_FORK | \
23 UFFD_FEATURE_EVENT_REMAP | \ 22 UFFD_FEATURE_EVENT_REMAP | \
24 UFFD_FEATURE_EVENT_REMOVE | \ 23 UFFD_FEATURE_EVENT_REMOVE | \
25 UFFD_FEATURE_EVENT_UNMAP | \ 24 UFFD_FEATURE_EVENT_UNMAP | \
@@ -113,7 +112,6 @@ struct uffd_msg {
113#define UFFD_EVENT_REMAP 0x14 112#define UFFD_EVENT_REMAP 0x14
114#define UFFD_EVENT_REMOVE 0x15 113#define UFFD_EVENT_REMOVE 0x15
115#define UFFD_EVENT_UNMAP 0x16 114#define UFFD_EVENT_UNMAP 0x16
116#define UFFD_EVENT_EXIT 0x17
117 115
118/* flags for UFFD_EVENT_PAGEFAULT */ 116/* flags for UFFD_EVENT_PAGEFAULT */
119#define UFFD_PAGEFAULT_FLAG_WRITE (1<<0) /* If this was a write fault */ 117#define UFFD_PAGEFAULT_FLAG_WRITE (1<<0) /* If this was a write fault */
@@ -163,7 +161,6 @@ struct uffdio_api {
163#define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4) 161#define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4)
164#define UFFD_FEATURE_MISSING_SHMEM (1<<5) 162#define UFFD_FEATURE_MISSING_SHMEM (1<<5)
165#define UFFD_FEATURE_EVENT_UNMAP (1<<6) 163#define UFFD_FEATURE_EVENT_UNMAP (1<<6)
166#define UFFD_FEATURE_EVENT_EXIT (1<<7)
167 __u64 features; 164 __u64 features;
168 165
169 __u64 ioctls; 166 __u64 ioctls;
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 0125589c7428..48851327a15e 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2669,7 +2669,7 @@ static bool css_visible(struct cgroup_subsys_state *css)
2669 * 2669 *
2670 * Returns 0 on success, -errno on failure. On failure, csses which have 2670 * Returns 0 on success, -errno on failure. On failure, csses which have
2671 * been processed already aren't cleaned up. The caller is responsible for 2671 * 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().
2673 */ 2673 */
2674static int cgroup_apply_control_enable(struct cgroup *cgrp) 2674static int cgroup_apply_control_enable(struct cgroup *cgrp)
2675{ 2675{
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6f41548f2e32..a17ed56c8ce1 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -998,7 +998,7 @@ list_update_cgroup_event(struct perf_event *event,
998 */ 998 */
999#define PERF_CPU_HRTIMER (1000 / HZ) 999#define PERF_CPU_HRTIMER (1000 / HZ)
1000/* 1000/*
1001 * function must be called with interrupts disbled 1001 * function must be called with interrupts disabled
1002 */ 1002 */
1003static enum hrtimer_restart perf_mux_hrtimer_handler(struct hrtimer *hr) 1003static enum hrtimer_restart perf_mux_hrtimer_handler(struct hrtimer *hr)
1004{ 1004{
diff --git a/kernel/exit.c b/kernel/exit.c
index e126ebf2400c..516acdb0e0ec 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -554,7 +554,6 @@ static void exit_mm(void)
554 enter_lazy_tlb(mm, current); 554 enter_lazy_tlb(mm, current);
555 task_unlock(current); 555 task_unlock(current);
556 mm_update_next_owner(mm); 556 mm_update_next_owner(mm);
557 userfaultfd_exit(mm);
558 mmput(mm); 557 mmput(mm);
559 if (test_thread_flag(TIF_MEMDIE)) 558 if (test_thread_flag(TIF_MEMDIE))
560 exit_oom_victim(); 559 exit_oom_victim();
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 1d68b5b7ad41..5fb1f2c87e6b 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -65,7 +65,7 @@ void stack_trace_print(void)
65} 65}
66 66
67/* 67/*
68 * When arch-specific code overides this function, the following 68 * When arch-specific code overrides this function, the following
69 * data should be filled up, assuming stack_trace_max_lock is held to 69 * data should be filled up, assuming stack_trace_max_lock is held to
70 * prevent concurrent updates. 70 * prevent concurrent updates.
71 * stack_trace_index[] 71 * stack_trace_index[]
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index d36b2af4d1bf..8f037e256c54 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1828,7 +1828,7 @@ static void __split_huge_pud_locked(struct vm_area_struct *vma, pud_t *pud,
1828 VM_BUG_ON_VMA(vma->vm_end < haddr + HPAGE_PUD_SIZE, vma); 1828 VM_BUG_ON_VMA(vma->vm_end < haddr + HPAGE_PUD_SIZE, vma);
1829 VM_BUG_ON(!pud_trans_huge(*pud) && !pud_devmap(*pud)); 1829 VM_BUG_ON(!pud_trans_huge(*pud) && !pud_devmap(*pud));
1830 1830
1831 count_vm_event(THP_SPLIT_PMD); 1831 count_vm_event(THP_SPLIT_PUD);
1832 1832
1833 pudp_huge_clear_flush_notify(vma, haddr, pud); 1833 pudp_huge_clear_flush_notify(vma, haddr, pud);
1834} 1834}
diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c
index 6f1ed1630873..3a8ddf8baf7d 100644
--- a/mm/kasan/quarantine.c
+++ b/mm/kasan/quarantine.c
@@ -25,6 +25,7 @@
25#include <linux/printk.h> 25#include <linux/printk.h>
26#include <linux/shrinker.h> 26#include <linux/shrinker.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/srcu.h>
28#include <linux/string.h> 29#include <linux/string.h>
29#include <linux/types.h> 30#include <linux/types.h>
30 31
@@ -103,6 +104,7 @@ static int quarantine_tail;
103/* Total size of all objects in global_quarantine across all batches. */ 104/* Total size of all objects in global_quarantine across all batches. */
104static unsigned long quarantine_size; 105static unsigned long quarantine_size;
105static DEFINE_SPINLOCK(quarantine_lock); 106static DEFINE_SPINLOCK(quarantine_lock);
107DEFINE_STATIC_SRCU(remove_cache_srcu);
106 108
107/* Maximum size of the global queue. */ 109/* Maximum size of the global queue. */
108static unsigned long quarantine_max_size; 110static unsigned long quarantine_max_size;
@@ -173,17 +175,22 @@ void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache)
173 struct qlist_head *q; 175 struct qlist_head *q;
174 struct qlist_head temp = QLIST_INIT; 176 struct qlist_head temp = QLIST_INIT;
175 177
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 */
176 local_irq_save(flags); 186 local_irq_save(flags);
177 187
178 q = this_cpu_ptr(&cpu_quarantine); 188 q = this_cpu_ptr(&cpu_quarantine);
179 qlist_put(q, &info->quarantine_link, cache->size); 189 qlist_put(q, &info->quarantine_link, cache->size);
180 if (unlikely(q->bytes > QUARANTINE_PERCPU_SIZE)) 190 if (unlikely(q->bytes > QUARANTINE_PERCPU_SIZE)) {
181 qlist_move_all(q, &temp); 191 qlist_move_all(q, &temp);
182 192
183 local_irq_restore(flags); 193 spin_lock(&quarantine_lock);
184
185 if (unlikely(!qlist_empty(&temp))) {
186 spin_lock_irqsave(&quarantine_lock, flags);
187 WRITE_ONCE(quarantine_size, quarantine_size + temp.bytes); 194 WRITE_ONCE(quarantine_size, quarantine_size + temp.bytes);
188 qlist_move_all(&temp, &global_quarantine[quarantine_tail]); 195 qlist_move_all(&temp, &global_quarantine[quarantine_tail]);
189 if (global_quarantine[quarantine_tail].bytes >= 196 if (global_quarantine[quarantine_tail].bytes >=
@@ -196,20 +203,33 @@ void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache)
196 if (new_tail != quarantine_head) 203 if (new_tail != quarantine_head)
197 quarantine_tail = new_tail; 204 quarantine_tail = new_tail;
198 } 205 }
199 spin_unlock_irqrestore(&quarantine_lock, flags); 206 spin_unlock(&quarantine_lock);
200 } 207 }
208
209 local_irq_restore(flags);
201} 210}
202 211
203void quarantine_reduce(void) 212void quarantine_reduce(void)
204{ 213{
205 size_t total_size, new_quarantine_size, percpu_quarantines; 214 size_t total_size, new_quarantine_size, percpu_quarantines;
206 unsigned long flags; 215 unsigned long flags;
216 int srcu_idx;
207 struct qlist_head to_free = QLIST_INIT; 217 struct qlist_head to_free = QLIST_INIT;
208 218
209 if (likely(READ_ONCE(quarantine_size) <= 219 if (likely(READ_ONCE(quarantine_size) <=
210 READ_ONCE(quarantine_max_size))) 220 READ_ONCE(quarantine_max_size)))
211 return; 221 return;
212 222
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);
213 spin_lock_irqsave(&quarantine_lock, flags); 233 spin_lock_irqsave(&quarantine_lock, flags);
214 234
215 /* 235 /*
@@ -237,6 +257,7 @@ void quarantine_reduce(void)
237 spin_unlock_irqrestore(&quarantine_lock, flags); 257 spin_unlock_irqrestore(&quarantine_lock, flags);
238 258
239 qlist_free_all(&to_free, NULL); 259 qlist_free_all(&to_free, NULL);
260 srcu_read_unlock(&remove_cache_srcu, srcu_idx);
240} 261}
241 262
242static void qlist_move_cache(struct qlist_head *from, 263static void qlist_move_cache(struct qlist_head *from,
@@ -280,12 +301,28 @@ void quarantine_remove_cache(struct kmem_cache *cache)
280 unsigned long flags, i; 301 unsigned long flags, i;
281 struct qlist_head to_free = QLIST_INIT; 302 struct qlist_head to_free = QLIST_INIT;
282 303
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 */
283 on_each_cpu(per_cpu_remove_cache, cache, 1); 311 on_each_cpu(per_cpu_remove_cache, cache, 1);
284 312
285 spin_lock_irqsave(&quarantine_lock, flags); 313 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;
287 qlist_move_cache(&global_quarantine[i], &to_free, cache); 317 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 }
288 spin_unlock_irqrestore(&quarantine_lock, flags); 323 spin_unlock_irqrestore(&quarantine_lock, flags);
289 324
290 qlist_free_all(&to_free, cache); 325 qlist_free_all(&to_free, cache);
326
327 synchronize_srcu(&remove_cache_srcu);
291} 328}
diff --git a/mm/madvise.c b/mm/madvise.c
index dc5927c812d3..7a2abf0127ae 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -513,7 +513,43 @@ static long madvise_dontneed(struct vm_area_struct *vma,
513 if (!can_madv_dontneed_vma(vma)) 513 if (!can_madv_dontneed_vma(vma))
514 return -EINVAL; 514 return -EINVAL;
515 515
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 }
517 zap_page_range(vma, start, end - start); 553 zap_page_range(vma, start, end - start);
518 return 0; 554 return 0;
519} 555}
@@ -554,8 +590,10 @@ static long madvise_remove(struct vm_area_struct *vma,
554 * mmap_sem. 590 * mmap_sem.
555 */ 591 */
556 get_file(f); 592 get_file(f);
557 userfaultfd_remove(vma, prev, start, end); 593 if (userfaultfd_remove(vma, start, end)) {
558 up_read(&current->mm->mmap_sem); 594 /* mmap_sem was not released by userfaultfd_remove() */
595 up_read(&current->mm->mmap_sem);
596 }
559 error = vfs_fallocate(f, 597 error = vfs_fallocate(f,
560 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 598 FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
561 offset, end - start); 599 offset, end - start);
diff --git a/mm/memblock.c b/mm/memblock.c
index b64b47803e52..696f06d17c4e 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1118,7 +1118,10 @@ unsigned long __init_memblock memblock_next_valid_pfn(unsigned long pfn,
1118 } 1118 }
1119 } while (left < right); 1119 } while (left < right);
1120 1120
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);
1122} 1125}
1123 1126
1124/** 1127/**
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index c52ec893e241..2bd7541d7c11 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -466,6 +466,8 @@ static void mem_cgroup_update_tree(struct mem_cgroup *memcg, struct page *page)
466 struct mem_cgroup_tree_per_node *mctz; 466 struct mem_cgroup_tree_per_node *mctz;
467 467
468 mctz = soft_limit_tree_from_page(page); 468 mctz = soft_limit_tree_from_page(page);
469 if (!mctz)
470 return;
469 /* 471 /*
470 * Necessary to update all ancestors when hierarchy is used. 472 * Necessary to update all ancestors when hierarchy is used.
471 * because their event counter is not touched. 473 * because their event counter is not touched.
@@ -503,7 +505,8 @@ static void mem_cgroup_remove_from_trees(struct mem_cgroup *memcg)
503 for_each_node(nid) { 505 for_each_node(nid) {
504 mz = mem_cgroup_nodeinfo(memcg, nid); 506 mz = mem_cgroup_nodeinfo(memcg, nid);
505 mctz = soft_limit_tree_node(nid); 507 mctz = soft_limit_tree_node(nid);
506 mem_cgroup_remove_exceeded(mz, mctz); 508 if (mctz)
509 mem_cgroup_remove_exceeded(mz, mctz);
507 } 510 }
508} 511}
509 512
@@ -2558,7 +2561,7 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
2558 * is empty. Do it lockless to prevent lock bouncing. Races 2561 * is empty. Do it lockless to prevent lock bouncing. Races
2559 * are acceptable as soft limit is best effort anyway. 2562 * are acceptable as soft limit is best effort anyway.
2560 */ 2563 */
2561 if (RB_EMPTY_ROOT(&mctz->rb_root)) 2564 if (!mctz || RB_EMPTY_ROOT(&mctz->rb_root))
2562 return 0; 2565 return 0;
2563 2566
2564 /* 2567 /*
@@ -4135,17 +4138,22 @@ static void free_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
4135 kfree(memcg->nodeinfo[node]); 4138 kfree(memcg->nodeinfo[node]);
4136} 4139}
4137 4140
4138static void mem_cgroup_free(struct mem_cgroup *memcg) 4141static void __mem_cgroup_free(struct mem_cgroup *memcg)
4139{ 4142{
4140 int node; 4143 int node;
4141 4144
4142 memcg_wb_domain_exit(memcg);
4143 for_each_node(node) 4145 for_each_node(node)
4144 free_mem_cgroup_per_node_info(memcg, node); 4146 free_mem_cgroup_per_node_info(memcg, node);
4145 free_percpu(memcg->stat); 4147 free_percpu(memcg->stat);
4146 kfree(memcg); 4148 kfree(memcg);
4147} 4149}
4148 4150
4151static void mem_cgroup_free(struct mem_cgroup *memcg)
4152{
4153 memcg_wb_domain_exit(memcg);
4154 __mem_cgroup_free(memcg);
4155}
4156
4149static struct mem_cgroup *mem_cgroup_alloc(void) 4157static struct mem_cgroup *mem_cgroup_alloc(void)
4150{ 4158{
4151 struct mem_cgroup *memcg; 4159 struct mem_cgroup *memcg;
@@ -4196,7 +4204,7 @@ static struct mem_cgroup *mem_cgroup_alloc(void)
4196fail: 4204fail:
4197 if (memcg->id.id > 0) 4205 if (memcg->id.id > 0)
4198 idr_remove(&mem_cgroup_idr, memcg->id.id); 4206 idr_remove(&mem_cgroup_idr, memcg->id.id);
4199 mem_cgroup_free(memcg); 4207 __mem_cgroup_free(memcg);
4200 return NULL; 4208 return NULL;
4201} 4209}
4202 4210
diff --git a/mm/mlock.c b/mm/mlock.c
index 1050511f8b2b..02f138244bf5 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -442,7 +442,7 @@ void munlock_vma_pages_range(struct vm_area_struct *vma,
442 442
443 while (start < end) { 443 while (start < end) {
444 struct page *page; 444 struct page *page;
445 unsigned int page_mask; 445 unsigned int page_mask = 0;
446 unsigned long page_increm; 446 unsigned long page_increm;
447 struct pagevec pvec; 447 struct pagevec pvec;
448 struct zone *zone; 448 struct zone *zone;
@@ -456,8 +456,7 @@ void munlock_vma_pages_range(struct vm_area_struct *vma,
456 * suits munlock very well (and if somehow an abnormal page 456 * suits munlock very well (and if somehow an abnormal page
457 * has sneaked into the range, we won't oops here: great). 457 * has sneaked into the range, we won't oops here: great).
458 */ 458 */
459 page = follow_page_mask(vma, start, FOLL_GET | FOLL_DUMP, 459 page = follow_page(vma, start, FOLL_GET | FOLL_DUMP);
460 &page_mask);
461 460
462 if (page && !IS_ERR(page)) { 461 if (page && !IS_ERR(page)) {
463 if (PageTransTail(page)) { 462 if (PageTransTail(page)) {
@@ -468,8 +467,8 @@ void munlock_vma_pages_range(struct vm_area_struct *vma,
468 /* 467 /*
469 * Any THP page found by follow_page_mask() may 468 * Any THP page found by follow_page_mask() may
470 * have gotten split before reaching 469 * have gotten split before reaching
471 * munlock_vma_page(), so we need to recompute 470 * munlock_vma_page(), so we need to compute
472 * the page_mask here. 471 * the page_mask here instead.
473 */ 472 */
474 page_mask = munlock_vma_page(page); 473 page_mask = munlock_vma_page(page);
475 unlock_page(page); 474 unlock_page(page);
diff --git a/mm/rmap.c b/mm/rmap.c
index 2da487d6cea8..250635dc47b7 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1316,12 +1316,6 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
1316 } 1316 }
1317 1317
1318 while (page_vma_mapped_walk(&pvmw)) { 1318 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
1325 /* 1319 /*
1326 * If the page is mlock()d, we cannot swap it out. 1320 * If the page is mlock()d, we cannot swap it out.
1327 * If it's recently referenced (perhaps page_referenced 1321 * 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,
1345 continue; 1339 continue;
1346 } 1340 }
1347 1341
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
1348 if (!(flags & TTU_IGNORE_ACCESS)) { 1349 if (!(flags & TTU_IGNORE_ACCESS)) {
1349 if (ptep_clear_flush_young_notify(vma, address, 1350 if (ptep_clear_flush_young_notify(vma, address,
1350 pvmw.pte)) { 1351 pvmw.pte)) {
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 69f9aff39a2e..b1947f0cbee2 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1065,6 +1065,9 @@ const char * const vmstat_text[] = {
1065 "thp_split_page_failed", 1065 "thp_split_page_failed",
1066 "thp_deferred_split_page", 1066 "thp_deferred_split_page",
1067 "thp_split_pmd", 1067 "thp_split_pmd",
1068#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
1069 "thp_split_pud",
1070#endif
1068 "thp_zero_page_alloc", 1071 "thp_zero_page_alloc",
1069 "thp_zero_page_alloc_failed", 1072 "thp_zero_page_alloc_failed",
1070#endif 1073#endif
diff --git a/scripts/spelling.txt b/scripts/spelling.txt
index 0458b037c8a1..0545f5a8cabe 100644
--- a/scripts/spelling.txt
+++ b/scripts/spelling.txt
@@ -372,6 +372,8 @@ disassocation||disassociation
372disapear||disappear 372disapear||disappear
373disapeared||disappeared 373disapeared||disappeared
374disappared||disappeared 374disappared||disappeared
375disble||disable
376disbled||disabled
375disconnet||disconnect 377disconnet||disconnect
376discontinous||discontinuous 378discontinous||discontinuous
377dispertion||dispersion 379dispertion||dispersion
@@ -732,6 +734,7 @@ oustanding||outstanding
732overaall||overall 734overaall||overall
733overhread||overhead 735overhread||overhead
734overlaping||overlapping 736overlaping||overlapping
737overide||override
735overrided||overridden 738overrided||overridden
736overriden||overridden 739overriden||overridden
737overun||overrun 740overun||overrun
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index ec1067a679da..08b1399d1da2 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -89,7 +89,7 @@ static void acp_reg_write(u32 val, void __iomem *acp_mmio, u32 reg)
89 writel(val, acp_mmio + (reg * 4)); 89 writel(val, acp_mmio + (reg * 4));
90} 90}
91 91
92/* Configure a given dma channel parameters - enable/disble, 92/* Configure a given dma channel parameters - enable/disable,
93 * number of descriptors, priority 93 * number of descriptors, priority
94 */ 94 */
95static void config_acp_dma_channel(void __iomem *acp_mmio, u8 ch_num, 95static void config_acp_dma_channel(void __iomem *acp_mmio, u8 ch_num,
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c
index 11c8d9bc762e..5d19fdf80292 100644
--- a/tools/lguest/lguest.c
+++ b/tools/lguest/lguest.c
@@ -1387,7 +1387,7 @@ static bool pci_data_iowrite(u16 port, u32 mask, u32 val)
1387 /* Allow writing to any other BAR, or expansion ROM */ 1387 /* Allow writing to any other BAR, or expansion ROM */
1388 iowrite(portoff, val, mask, &d->config_words[reg]); 1388 iowrite(portoff, val, mask, &d->config_words[reg]);
1389 return true; 1389 return true;
1390 /* We let them overide latency timer and cacheline size */ 1390 /* We let them override latency timer and cacheline size */
1391 } else if (&d->config_words[reg] == (void *)&d->config.cacheline_size) { 1391 } else if (&d->config_words[reg] == (void *)&d->config.cacheline_size) {
1392 /* Only let them change the first two fields. */ 1392 /* Only let them change the first two fields. */
1393 if (mask == 0xFFFFFFFF) 1393 if (mask == 0xFFFFFFFF)
diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index e2efddf10231..1f5300e56b44 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -132,7 +132,7 @@ else
132 Q = @ 132 Q = @
133endif 133endif
134 134
135# Disable command line variables (CFLAGS) overide from top 135# Disable command line variables (CFLAGS) override from top
136# level Makefile (perf), otherwise build Makefile will get 136# level Makefile (perf), otherwise build Makefile will get
137# the same command line setup. 137# the same command line setup.
138MAKEOVERRIDES= 138MAKEOVERRIDES=
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 47076b15eebe..9b8555ea3459 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -135,7 +135,7 @@ else
135 Q = @ 135 Q = @
136endif 136endif
137 137
138# Disable command line variables (CFLAGS) overide from top 138# Disable command line variables (CFLAGS) override from top
139# level Makefile (perf), otherwise build Makefile will get 139# level Makefile (perf), otherwise build Makefile will get
140# the same command line setup. 140# the same command line setup.
141MAKEOVERRIDES= 141MAKEOVERRIDES=
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 66342804161c..0c03538df74c 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -140,7 +140,7 @@ struct pevent_plugin_option {
140 * struct pevent_plugin_option PEVENT_PLUGIN_OPTIONS[] = { 140 * struct pevent_plugin_option PEVENT_PLUGIN_OPTIONS[] = {
141 * { 141 * {
142 * .name = "option-name", 142 * .name = "option-name",
143 * .plugin_alias = "overide-file-name", (optional) 143 * .plugin_alias = "override-file-name", (optional)
144 * .description = "description of option to show users", 144 * .description = "description of option to show users",
145 * }, 145 * },
146 * { 146 * {
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile
index 4cff7e7ddcc4..41642ba5e318 100644
--- a/tools/testing/selftests/vm/Makefile
+++ b/tools/testing/selftests/vm/Makefile
@@ -1,5 +1,9 @@
1# Makefile for vm selftests 1# Makefile for vm selftests
2 2
3ifndef OUTPUT
4 OUTPUT := $(shell pwd)
5endif
6
3CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) 7CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
4LDLIBS = -lrt 8LDLIBS = -lrt
5TEST_GEN_FILES = compaction_test 9TEST_GEN_FILES = compaction_test