]> Git Repo - linux.git/commitdiff
Merge branch 'akpm' (patches from Andrew)
authorLinus Torvalds <[email protected]>
Fri, 2 Jul 2021 19:08:10 +0000 (12:08 -0700)
committerLinus Torvalds <[email protected]>
Fri, 2 Jul 2021 19:08:10 +0000 (12:08 -0700)
Merge more updates from Andrew Morton:
 "190 patches.

  Subsystems affected by this patch series: mm (hugetlb, userfaultfd,
  vmscan, kconfig, proc, z3fold, zbud, ras, mempolicy, memblock,
  migration, thp, nommu, kconfig, madvise, memory-hotplug, zswap,
  zsmalloc, zram, cleanups, kfence, and hmm), procfs, sysctl, misc,
  core-kernel, lib, lz4, checkpatch, init, kprobes, nilfs2, hfs,
  signals, exec, kcov, selftests, compress/decompress, and ipc"

* emailed patches from Andrew Morton <[email protected]>: (190 commits)
  ipc/util.c: use binary search for max_idx
  ipc/sem.c: use READ_ONCE()/WRITE_ONCE() for use_global_lock
  ipc: use kmalloc for msg_queue and shmid_kernel
  ipc sem: use kvmalloc for sem_undo allocation
  lib/decompressors: remove set but not used variabled 'level'
  selftests/vm/pkeys: exercise x86 XSAVE init state
  selftests/vm/pkeys: refill shadow register after implicit kernel write
  selftests/vm/pkeys: handle negative sys_pkey_alloc() return code
  selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random
  kcov: add __no_sanitize_coverage to fix noinstr for all architectures
  exec: remove checks in __register_bimfmt()
  x86: signal: don't do sas_ss_reset() until we are certain that sigframe won't be abandoned
  hfsplus: report create_date to kstat.btime
  hfsplus: remove unnecessary oom message
  nilfs2: remove redundant continue statement in a while-loop
  kprobes: remove duplicated strong free_insn_page in x86 and s390
  init: print out unknown kernel parameters
  checkpatch: do not complain about positive return values starting with EPOLL
  checkpatch: improve the indented label test
  checkpatch: scripts/spdxcheck.py now requires python3
  ...

49 files changed:
1  2 
Documentation/admin-guide/kernel-parameters.txt
MAINTAINERS
arch/arm/Kconfig
arch/arm64/Kconfig
arch/arm64/include/asm/memory.h
arch/arm64/include/asm/page.h
arch/arm64/include/asm/pgtable.h
arch/arm64/kernel/setup.c
arch/arm64/kvm/mmu.c
arch/arm64/mm/init.c
arch/arm64/mm/mmu.c
arch/mips/Kconfig
arch/mips/include/asm/pgalloc.h
arch/s390/Kconfig
arch/s390/kernel/kprobes.c
arch/x86/Kconfig
arch/x86/include/asm/desc.h
arch/x86/kernel/cpu/mshyperv.c
arch/x86/kernel/kprobes/core.c
arch/x86/kernel/setup.c
drivers/block/zram/zram_drv.h
drivers/clk/analogbits/wrpll-cln28hpc.c
drivers/net/ipa/ipa_smp2p.c
fs/exec.c
fs/open.c
fs/userfaultfd.c
include/asm-generic/bug.h
include/linux/compiler_types.h
include/linux/hugetlb.h
include/linux/kernel.h
include/linux/kprobes.h
include/linux/mm.h
include/linux/mm_types.h
include/linux/page-flags.h
include/linux/shmem_fs.h
init/main.c
ipc/shm.c
kernel/hung_task.c
kernel/kprobes.c
kernel/signal.c
kernel/sysctl.c
lib/Kconfig.debug
lib/kstrtox.c
lib/vsprintf.c
mm/compaction.c
mm/memcontrol.c
mm/mlock.c
mm/page_alloc.c
mm/shmem.c

index 0315407f5f57b2d5c43facd1619a0a73935777e1,c4e34420a4854dbb9f0b26fed803b914ae9df0f4..13f13fdd47319d09c13ac98a8c985f8805b18b8c
                        the GPE dispatcher.
                        This facility can be used to prevent such uncontrolled
                        GPE floodings.
 -                      Format: <byte>
 +                      Format: <byte> or <bitmap-list>
  
        acpi_no_auto_serialize  [HW,ACPI]
                        Disable auto-serialization of AML methods
        ccw_timeout_log [S390]
                        See Documentation/s390/common_io.rst for details.
  
 -      cgroup_disable= [KNL] Disable a particular controller
 -                      Format: {name of the controller(s) to disable}
 +      cgroup_disable= [KNL] Disable a particular controller or optional feature
 +                      Format: {name of the controller(s) or feature(s) to disable}
                        The effects of cgroup_disable=foo are:
                        - foo isn't auto-mounted if you mount all cgroups in
                          a single hierarchy
                        - foo isn't visible as an individually mountable
                          subsystem
 +                      - if foo is an optional feature then the feature is
 +                        disabled and corresponding cgroup files are not
 +                        created
                        {Currently only "memory" controller deal with this and
                        cut the overhead, others just disable the usage. So
                        only cgroup_disable=memory is actually worthy}
 +                      Specifying "pressure" disables per-cgroup pressure
 +                      stall information accounting feature
  
        cgroup_no_v1=   [KNL] Disable cgroup controllers and named hierarchies in v1
                        Format: { { controller | "all" | "named" }
                        loops can be debugged more effectively on production
                        systems.
  
 +      clocksource.max_cswd_read_retries= [KNL]
 +                      Number of clocksource_watchdog() retries due to
 +                      external delays before the clock will be marked
 +                      unstable.  Defaults to three retries, that is,
 +                      four attempts to read the clock under test.
 +
 +      clocksource.verify_n_cpus= [KNL]
 +                      Limit the number of CPUs checked for clocksources
 +                      marked with CLOCK_SOURCE_VERIFY_PERCPU that
 +                      are marked unstable due to excessive skew.
 +                      A negative value says to check all CPUs, while
 +                      zero says not to check any.  Values larger than
 +                      nr_cpu_ids are silently truncated to nr_cpu_ids.
 +                      The actual CPUs are chosen randomly, with
 +                      no replacement if the same CPU is chosen twice.
 +
 +      clocksource-wdtest.holdoff= [KNL]
 +                      Set the time in seconds that the clocksource
 +                      watchdog test waits before commencing its tests.
 +                      Defaults to zero when built as a module and to
 +                      10 seconds when built into the kernel.
 +
        clearcpuid=BITNUM[,BITNUM...] [X86]
                        Disable CPUID feature X for the kernel. See
                        arch/x86/include/asm/cpufeatures.h for the valid bit
                        Documentation/admin-guide/mm/hugetlbpage.rst.
                        Format: size[KMG]
  
+       hugetlb_free_vmemmap=
+                       [KNL] Reguires CONFIG_HUGETLB_PAGE_FREE_VMEMMAP
+                       enabled.
+                       Allows heavy hugetlb users to free up some more
+                       memory (6 * PAGE_SIZE for each 2MB hugetlb page).
+                       Format: { on | off (default) }
+                       on:  enable the feature
+                       off: disable the feature
+                       Built with CONFIG_HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON=y,
+                       the default is on.
+                       This is not compatible with memory_hotplug.memmap_on_memory.
+                       If both parameters are enabled, hugetlb_free_vmemmap takes
+                       precedence over memory_hotplug.memmap_on_memory.
        hung_task_panic=
                        [KNL] Should the hung task detector generate panics.
                        Format: 0 | 1
                        Note that even when enabled, there are a few cases where
                        the feature is not effective.
  
+                       This is not compatible with hugetlb_free_vmemmap. If
+                       both parameters are enabled, hugetlb_free_vmemmap takes
+                       precedence over memory_hotplug.memmap_on_memory.
        memtest=        [KNL,X86,ARM,PPC,RISCV] Enable memtest
                        Format: <integer>
                        default : 0 <disable>
  
        noclflush       [BUGS=X86] Don't use the CLFLUSH instruction
  
 -      nodelayacct     [KNL] Disable per-task delay accounting
 +      delayacct       [KNL] Enable per-task delay accounting
  
        nodsp           [SH] Disable hardware DSP at boot time.
  
  
        nr_uarts=       [SERIAL] maximum number of UARTs to be registered.
  
 +      numa=off        [KNL, ARM64, PPC, RISCV, SPARC, X86] Disable NUMA, Only
 +                      set up a single NUMA node spanning all memory.
 +
        numa_balancing= [KNL,ARM64,PPC,RISCV,S390,X86] Enable or disable automatic
                        NUMA balancing.
                        Allowed values are enable and disable
                        Reserves a hole at the top of the kernel virtual
                        address space.
  
 -      reservelow=     [X86]
 -                      Format: nn[K]
 -                      Set the amount of memory to reserve for BIOS at
 -                      the bottom of the address space.
 -
        reset_devices   [KNL] Force drivers to reset the underlying device
                        during initialization.
  
                                  exception. Default behavior is by #AC if
                                  both features are enabled in hardware.
  
 +                      ratelimit:N -
 +                                Set system wide rate limit to N bus locks
 +                                per second for bus lock detection.
 +                                0 < N <= 1000.
 +
 +                                N/A for split lock detection.
 +
 +
                        If an #AC exception is hit in the kernel or in
                        firmware (i.e. not while executing in user mode)
                        the kernel will oops in either "warn" or "fatal"
diff --combined MAINTAINERS
index e5891bbf5443ef2bbca8c6fbdcf826097221b471,eae74c5a06b3ab72dbf666c023246781a4d8aed2..0d9d8fbd9e92958ba22aa093ce409c37418747bb
@@@ -878,7 -878,7 +878,7 @@@ M: Harry Wentland <[email protected]
  M:    Leo Li <[email protected]>
  L:    [email protected]
  S:    Supported
 -T:    git git://people.freedesktop.org/~agd5f/linux
 +T:    git https://gitlab.freedesktop.org/agd5f/linux.git
  F:    drivers/gpu/drm/amd/display/
  
  AMD FAM15H PROCESSOR POWER MONITORING DRIVER
@@@ -954,7 -954,7 +954,7 @@@ AMD POWERPLA
  M:    Evan Quan <[email protected]>
  L:    [email protected]
  S:    Supported
 -T:    git git://people.freedesktop.org/~agd5f/linux
 +T:    git https://gitlab.freedesktop.org/agd5f/linux.git
  F:    drivers/gpu/drm/amd/pm/powerplay/
  
  AMD SEATTLE DEVICE TREE SUPPORT
@@@ -973,7 -973,7 +973,7 @@@ F: drivers/net/ethernet/amd/xgbe
  
  AMD SENSOR FUSION HUB DRIVER
  M:    Nehal Shah <[email protected]>
 -M:    Sandeep Singh <sandeep.singh@amd.com>
 +M:    Basavaraj Natikar <basavaraj.natikar@amd.com>
  L:    [email protected]
  S:    Maintained
  F:    Documentation/hid/amd-sfh*
@@@ -1655,11 -1655,9 +1655,11 @@@ C:    irc://chat.freenode.net/asahi-de
  T:    git https://github.com/AsahiLinux/linux.git
  F:    Documentation/devicetree/bindings/arm/apple.yaml
  F:    Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
 +F:    Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml
  F:    arch/arm64/boot/dts/apple/
  F:    drivers/irqchip/irq-apple-aic.c
  F:    include/dt-bindings/interrupt-controller/apple-aic.h
 +F:    include/dt-bindings/pinctrl/apple.h
  
  ARM/ARTPEC MACHINE SUPPORT
  M:    Jesper Nilsson <[email protected]>
@@@ -1813,7 -1811,6 +1813,7 @@@ F:      Documentation/devicetree/bindings/ne
  F:    Documentation/devicetree/bindings/pinctrl/cortina,gemini-pinctrl.txt
  F:    Documentation/devicetree/bindings/rtc/faraday,ftrtc010.txt
  F:    arch/arm/mach-gemini/
 +F:    drivers/crypto/gemini/
  F:    drivers/net/ethernet/cortina/
  F:    drivers/pinctrl/pinctrl-gemini.c
  F:    drivers/rtc/rtc-ftrtc010.c
@@@ -1975,7 -1972,6 +1975,7 @@@ F:      Documentation/devicetree/bindings/in
  F:    Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
  F:    arch/arm/mach-ixp4xx/
  F:    drivers/clocksource/timer-ixp4xx.c
 +F:    drivers/crypto/ixp4xx_crypto.c
  F:    drivers/gpio/gpio-ixp4xx.c
  F:    drivers/irqchip/irq-ixp4xx.c
  F:    include/linux/irqchip/irq-ixp4xx.h
@@@ -3739,6 -3735,9 +3739,6 @@@ F:      drivers/gpio/gpio-bcm-kona.
  
  BROADCOM NETXTREME-E ROCE DRIVER
  M:    Selvin Xavier <[email protected]>
 -M:    Devesh Sharma <[email protected]>
 -M:    Somnath Kotur <[email protected]>
 -M:    Sriharsha Basavapatna <[email protected]>
  M:    Naresh Kumar PBS <[email protected]>
  L:    [email protected]
  S:    Supported
@@@ -4446,18 -4445,6 +4446,18 @@@ F:    include/linux/compiler-clang.
  F:    scripts/clang-tools/
  K:    \b(?i:clang|llvm)\b
  
 +CLANG CONTROL FLOW INTEGRITY SUPPORT
 +M:    Sami Tolvanen <[email protected]>
 +M:    Kees Cook <[email protected]>
 +R:    Nathan Chancellor <[email protected]>
 +R:    Nick Desaulniers <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +B:    https://github.com/ClangBuiltLinux/linux/issues
 +T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/clang/features
 +F:    include/linux/cfi.h
 +F:    kernel/cfi.c
 +
  CLEANCACHE API
  M:    Konrad Rzeszutek Wilk <[email protected]>
  L:    [email protected]
@@@ -4623,12 -4610,6 +4623,12 @@@ S:    Supporte
  F:    drivers/video/console/
  F:    include/linux/console*
  
 +CONTEXT TRACKING
 +M:    Frederic Weisbecker <[email protected]>
 +S:    Maintained
 +F:    kernel/context_tracking.c
 +F:    include/linux/context_tracking*
 +
  CONTROL GROUP (CGROUP)
  M:    Tejun Heo <[email protected]>
  M:    Zefan Li <[email protected]>
@@@ -5198,14 -5179,7 +5198,14 @@@ DELL WMI NOTIFICATIONS DRIVE
  M:    Matthew Garrett <[email protected]>
  M:    Pali Rohár <[email protected]>
  S:    Maintained
 -F:    drivers/platform/x86/dell/dell-wmi.c
 +F:    drivers/platform/x86/dell/dell-wmi-base.c
 +
 +DELL WMI HARDWARE PRIVACY SUPPORT
 +M:    Perry Yuan <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/platform/x86/dell/dell-wmi-privacy.c
  
  DELTA ST MEDIA DRIVER
  M:    Hugues Fruchet <[email protected]>
@@@ -5215,13 -5189,6 +5215,13 @@@ W:    https://linuxtv.or
  T:    git git://linuxtv.org/media_tree.git
  F:    drivers/media/platform/sti/delta
  
 +DELTA DPS920AB PSU DRIVER
 +M:    Robert Marko <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/hwmon/dps920ab.rst
 +F:    drivers/hwmon/pmbus/dps920ab.c
 +
  DENALI NAND DRIVER
  L:    [email protected]
  S:    Orphan
@@@ -5911,13 -5878,6 +5911,13 @@@ S:    Orphan / Obsolet
  F:    drivers/gpu/drm/savage/
  F:    include/uapi/drm/savage_drm.h
  
 +DRM DRIVER FOR SIMPLE FRAMEBUFFERS
 +M:    Thomas Zimmermann <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +F:    drivers/gpu/drm/tiny/simpledrm.c
 +
  DRM DRIVER FOR SIS VIDEO CARDS
  S:    Orphan / Obsolete
  F:    drivers/gpu/drm/sis/
@@@ -6125,14 -6085,6 +6125,14 @@@ T:    git git://anongit.freedesktop.org/dr
  F:    Documentation/devicetree/bindings/display/hisilicon/
  F:    drivers/gpu/drm/hisilicon/
  
 +DRM DRIVER FOR HYPERV SYNTHETIC VIDEO DEVICE
 +M:    Deepak Rawat <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Maintained
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +F:    drivers/gpu/drm/hyperv
 +
  DRM DRIVERS FOR LIMA
  M:    Qiang Yu <[email protected]>
  L:    [email protected]
@@@ -6295,7 -6247,7 +6295,7 @@@ M:      Christian Koenig <christian.koenig@a
  M:    Huang Rui <[email protected]>
  L:    [email protected]
  S:    Maintained
 -T:    git git://people.freedesktop.org/~agd5f/linux
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
  F:    drivers/gpu/drm/ttm/
  F:    include/drm/ttm/
  
@@@ -6493,11 -6445,10 +6493,11 @@@ F:   Documentation/filesystems/ecryptfs.r
  F:    fs/ecryptfs/
  
  EDAC-AMD64
 -M:    Borislav Petkov <[email protected]>
 +M:    Yazen Ghannam <[email protected]>
  L:    [email protected]
 -S:    Maintained
 +S:    Supported
  F:    drivers/edac/amd64_edac*
 +F:    drivers/edac/mce_amd*
  
  EDAC-ARMADA
  M:    Jan Luebbe <[email protected]>
@@@ -6778,6 -6729,7 +6778,6 @@@ F:      drivers/net/ethernet/emulex/benet
  
  EMULEX ONECONNECT ROCE DRIVER
  M:    Selvin Xavier <[email protected]>
 -M:    Devesh Sharma <[email protected]>
  L:    [email protected]
  S:    Odd Fixes
  W:    http://www.broadcom.com
@@@ -6819,7 -6771,7 +6819,7 @@@ F:      include/video/s1d13xxxfb.
  
  EROFS FILE SYSTEM
  M:    Gao Xiang <[email protected]>
 -M:    Chao Yu <[email protected]>
 +M:    Chao Yu <[email protected]>
  L:    [email protected]
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
@@@ -6860,8 -6812,6 +6860,8 @@@ F:      Documentation/devicetree/bindings/ne
  F:    Documentation/devicetree/bindings/net/qca,ar803x.yaml
  F:    Documentation/networking/phy.rst
  F:    drivers/net/mdio/
 +F:    drivers/net/mdio/acpi_mdio.c
 +F:    drivers/net/mdio/fwnode_mdio.c
  F:    drivers/net/mdio/of_mdio.c
  F:    drivers/net/pcs/
  F:    drivers/net/phy/
@@@ -7216,7 -7166,7 +7216,7 @@@ F:      include/video
  
  FREESCALE CAAM (Cryptographic Acceleration and Assurance Module) DRIVER
  M:    Horia Geantă <[email protected]>
 -M:    Aymen Sghaier <aymen.sghaier@nxp.com>
 +M:    Pankaj Gupta <pankaj.gupta@nxp.com>
  L:    [email protected]
  S:    Maintained
  F:    Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@@ -7606,12 -7556,6 +7606,12 @@@ M:    Kieran Bingham <[email protected]
  S:    Supported
  F:    scripts/gdb/
  
 +GEMINI CRYPTO DRIVER
 +M:    Corentin Labbe <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/crypto/gemini/
 +
  GEMTEK FM RADIO RECEIVER DRIVER
  M:    Hans Verkuil <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/input/touchscreen/resistive-adc-touch.c
  
+ GENERIC STRING LIBRARY
+ R:    Andy Shevchenko <[email protected]>
+ S:    Maintained
+ F:    lib/string.c
+ F:    lib/string_helpers.c
+ F:    lib/test_string.c
+ F:    lib/test-string_helpers.c
  GENERIC UIO DRIVER FOR PCI DEVICES
  M:    "Michael S. Tsirkin" <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    drivers/i2c/busses/i2c-icy.c
  
 -IDE SUBSYSTEM
 -M:    "David S. Miller" <[email protected]>
 -L:    [email protected]
 -S:    Maintained
 -Q:    http://patchwork.ozlabs.org/project/linux-ide/list/
 -T:    git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide.git
 -F:    Documentation/ide/
 -F:    drivers/ide/
 -F:    include/linux/ide.h
 -
 -IDE/ATAPI DRIVERS
 -L:    [email protected]
 -S:    Orphan
 -F:    Documentation/cdrom/ide-cd.rst
 -F:    drivers/ide/ide-cd*
 -
  IDEAPAD LAPTOP EXTRAS DRIVER
  M:    Ike Panhc <[email protected]>
  L:    [email protected]
@@@ -9178,15 -9146,6 +9186,15 @@@ F:    Documentation/networking/device_driv
  F:    drivers/net/ethernet/intel/
  F:    drivers/net/ethernet/intel/*/
  F:    include/linux/avf/virtchnl.h
 +F:    include/linux/net/intel/iidc.h
 +
 +INTEL ETHERNET PROTOCOL DRIVER FOR RDMA
 +M:    Mustafa Ismail <[email protected]>
 +M:    Shiraz Saleem <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    drivers/infiniband/hw/irdma/
 +F:    include/uapi/rdma/irdma-abi.h
  
  INTEL FRAMEBUFFER DRIVER (excluding 810 and 815)
  M:    Maik Broemme <[email protected]>
@@@ -9292,12 -9251,6 +9300,12 @@@ F:    Documentation/admin-guide/media/ipu3
  F:    Documentation/userspace-api/media/v4l/pixfmt-meta-intel-ipu3.rst
  F:    drivers/staging/media/ipu3/
  
 +INTEL IXP4XX CRYPTO SUPPORT
 +M:    Corentin Labbe <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/crypto/ixp4xx_crypto.c
 +
  INTEL IXP4XX QMGR, NPE, ETHERNET and HSS SUPPORT
  M:    Krzysztof Halasa <[email protected]>
  S:    Maintained
  S:    Supported
  F:    drivers/cpufreq/intel_pstate.c
  
 -INTEL RDMA RNIC DRIVER
 -M:    Faisal Latif <[email protected]>
 -M:    Shiraz Saleem <[email protected]>
 -L:    [email protected]
 -S:    Supported
 -F:    drivers/infiniband/hw/i40iw/
 -F:    include/uapi/rdma/i40iw-abi.h
 -
  INTEL SCU DRIVERS
  M:    Mika Westerberg <[email protected]>
  S:    Maintained
  F:    arch/x86/include/asm/intel_scu_ipc.h
  F:    drivers/platform/x86/intel_scu_*
  
 +INTEL SKYLAKE INT3472 ACPI DEVICE DRIVER
 +M:    Daniel Scally <[email protected]>
 +S:    Maintained
 +F:    drivers/platform/x86/intel/int3472/
 +
  INTEL SPEED SELECT TECHNOLOGY
  M:    Srinivas Pandruvada <[email protected]>
  L:    [email protected]
@@@ -9458,7 -9414,7 +9466,7 @@@ F:      include/linux/firmware/intel/stratix
  F:    include/linux/firmware/intel/stratix10-svc-client.h
  
  INTEL TELEMETRY DRIVER
 -M:    Rajneesh Bhardwaj <[email protected]l.com>
 +M:    Rajneesh Bhardwaj <irenic.rajneesh@gmail.com>
  M:    "David E. Box" <[email protected]>
  L:    [email protected]
  S:    Maintained
  S:    Maintained
  F:    drivers/platform/x86/intel-wmi-thunderbolt.c
  
 +INTEL WWAN IOSM DRIVER
 +M:    M Chetan Kumar <[email protected]>
 +M:    Intel Corporation <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/net/wwan/iosm/
 +
  INTEL(R) TRACE HUB
  M:    Alexander Shishkin <[email protected]>
  S:    Supported
@@@ -9786,14 -9735,6 +9794,14 @@@ Q:    http://patchwork.linuxtv.org/project
  T:    git git://linuxtv.org/anttip/media_tree.git
  F:    drivers/media/tuners/it913x*
  
 +ITE IT66121 HDMI BRIDGE DRIVER
 +M:    Phong LE <[email protected]>
 +M:    Neil Armstrong <[email protected]>
 +S:    Maintained
 +T:    git git://anongit.freedesktop.org/drm/drm-misc
 +F:    Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml
 +F:    drivers/gpu/drm/bridge/ite-it66121.c
 +
  IVTV VIDEO4LINUX DRIVER
  M:    Andy Walls <[email protected]>
  L:    [email protected]
@@@ -10061,8 -10002,6 +10069,8 @@@ F:   arch/arm64/include/asm/kvm
  F:    arch/arm64/include/uapi/asm/kvm*
  F:    arch/arm64/kvm/
  F:    include/kvm/arm_*
 +F:    tools/testing/selftests/kvm/*/aarch64/
 +F:    tools/testing/selftests/kvm/aarch64/
  
  KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)
  M:    Huacai Chen <[email protected]>
@@@ -10928,7 -10867,6 +10936,7 @@@ S:   Maintaine
  F:    drivers/mailbox/
  F:    include/linux/mailbox_client.h
  F:    include/linux/mailbox_controller.h
 +F:    include/dt-bindings/mailbox/
  F:    Documentation/devicetree/bindings/mailbox/
  
  MAILBOX ARM MHUv2
@@@ -11361,7 -11299,6 +11369,7 @@@ F:   include/media/imx.
  
  MEDIA DRIVERS FOR FREESCALE IMX7
  M:    Rui Miguel Silva <[email protected]>
 +M:    Laurent Pinchart <[email protected]>
  L:    [email protected]
  S:    Maintained
  T:    git git://linuxtv.org/media_tree.git
  S:    Supported
  T:    git git://linuxtv.org/media_tree.git
  F:    Documentation/devicetree/bindings/media/renesas,csi2.yaml
 +F:    Documentation/devicetree/bindings/media/renesas,isp.yaml
  F:    Documentation/devicetree/bindings/media/renesas,vin.yaml
  F:    drivers/media/platform/rcar-vin/
  
@@@ -11900,6 -11836,7 +11908,7 @@@ F:   include/linux/mmzone.
  F:    include/linux/pagewalk.h
  F:    include/linux/vmalloc.h
  F:    mm/
+ F:    tools/testing/selftests/vm/
  
  MEMORY TECHNOLOGY DEVICES (MTD)
  M:    Miquel Raynal <[email protected]>
@@@ -12061,13 -11998,11 +12070,13 @@@ MICROCHIP ISC DRIVE
  M:    Eugen Hristev <[email protected]>
  L:    [email protected]
  S:    Supported
 -F:    Documentation/devicetree/bindings/media/atmel-isc.txt
 +F:    Documentation/devicetree/bindings/media/atmel,isc.yaml
 +F:    Documentation/devicetree/bindings/media/microchip,xisc.yaml
  F:    drivers/media/platform/atmel/atmel-isc-base.c
  F:    drivers/media/platform/atmel/atmel-isc-regs.h
  F:    drivers/media/platform/atmel/atmel-isc.h
  F:    drivers/media/platform/atmel/atmel-sama5d2-isc.c
 +F:    drivers/media/platform/atmel/atmel-sama7g5-isc.c
  F:    include/linux/atmel-isc-media.h
  
  MICROCHIP ISI DRIVER
@@@ -12265,7 -12200,7 +12274,7 @@@ M:   Maximilian Luz <luzmaximilian@gmail.
  L:    [email protected]
  S:    Maintained
  W:    https://github.com/linux-surface/surface-aggregator-module
 -C:    irc://chat.freenode.net/##linux-surface
 +C:    irc://irc.libera.chat/linux-surface
  F:    Documentation/driver-api/surface_aggregator/
  F:    drivers/platform/surface/aggregator/
  F:    drivers/platform/surface/surface_acpi_notify.c
@@@ -12461,12 -12396,6 +12470,12 @@@ F: Documentation/userspace-api/media/dr
  F:    drivers/media/pci/meye/
  F:    include/uapi/linux/meye.h
  
 +MOTORCOMM PHY DRIVER
 +M:    Peter Geis <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/net/phy/motorcomm.c
 +
  MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD
  S:    Orphan
  F:    Documentation/driver-api/serial/moxa-smartio.rst
@@@ -12681,7 -12610,7 +12690,7 @@@ S:   Orpha
  F:    drivers/net/ethernet/natsemi/natsemi.c
  
  NCR 5380 SCSI DRIVERS
 -M:    Finn Thain <fthain@telegraphics.com.au>
 +M:    Finn Thain <fthain@linux-m68k.org>
  M:    Michael Schmitz <[email protected]>
  L:    [email protected]
  S:    Maintained
@@@ -12738,7 -12667,6 +12747,7 @@@ W:   http://www.netfilter.org
  W:    http://www.iptables.org/
  W:    http://www.nftables.org/
  Q:    http://patchwork.ozlabs.org/project/netfilter-devel/list/
 +C:    irc://irc.libera.chat/netfilter
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git
  F:    include/linux/netfilter*
@@@ -13154,7 -13082,7 +13163,7 @@@ F:   Documentation/filesystems/ntfs.rs
  F:    fs/ntfs/
  
  NUBUS SUBSYSTEM
 -M:    Finn Thain <fthain@telegraphics.com.au>
 +M:    Finn Thain <fthain@linux-m68k.org>
  L:    [email protected]
  S:    Maintained
  F:    arch/*/include/asm/nubus.h
@@@ -13276,7 -13204,6 +13285,7 @@@ M:   Vladimir Oltean <[email protected]
  L:    [email protected]
  S:    Maintained
  F:    drivers/net/dsa/sja1105
 +F:    drivers/net/pcs/pcs-xpcs-nxp.c
  
  NXP TDA998X DRM DRIVER
  M:    Russell King <[email protected]>
@@@ -15222,13 -15149,6 +15231,13 @@@ S: Maintaine
  F:    Documentation/devicetree/bindings/opp/qcom-nvmem-cpufreq.txt
  F:    drivers/cpufreq/qcom-cpufreq-nvmem.c
  
 +QUALCOMM CRYPTO DRIVERS
 +M:    Thara Gopinath <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/crypto/qce/
 +
  QUALCOMM EMAC GIGABIT ETHERNET DRIVER
  M:    Timur Tabi <[email protected]>
  L:    [email protected]
@@@ -15357,7 -15277,6 +15366,7 @@@ F:   drivers/net/wireless/quantenn
  RADEON and AMDGPU DRM DRIVERS
  M:    Alex Deucher <[email protected]>
  M:    Christian König <[email protected]>
 +M:    Pan, Xinhui <[email protected]>
  L:    [email protected]
  S:    Supported
  T:    git https://gitlab.freedesktop.org/agd5f/linux.git
@@@ -15665,13 -15584,6 +15674,13 @@@ F: include/linux/rpmsg
  F:    include/uapi/linux/rpmsg.h
  F:    samples/rpmsg/
  
 +REMOTE PROCESSOR MESSAGING (RPMSG) WWAN CONTROL DRIVER
 +M:    Stephan Gerhold <[email protected]>
 +L:    [email protected]
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/net/wwan/rpmsg_wwan_ctrl.c
 +
  RENESAS CLOCK DRIVERS
  M:    Geert Uytterhoeven <[email protected]>
  L:    [email protected]
@@@ -15801,14 -15713,6 +15810,14 @@@ F: arch/riscv
  N:    riscv
  K:    riscv
  
 +RISC-V/MICROCHIP POLARFIRE SOC SUPPORT
 +M:    Lewis Hanly <[email protected]>
 +L:    [email protected]
 +S:    Supported
 +F:    drivers/mailbox/mailbox-mpfs.c
 +F:    drivers/soc/microchip/
 +F:    include/soc/microchip/mpfs.h
 +
  RNBD BLOCK DRIVERS
  M:    Md. Haris Iqbal <[email protected]>
  M:    Jack Wang <[email protected]>
@@@ -17110,13 -17014,6 +17119,13 @@@ S: Maintaine
  F:    drivers/ssb/
  F:    include/linux/ssb/
  
 +SONY IMX208 SENSOR DRIVER
 +M:    Sakari Ailus <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +T:    git git://linuxtv.org/media_tree.git
 +F:    drivers/media/i2c/imx208.c
 +
  SONY IMX214 SENSOR DRIVER
  M:    Ricardo Ribalda <[email protected]>
  L:    [email protected]
@@@ -17785,7 -17682,6 +17794,7 @@@ M:   Jose Abreu <[email protected]
  L:    [email protected]
  S:    Supported
  F:    drivers/net/pcs/pcs-xpcs.c
 +F:    drivers/net/pcs/pcs-xpcs.h
  F:    include/linux/pcs/pcs-xpcs.h
  
  SYNOPSYS DESIGNWARE I2C DRIVER
@@@ -18288,13 -18184,6 +18297,13 @@@ W: http://thinkwiki.org/wiki/Ibm-acp
  T:    git git://repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
  F:    drivers/platform/x86/thinkpad_acpi.c
  
 +THINKPAD LMI DRIVER
 +M:    Mark Pearson <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/ABI/testing/sysfs-class-firmware-attributes
 +F:    drivers/platform/x86/think-lmi.?
 +
  THUNDERBOLT DMA TRAFFIC TEST DRIVER
  M:    Isaac Hazan <[email protected]>
  L:    [email protected]
@@@ -19697,10 -19586,6 +19706,10 @@@ F: include/dt-bindings/regulator
  F:    include/linux/regulator/
  K:    regulator_get_optional
  
 +VOLTAGE AND CURRENT REGULATOR IRQ HELPERS
 +R:    Matti Vaittinen <[email protected]>
 +F:    drivers/regulator/irq_helpers.c
 +
  VRF
  M:    David Ahern <[email protected]>
  L:    [email protected]
@@@ -19718,7 -19603,6 +19727,7 @@@ S:   Maintaine
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk.git
  F:    Documentation/core-api/printk-formats.rst
  F:    lib/test_printf.c
 +F:    lib/test_scanf.c
  F:    lib/vsprintf.c
  
  VT1211 HARDWARE MONITOR DRIVER
@@@ -19902,16 -19786,6 +19911,16 @@@ F: Documentation/core-api/workqueue.rs
  F:    include/linux/workqueue.h
  F:    kernel/workqueue.c
  
 +WWAN DRIVERS
 +M:    Loic Poulain <[email protected]>
 +M:    Sergey Ryazanov <[email protected]>
 +R:    Johannes Berg <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    drivers/net/wwan/
 +F:    include/linux/wwan.h
 +F:    include/uapi/linux/wwan.h
 +
  X-POWERS AXP288 PMIC DRIVERS
  M:    Hans de Goede <[email protected]>
  S:    Maintained
@@@ -20307,7 -20181,6 +20316,6 @@@ M:   Seth Jennings <[email protected]
  M:    Dan Streetman <[email protected]>
  L:    [email protected]
  S:    Maintained
- F:    include/linux/zbud.h
  F:    mm/zbud.c
  
  ZD1211RW WIRELESS DRIVER
diff --combined arch/arm/Kconfig
index 809317b5a6c653609d13779b8e337b0c55484b68,000c3f80b58e113005a272d1acdfc26a8c74b091..06b6187b67afe1dc66cc5d0fb91639edf4092640
@@@ -218,9 -218,6 +218,6 @@@ config GENERIC_CALIBRATE_DELA
  config ARCH_MAY_HAVE_PC_FDC
        bool
  
- config ZONE_DMA
-       bool
  config ARCH_SUPPORTS_UPROBES
        def_bool y
  
@@@ -353,6 -350,7 +350,6 @@@ config ARCH_EP93X
        select ARM_VIC
        select GENERIC_IRQ_MULTI_HANDLER
        select AUTO_ZRELADDR
 -      select CLKDEV_LOOKUP
        select CLKSRC_MMIO
        select CPU_ARM920T
        select GPIOLIB
@@@ -503,6 -501,7 +500,6 @@@ config ARCH_OMAP
        bool "TI OMAP1"
        depends on MMU
        select ARCH_OMAP
 -      select CLKDEV_LOOKUP
        select CLKSRC_MMIO
        select GENERIC_IRQ_CHIP
        select GENERIC_IRQ_MULTI_HANDLER
diff --combined arch/arm64/Kconfig
index be9083882f97b8a844b31d73ffd6705f7680d4b2,39b378ee56ce18d5a4e6267274eb11ee45c836a6..e07e7de9ac499cf325c65c1fc6d9dfb557e3569f
@@@ -42,6 -42,7 +42,7 @@@ config ARM6
        select ARCH_HAS_SYSCALL_WRAPPER
        select ARCH_HAS_TEARDOWN_DMA_OPS if IOMMU_SUPPORT
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
+       select ARCH_HAS_ZONE_DMA_SET if EXPERT
        select ARCH_HAVE_ELF_PROT
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select ARCH_INLINE_READ_LOCK if !PREEMPTION
@@@ -93,7 -94,6 +94,7 @@@
        select ARCH_WANT_FRAME_POINTERS
        select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
        select ARCH_WANT_LD_ORPHAN_WARN
 +      select ARCH_WANTS_NO_INSTR
        select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARM_AMBA
        select ARM_ARCH_TIMER
        select HAVE_ARCH_KGDB
        select HAVE_ARCH_MMAP_RND_BITS
        select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
-       select HAVE_ARCH_PFN_VALID
        select HAVE_ARCH_PREL32_RELOCATIONS
        select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
        select HAVE_ARCH_SECCOMP_FILTER
@@@ -308,14 -307,6 +308,6 @@@ config GENERIC_CSU
  config GENERIC_CALIBRATE_DELAY
        def_bool y
  
- config ZONE_DMA
-       bool "Support DMA zone" if EXPERT
-       default y
- config ZONE_DMA32
-       bool "Support DMA32 zone" if EXPERT
-       default y
  config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
        def_bool y
  
@@@ -1053,9 -1044,6 +1045,6 @@@ config NEED_PER_CPU_EMBED_FIRST_CHUN
        def_bool y
        depends on NUMA
  
- config HOLES_IN_ZONE
-       def_bool y
  source "kernel/Kconfig.hz"
  
  config ARCH_SPARSEMEM_ENABLE
@@@ -1482,6 -1470,12 +1471,6 @@@ menu "ARMv8.3 architectural features
  config ARM64_PTR_AUTH
        bool "Enable support for pointer authentication"
        default y
 -      depends on (CC_HAS_SIGN_RETURN_ADDRESS || CC_HAS_BRANCH_PROT_PAC_RET) && AS_HAS_PAC
 -      # Modern compilers insert a .note.gnu.property section note for PAC
 -      # which is only understood by binutils starting with version 2.33.1.
 -      depends on LD_IS_LLD || LD_VERSION >= 23301 || (CC_IS_GCC && GCC_VERSION < 90100)
 -      depends on !CC_IS_CLANG || AS_HAS_CFI_NEGATE_RA_STATE
 -      depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
        help
          Pointer authentication (part of the ARMv8.3 Extensions) provides
          instructions for signing and authenticating pointers against secret
          for each process at exec() time, with these keys being
          context-switched along with the process.
  
 -        If the compiler supports the -mbranch-protection or
 -        -msign-return-address flag (e.g. GCC 7 or later), then this option
 -        will also cause the kernel itself to be compiled with return address
 -        protection. In this case, and if the target hardware is known to
 -        support pointer authentication, then CONFIG_STACKPROTECTOR can be
 -        disabled with minimal loss of protection.
 -
          The feature is detected at runtime. If the feature is not present in
          hardware it will not be advertised to userspace/KVM guest nor will it
          be enabled.
          but with the feature disabled. On such a system, this option should
          not be selected.
  
 +config ARM64_PTR_AUTH_KERNEL
 +      bool "Use pointer authentication for kernel"
 +      default y
 +      depends on ARM64_PTR_AUTH
 +      depends on (CC_HAS_SIGN_RETURN_ADDRESS || CC_HAS_BRANCH_PROT_PAC_RET) && AS_HAS_PAC
 +      # Modern compilers insert a .note.gnu.property section note for PAC
 +      # which is only understood by binutils starting with version 2.33.1.
 +      depends on LD_IS_LLD || LD_VERSION >= 23301 || (CC_IS_GCC && GCC_VERSION < 90100)
 +      depends on !CC_IS_CLANG || AS_HAS_CFI_NEGATE_RA_STATE
 +      depends on (!FUNCTION_GRAPH_TRACER || DYNAMIC_FTRACE_WITH_REGS)
 +      help
 +        If the compiler supports the -mbranch-protection or
 +        -msign-return-address flag (e.g. GCC 7 or later), then this option
 +        will cause the kernel itself to be compiled with return address
 +        protection. In this case, and if the target hardware is known to
 +        support pointer authentication, then CONFIG_STACKPROTECTOR can be
 +        disabled with minimal loss of protection.
 +
          This feature works with FUNCTION_GRAPH_TRACER option only if
          DYNAMIC_FTRACE_WITH_REGS is enabled.
  
@@@ -1612,7 -1595,7 +1601,7 @@@ config ARM64_BTI_KERNE
        bool "Use Branch Target Identification for kernel"
        default y
        depends on ARM64_BTI
 -      depends on ARM64_PTR_AUTH
 +      depends on ARM64_PTR_AUTH_KERNEL
        depends on CC_HAS_BRANCH_PROT_PAC_RET_BTI
        # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94697
        depends on !CC_IS_GCC || GCC_VERSION >= 100100
index 1a35a4473598c5900b923cbdef531870c3b5bd8c,9027b7e16c4c3b20d57a4aa8c6d2d3bb19412215..824a3655dd931bc0fd8481ddcae2ed85a4994af1
  #define MT_NORMAL             0
  #define MT_NORMAL_TAGGED      1
  #define MT_NORMAL_NC          2
 -#define MT_NORMAL_WT          3
 -#define MT_DEVICE_nGnRnE      4
 -#define MT_DEVICE_nGnRE               5
 -#define MT_DEVICE_GRE         6
 +#define MT_DEVICE_nGnRnE      3
 +#define MT_DEVICE_nGnRE               4
  
  /*
   * Memory types for Stage-2 translation
@@@ -321,6 -323,22 +321,6 @@@ static inline void *phys_to_virt(phys_a
  #define virt_to_pfn(x)                __phys_to_pfn(__virt_to_phys((unsigned long)(x)))
  #define sym_to_pfn(x)         __phys_to_pfn(__pa_symbol(x))
  
 -#ifdef CONFIG_CFI_CLANG
 -/*
 - * With CONFIG_CFI_CLANG, the compiler replaces function address
 - * references with the address of the function's CFI jump table
 - * entry. The function_nocfi macro always returns the address of the
 - * actual function instead.
 - */
 -#define function_nocfi(x) ({                                          \
 -      void *addr;                                                     \
 -      asm("adrp %0, " __stringify(x) "\n\t"                           \
 -          "add  %0, %0, :lo12:" __stringify(x)                        \
 -          : "=r" (addr));                                             \
 -      addr;                                                           \
 -})
 -#endif
 -
  /*
   *  virt_to_page(x)   convert a _valid_ virtual address to struct page *
   *  virt_addr_valid(x)        indicates whether a virtual address is valid
  
  #define virt_addr_valid(addr) ({                                      \
        __typeof__(addr) __addr = __tag_reset(addr);                    \
-       __is_lm_address(__addr) && pfn_valid(virt_to_pfn(__addr));      \
+       __is_lm_address(__addr) && pfn_is_map_memory(virt_to_pfn(__addr));      \
  })
  
  void dump_mem_limit(void);
index ed1b9dcf12b295288f1c9a9e9b34dd96914717f5,fcbef3eec4b24f579d9f1e7c96e2f97e48cacec1..993a27ea6f543c3087f2f28c7990db54dca3ca4f
@@@ -13,7 -13,6 +13,7 @@@
  #ifndef __ASSEMBLY__
  
  #include <linux/personality.h> /* for READ_IMPLIES_EXEC */
 +#include <linux/types.h> /* for gfp_t */
  #include <asm/pgtable-types.h>
  
  struct page;
@@@ -29,19 -28,16 +29,19 @@@ void copy_user_highpage(struct page *to
  void copy_highpage(struct page *to, struct page *from);
  #define __HAVE_ARCH_COPY_HIGHPAGE
  
 -#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
 -      alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
 -#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
 +struct page *alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma,
 +                                              unsigned long vaddr);
 +#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE_MOVABLE
 +
 +void tag_clear_highpage(struct page *to);
 +#define __HAVE_ARCH_TAG_CLEAR_HIGHPAGE
  
  #define clear_user_page(page, vaddr, pg)      clear_page(page)
  #define copy_user_page(to, from, vaddr, pg)   copy_page(to, from)
  
  typedef struct page *pgtable_t;
  
extern int pfn_valid(unsigned long);
int pfn_is_map_memory(unsigned long pfn);
  
  #include <asm/memory.h>
  
index c0ba8cdfa10a188dee8f964097d8e3394499174e,25f5c04b43cea10b31752a3c5fad5b1fd2f16a32..508c7ffad515cdbbc87e8ee7ef6ac9a168835c3e
@@@ -26,8 -26,6 +26,6 @@@
  
  #define vmemmap                       ((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT))
  
- #define FIRST_USER_ADDRESS    0UL
  #ifndef __ASSEMBLY__
  
  #include <asm/cmpxchg.h>
@@@ -314,25 -312,9 +312,25 @@@ static inline void set_pte_at(struct mm
        if (pte_present(pte) && pte_user_exec(pte) && !pte_special(pte))
                __sync_icache_dcache(pte);
  
 -      if (system_supports_mte() &&
 -          pte_present(pte) && pte_tagged(pte) && !pte_special(pte))
 -              mte_sync_tags(ptep, pte);
 +      /*
 +       * If the PTE would provide user space access to the tags associated
 +       * with it then ensure that the MTE tags are synchronised.  Although
 +       * pte_access_permitted() returns false for exec only mappings, they
 +       * don't expose tags (instruction fetches don't check tags).
 +       */
 +      if (system_supports_mte() && pte_access_permitted(pte, false) &&
 +          !pte_special(pte)) {
 +              pte_t old_pte = READ_ONCE(*ptep);
 +              /*
 +               * We only need to synchronise if the new PTE has tags enabled
 +               * or if swapping in (in which case another mapping may have
 +               * set tags in the past even if this PTE isn't tagged).
 +               * (!pte_none() && !pte_present()) is an open coded version of
 +               * is_swap_pte()
 +               */
 +              if (pte_tagged(pte) || (!pte_none(old_pte) && !pte_present(old_pte)))
 +                      mte_sync_tags(old_pte, pte);
 +      }
  
        __check_racy_pte_update(mm, ptep, pte);
  
@@@ -527,12 -509,13 +525,12 @@@ extern pgprot_t phys_mem_access_prot(st
  
  #define pmd_none(pmd)         (!pmd_val(pmd))
  
 -#define pmd_bad(pmd)          (!(pmd_val(pmd) & PMD_TABLE_BIT))
 -
  #define pmd_table(pmd)                ((pmd_val(pmd) & PMD_TYPE_MASK) == \
                                 PMD_TYPE_TABLE)
  #define pmd_sect(pmd)         ((pmd_val(pmd) & PMD_TYPE_MASK) == \
                                 PMD_TYPE_SECT)
  #define pmd_leaf(pmd)         pmd_sect(pmd)
 +#define pmd_bad(pmd)          (!pmd_table(pmd))
  
  #define pmd_leaf_size(pmd)    (pmd_cont(pmd) ? CONT_PMD_SIZE : PMD_SIZE)
  #define pte_leaf_size(pte)    (pte_cont(pte) ? CONT_PTE_SIZE : PAGE_SIZE)
@@@ -619,7 -602,7 +617,7 @@@ static inline unsigned long pmd_page_va
        pr_err("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e))
  
  #define pud_none(pud)         (!pud_val(pud))
 -#define pud_bad(pud)          (!(pud_val(pud) & PUD_TABLE_BIT))
 +#define pud_bad(pud)          (!pud_table(pud))
  #define pud_present(pud)      pte_present(pud_pte(pud))
  #define pud_leaf(pud)         pud_sect(pud)
  #define pud_valid(pud)                pte_valid(pud_pte(pud))
index 8ed66142b0887d46159edab6249d93780a9e8ddd,787bc0f601b36eb533fe1c000d00413474d0dcad..880f40bae60edb3f4e1111e9e10963cbeb8e13d3
@@@ -23,6 -23,7 +23,7 @@@
  #include <linux/interrupt.h>
  #include <linux/smp.h>
  #include <linux/fs.h>
+ #include <linux/panic_notifier.h>
  #include <linux/proc_fs.h>
  #include <linux/memblock.h>
  #include <linux/of_fdt.h>
@@@ -87,6 -88,12 +88,6 @@@ void __init smp_setup_processor_id(void
        u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
        set_cpu_logical_map(0, mpidr);
  
 -      /*
 -       * clear __my_cpu_offset on boot CPU to avoid hang caused by
 -       * using percpu variable early, for example, lockdep will
 -       * access percpu variable inside lock_release
 -       */
 -      set_my_cpu_offset(0);
        pr_info("Booting Linux on physical CPU 0x%010lx [0x%08x]\n",
                (unsigned long)mpidr, read_cpuid_id());
  }
@@@ -375,7 -382,7 +376,7 @@@ void __init __no_sanitize_address setup
         * faults in case uaccess_enable() is inadvertently called by the init
         * thread.
         */
 -      init_task.thread_info.ttbr0 = __pa_symbol(reserved_pg_dir);
 +      init_task.thread_info.ttbr0 = phys_to_ttbr(__pa_symbol(reserved_pg_dir));
  #endif
  
        if (boot_args[1] || boot_args[2] || boot_args[3]) {
diff --combined arch/arm64/kvm/mmu.c
index f23dfa06433b39cd52ba60769feefe6007b0fc70,5e0d40f9fb867816c4cfdb141717ea56b9a944e7..3155c9e778f0a83e89d69f3dfa66e9a70852d17f
@@@ -85,7 -85,7 +85,7 @@@ void kvm_flush_remote_tlbs(struct kvm *
  
  static bool kvm_is_device_pfn(unsigned long pfn)
  {
-       return !pfn_valid(pfn);
+       return !pfn_is_map_memory(pfn);
  }
  
  static void *stage2_memcache_zalloc_page(void *arg)
@@@ -126,16 -126,6 +126,16 @@@ static void *kvm_host_va(phys_addr_t ph
        return __va(phys);
  }
  
 +static void clean_dcache_guest_page(void *va, size_t size)
 +{
 +      __clean_dcache_guest_page(va, size);
 +}
 +
 +static void invalidate_icache_guest_page(void *va, size_t size)
 +{
 +      __invalidate_icache_guest_page(va, size);
 +}
 +
  /*
   * Unmapping vs dcache management:
   *
@@@ -442,8 -432,6 +442,8 @@@ static struct kvm_pgtable_mm_ops kvm_s2
        .page_count             = kvm_host_page_count,
        .phys_to_virt           = kvm_host_va,
        .virt_to_phys           = kvm_host_pa,
 +      .dcache_clean_inval_poc = clean_dcache_guest_page,
 +      .icache_inval_pou       = invalidate_icache_guest_page,
  };
  
  /**
@@@ -705,6 -693,16 +705,6 @@@ void kvm_arch_mmu_enable_log_dirty_pt_m
        kvm_mmu_write_protect_pt_masked(kvm, slot, gfn_offset, mask);
  }
  
 -static void clean_dcache_guest_page(kvm_pfn_t pfn, unsigned long size)
 -{
 -      __clean_dcache_guest_page(pfn, size);
 -}
 -
 -static void invalidate_icache_guest_page(kvm_pfn_t pfn, unsigned long size)
 -{
 -      __invalidate_icache_guest_page(pfn, size);
 -}
 -
  static void kvm_send_hwpoison_signal(unsigned long address, short lsb)
  {
        send_sig_mceerr(BUS_MCEERR_AR, (void __user *)address, lsb, current);
@@@ -824,74 -822,6 +824,74 @@@ transparent_hugepage_adjust(struct kvm_
        return PAGE_SIZE;
  }
  
 +static int get_vma_page_shift(struct vm_area_struct *vma, unsigned long hva)
 +{
 +      unsigned long pa;
 +
 +      if (is_vm_hugetlb_page(vma) && !(vma->vm_flags & VM_PFNMAP))
 +              return huge_page_shift(hstate_vma(vma));
 +
 +      if (!(vma->vm_flags & VM_PFNMAP))
 +              return PAGE_SHIFT;
 +
 +      VM_BUG_ON(is_vm_hugetlb_page(vma));
 +
 +      pa = (vma->vm_pgoff << PAGE_SHIFT) + (hva - vma->vm_start);
 +
 +#ifndef __PAGETABLE_PMD_FOLDED
 +      if ((hva & (PUD_SIZE - 1)) == (pa & (PUD_SIZE - 1)) &&
 +          ALIGN_DOWN(hva, PUD_SIZE) >= vma->vm_start &&
 +          ALIGN(hva, PUD_SIZE) <= vma->vm_end)
 +              return PUD_SHIFT;
 +#endif
 +
 +      if ((hva & (PMD_SIZE - 1)) == (pa & (PMD_SIZE - 1)) &&
 +          ALIGN_DOWN(hva, PMD_SIZE) >= vma->vm_start &&
 +          ALIGN(hva, PMD_SIZE) <= vma->vm_end)
 +              return PMD_SHIFT;
 +
 +      return PAGE_SHIFT;
 +}
 +
 +/*
 + * The page will be mapped in stage 2 as Normal Cacheable, so the VM will be
 + * able to see the page's tags and therefore they must be initialised first. If
 + * PG_mte_tagged is set, tags have already been initialised.
 + *
 + * The race in the test/set of the PG_mte_tagged flag is handled by:
 + * - preventing VM_SHARED mappings in a memslot with MTE preventing two VMs
 + *   racing to santise the same page
 + * - mmap_lock protects between a VM faulting a page in and the VMM performing
 + *   an mprotect() to add VM_MTE
 + */
 +static int sanitise_mte_tags(struct kvm *kvm, kvm_pfn_t pfn,
 +                           unsigned long size)
 +{
 +      unsigned long i, nr_pages = size >> PAGE_SHIFT;
 +      struct page *page;
 +
 +      if (!kvm_has_mte(kvm))
 +              return 0;
 +
 +      /*
 +       * pfn_to_online_page() is used to reject ZONE_DEVICE pages
 +       * that may not support tags.
 +       */
 +      page = pfn_to_online_page(pfn);
 +
 +      if (!page)
 +              return -EFAULT;
 +
 +      for (i = 0; i < nr_pages; i++, page++) {
 +              if (!test_bit(PG_mte_tagged, &page->flags)) {
 +                      mte_clear_page_tags(page_address(page));
 +                      set_bit(PG_mte_tagged, &page->flags);
 +              }
 +      }
 +
 +      return 0;
 +}
 +
  static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
                          struct kvm_memory_slot *memslot, unsigned long hva,
                          unsigned long fault_status)
        bool write_fault, writable, force_pte = false;
        bool exec_fault;
        bool device = false;
 +      bool shared;
        unsigned long mmu_seq;
        struct kvm *kvm = vcpu->kvm;
        struct kvm_mmu_memory_cache *memcache = &vcpu->arch.mmu_page_cache;
                return -EFAULT;
        }
  
 -      /* Let's check if we will get back a huge page backed by hugetlbfs */
 +      /*
 +       * Let's check if we will get back a huge page backed by hugetlbfs, or
 +       * get block mapping for device MMIO region.
 +       */
        mmap_read_lock(current->mm);
        vma = vma_lookup(current->mm, hva);
        if (unlikely(!vma)) {
                return -EFAULT;
        }
  
 -      if (is_vm_hugetlb_page(vma))
 -              vma_shift = huge_page_shift(hstate_vma(vma));
 -      else
 -              vma_shift = PAGE_SHIFT;
 -
 -      if (logging_active ||
 -          (vma->vm_flags & VM_PFNMAP)) {
 +      /*
 +       * logging_active is guaranteed to never be true for VM_PFNMAP
 +       * memslots.
 +       */
 +      if (logging_active) {
                force_pte = true;
                vma_shift = PAGE_SHIFT;
 +      } else {
 +              vma_shift = get_vma_page_shift(vma, hva);
        }
  
 +      shared = (vma->vm_flags & VM_PFNMAP);
 +
        switch (vma_shift) {
  #ifndef __PAGETABLE_PMD_FOLDED
        case PUD_SHIFT:
                return -EFAULT;
  
        if (kvm_is_device_pfn(pfn)) {
 +              /*
 +               * If the page was identified as device early by looking at
 +               * the VMA flags, vma_pagesize is already representing the
 +               * largest quantity we can map.  If instead it was mapped
 +               * via gfn_to_pfn_prot(), vma_pagesize is set to PAGE_SIZE
 +               * and must not be upgraded.
 +               *
 +               * In both cases, we don't let transparent_hugepage_adjust()
 +               * change things at the last minute.
 +               */
                device = true;
 -              force_pte = true;
        } else if (logging_active && !write_fault) {
                /*
                 * Only actually map the page as writable if this was a write
         * If we are not forced to use page mapping, check if we are
         * backed by a THP and thus use block mapping if possible.
         */
 -      if (vma_pagesize == PAGE_SIZE && !force_pte)
 +      if (vma_pagesize == PAGE_SIZE && !(force_pte || device))
                vma_pagesize = transparent_hugepage_adjust(memslot, hva,
                                                           &pfn, &fault_ipa);
 +
 +      if (fault_status != FSC_PERM && !device && kvm_has_mte(kvm)) {
 +              /* Check the VMM hasn't introduced a new VM_SHARED VMA */
 +              if (!shared)
 +                      ret = sanitise_mte_tags(kvm, pfn, vma_pagesize);
 +              else
 +                      ret = -EFAULT;
 +              if (ret)
 +                      goto out_unlock;
 +      }
 +
        if (writable)
                prot |= KVM_PGTABLE_PROT_W;
  
 -      if (fault_status != FSC_PERM && !device)
 -              clean_dcache_guest_page(pfn, vma_pagesize);
 -
 -      if (exec_fault) {
 +      if (exec_fault)
                prot |= KVM_PGTABLE_PROT_X;
 -              invalidate_icache_guest_page(pfn, vma_pagesize);
 -      }
  
        if (device)
                prot |= KVM_PGTABLE_PROT_DEVICE;
@@@ -1259,22 -1168,19 +1259,22 @@@ bool kvm_unmap_gfn_range(struct kvm *kv
  bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
  {
        kvm_pfn_t pfn = pte_pfn(range->pte);
 +      int ret;
  
        if (!kvm->arch.mmu.pgt)
                return false;
  
        WARN_ON(range->end - range->start != 1);
  
 -      /*
 -       * We've moved a page around, probably through CoW, so let's treat it
 -       * just like a translation fault and clean the cache to the PoC.
 -       */
 -      clean_dcache_guest_page(pfn, PAGE_SIZE);
 +      ret = sanitise_mte_tags(kvm, pfn, PAGE_SIZE);
 +      if (ret)
 +              return false;
  
        /*
 +       * We've moved a page around, probably through CoW, so let's treat
 +       * it just like a translation fault and the map handler will clean
 +       * the cache to the PoC.
 +       *
         * The MMU notifiers will have unmapped a huge PMD before calling
         * ->change_pte() (which in turn calls kvm_set_spte_gfn()) and
         * therefore we never need to clear out a huge PMD through this
@@@ -1440,6 -1346,7 +1440,6 @@@ int kvm_arch_prepare_memory_region(stru
  {
        hva_t hva = mem->userspace_addr;
        hva_t reg_end = hva + mem->memory_size;
 -      bool writable = !(mem->flags & KVM_MEM_READONLY);
        int ret = 0;
  
        if (change != KVM_MR_CREATE && change != KVM_MR_MOVE &&
        mmap_read_lock(current->mm);
        /*
         * A memory region could potentially cover multiple VMAs, and any holes
 -       * between them, so iterate over all of them to find out if we can map
 -       * any of them right now.
 +       * between them, so iterate over all of them.
         *
         *     +--------------------------------------------+
         * +---------------+----------------+   +----------------+
         */
        do {
                struct vm_area_struct *vma;
 -              hva_t vm_start, vm_end;
  
                vma = find_vma_intersection(current->mm, hva, reg_end);
                if (!vma)
                        break;
  
                /*
 -               * Take the intersection of this VMA with the memory region
 +               * VM_SHARED mappings are not allowed with MTE to avoid races
 +               * when updating the PG_mte_tagged page flag, see
 +               * sanitise_mte_tags for more details.
                 */
 -              vm_start = max(hva, vma->vm_start);
 -              vm_end = min(reg_end, vma->vm_end);
 +              if (kvm_has_mte(kvm) && vma->vm_flags & VM_SHARED)
 +                      return -EINVAL;
  
                if (vma->vm_flags & VM_PFNMAP) {
 -                      gpa_t gpa = mem->guest_phys_addr +
 -                                  (vm_start - mem->userspace_addr);
 -                      phys_addr_t pa;
 -
 -                      pa = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT;
 -                      pa += vm_start - vma->vm_start;
 -
                        /* IO region dirty page logging not allowed */
                        if (memslot->flags & KVM_MEM_LOG_DIRTY_PAGES) {
                                ret = -EINVAL;
 -                              goto out;
 -                      }
 -
 -                      ret = kvm_phys_addr_ioremap(kvm, gpa, pa,
 -                                                  vm_end - vm_start,
 -                                                  writable);
 -                      if (ret)
                                break;
 +                      }
                }
 -              hva = vm_end;
 +              hva = min(reg_end, vma->vm_end);
        } while (hva < reg_end);
  
 -      if (change == KVM_MR_FLAGS_ONLY)
 -              goto out;
 -
 -      spin_lock(&kvm->mmu_lock);
 -      if (ret)
 -              unmap_stage2_range(&kvm->arch.mmu, mem->guest_phys_addr, mem->memory_size);
 -      else if (!cpus_have_final_cap(ARM64_HAS_STAGE2_FWB))
 -              stage2_flush_memslot(kvm, memslot);
 -      spin_unlock(&kvm->mmu_lock);
 -out:
        mmap_read_unlock(current->mm);
        return ret;
  }
diff --combined arch/arm64/mm/init.c
index 6e1ca044ca907cd02dc7018296514a94bb298c4e,49019ea0c8a80419ae7e25ed1f8db4cb8378fbb5..8490ed2917ff2430bc3f17b743355a89bed038f5
@@@ -219,42 -219,17 +219,17 @@@ static void __init zone_sizes_init(unsi
        free_area_init(max_zone_pfns);
  }
  
- int pfn_valid(unsigned long pfn)
+ int pfn_is_map_memory(unsigned long pfn)
  {
        phys_addr_t addr = PFN_PHYS(pfn);
-       struct mem_section *ms;
-       /*
-        * Ensure the upper PAGE_SHIFT bits are clear in the
-        * pfn. Else it might lead to false positives when
-        * some of the upper bits are set, but the lower bits
-        * match a valid pfn.
-        */
-       if (PHYS_PFN(addr) != pfn)
-               return 0;
-       if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
-               return 0;
  
-       ms = __pfn_to_section(pfn);
-       if (!valid_section(ms))
+       /* avoid false positives for bogus PFNs, see comment in pfn_valid() */
+       if (PHYS_PFN(addr) != pfn)
                return 0;
  
-       /*
-        * ZONE_DEVICE memory does not have the memblock entries.
-        * memblock_is_map_memory() check for ZONE_DEVICE based
-        * addresses will always fail. Even the normal hotplugged
-        * memory will never have MEMBLOCK_NOMAP flag set in their
-        * memblock entries. Skip memblock search for all non early
-        * memory sections covering all of hotplug memory including
-        * both normal and ZONE_DEVICE based.
-        */
-       if (!early_section(ms))
-               return pfn_section_valid(ms, pfn);
        return memblock_is_map_memory(addr);
  }
- EXPORT_SYMBOL(pfn_valid);
+ EXPORT_SYMBOL(pfn_is_map_memory);
  
  static phys_addr_t memory_limit = PHYS_ADDR_MAX;
  
@@@ -499,13 -474,6 +474,13 @@@ void __init mem_init(void
        BUILD_BUG_ON(TASK_SIZE_32 > DEFAULT_MAP_WINDOW_64);
  #endif
  
 +      /*
 +       * Selected page table levels should match when derived from
 +       * scratch using the virtual address range and page size.
 +       */
 +      BUILD_BUG_ON(ARM64_HW_PGTABLE_LEVELS(CONFIG_ARM64_VA_BITS) !=
 +                   CONFIG_PGTABLE_LEVELS);
 +
        if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
                extern int sysctl_overcommit_memory;
                /*
diff --combined arch/arm64/mm/mmu.c
index 0b28cc218091621c963465fd5b01404eb488614e,7553a7eab3db1d55e418bdfd73504901c8b570c3..595fde9a47dd51d2bfc90e8a59f82af800a44599
@@@ -82,7 -82,7 +82,7 @@@ void set_swapper_pgd(pgd_t *pgdp, pgd_
  pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
                              unsigned long size, pgprot_t vma_prot)
  {
-       if (!pfn_valid(pfn))
+       if (!pfn_is_map_memory(pfn))
                return pgprot_noncached(vma_prot);
        else if (file->f_flags & O_SYNC)
                return pgprot_writecombine(vma_prot);
@@@ -228,7 -228,7 +228,7 @@@ static void init_pmd(pud_t *pudp, unsig
                next = pmd_addr_end(addr, end);
  
                /* try section mapping first */
 -              if (((addr | next | phys) & ~SECTION_MASK) == 0 &&
 +              if (((addr | next | phys) & ~PMD_MASK) == 0 &&
                    (flags & NO_BLOCK_MAPPINGS) == 0) {
                        pmd_set_huge(pmdp, phys, prot);
  
@@@ -1114,14 -1114,14 +1114,14 @@@ static void free_empty_tables(unsigned 
  }
  #endif
  
 -#if !ARM64_SWAPPER_USES_SECTION_MAPS
 +#if !ARM64_KERNEL_USES_PMD_MAPS
  int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
                struct vmem_altmap *altmap)
  {
        WARN_ON((start < VMEMMAP_START) || (end > VMEMMAP_END));
        return vmemmap_populate_basepages(start, end, node, altmap);
  }
 -#else /* !ARM64_SWAPPER_USES_SECTION_MAPS */
 +#else /* !ARM64_KERNEL_USES_PMD_MAPS */
  int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
                struct vmem_altmap *altmap)
  {
  
        return 0;
  }
 -#endif        /* !ARM64_SWAPPER_USES_SECTION_MAPS */
 +#endif        /* !ARM64_KERNEL_USES_PMD_MAPS */
 +
 +#ifdef CONFIG_MEMORY_HOTPLUG
  void vmemmap_free(unsigned long start, unsigned long end,
                struct vmem_altmap *altmap)
  {
 -#ifdef CONFIG_MEMORY_HOTPLUG
        WARN_ON((start < VMEMMAP_START) || (end > VMEMMAP_END));
  
        unmap_hotplug_range(start, end, true, altmap);
        free_empty_tables(start, end, VMEMMAP_START, VMEMMAP_END);
 -#endif
  }
 +#endif /* CONFIG_MEMORY_HOTPLUG */
  
  static inline pud_t *fixmap_pud(unsigned long addr)
  {
@@@ -1339,6 -1338,7 +1339,7 @@@ void *__init fixmap_remap_fdt(phys_addr
        return dt_virt;
  }
  
+ #if CONFIG_PGTABLE_LEVELS > 3
  int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot)
  {
        pud_t new_pud = pfn_pud(__phys_to_pfn(phys), mk_pud_sect_prot(prot));
        return 1;
  }
  
+ int pud_clear_huge(pud_t *pudp)
+ {
+       if (!pud_sect(READ_ONCE(*pudp)))
+               return 0;
+       pud_clear(pudp);
+       return 1;
+ }
+ #endif
+ #if CONFIG_PGTABLE_LEVELS > 2
  int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot)
  {
        pmd_t new_pmd = pfn_pmd(__phys_to_pfn(phys), mk_pmd_sect_prot(prot));
        return 1;
  }
  
- int pud_clear_huge(pud_t *pudp)
- {
-       if (!pud_sect(READ_ONCE(*pudp)))
-               return 0;
-       pud_clear(pudp);
-       return 1;
- }
  int pmd_clear_huge(pmd_t *pmdp)
  {
        if (!pmd_sect(READ_ONCE(*pmdp)))
        pmd_clear(pmdp);
        return 1;
  }
+ #endif
  
  int pmd_free_pte_page(pmd_t *pmdp, unsigned long addr)
  {
diff --combined arch/mips/Kconfig
index e039e7d542c41a026ac17872ce6fa6008ce87428,d69f4b17d0a65c103290fffc6496f1a0d114dcc9..cee6087cd686bde1e9d7c39de27dc07aa781d183
@@@ -112,7 -112,6 +112,7 @@@ config MACH_INGENI
        select SYS_SUPPORTS_LITTLE_ENDIAN
        select SYS_SUPPORTS_ZBOOT
        select DMA_NONCOHERENT
 +      select ARCH_HAS_SYNC_DMA_FOR_CPU
        select IRQ_MIPS_CPU
        select PINCTRL
        select GPIOLIB
@@@ -202,7 -201,6 +202,7 @@@ config MIPS_ALCHEM
  config AR7
        bool "Texas Instruments AR7"
        select BOOT_ELF32
 +      select COMMON_CLK
        select DMA_NONCOHERENT
        select CEVT_R4K
        select CSRC_R4K
        select SYS_SUPPORTS_ZBOOT_UART16550
        select GPIOLIB
        select VLYNQ
 -      select HAVE_LEGACY_CLK
        help
          Support for the Texas Instruments AR7 System-on-a-Chip
          family: TNETD7100, 7200 and 7300.
@@@ -333,6 -332,7 +333,6 @@@ config BCM63X
        select SWAP_IO_SPACE
        select GPIOLIB
        select MIPS_L1_CACHE_SHIFT_4
 -      select CLKDEV_LOOKUP
        select HAVE_LEGACY_CLK
        help
          Support for BCM63XX based boards
@@@ -428,8 -428,6 +428,8 @@@ config MACH_INGENIC_SO
        select MIPS_GENERIC
        select MACH_INGENIC
        select SYS_SUPPORTS_ZBOOT_UART16550
 +      select CPU_SUPPORTS_CPUFREQ
 +      select MIPS_EXTERNAL_TIMER
  
  config LANTIQ
        bool "Lantiq based platforms"
        select GPIOLIB
        select SWAP_IO_SPACE
        select BOOT_RAW
 -      select CLKDEV_LOOKUP
        select HAVE_LEGACY_CLK
        select USE_OF
        select PINCTRL
@@@ -631,7 -630,6 +631,7 @@@ config MACH_NINTENDO6
  config RALINK
        bool "Ralink based machines"
        select CEVT_R4K
 +      select COMMON_CLK
        select CSRC_R4K
        select BOOT_RAW
        select DMA_NONCOHERENT
        select SYS_SUPPORTS_MIPS16
        select SYS_SUPPORTS_ZBOOT
        select SYS_HAS_EARLY_PRINTK
 -      select CLKDEV_LOOKUP
        select ARCH_HAS_RESET_CONTROLLER
        select RESET_CONTROLLER
  
@@@ -997,6 -996,7 +997,6 @@@ config CAVIUM_OCTEON_SO
        select HAVE_PLAT_FW_INIT_CMDLINE
        select HAVE_PLAT_MEMCPY
        select ZONE_DMA32
 -      select HOLES_IN_ZONE
        select GPIOLIB
        select USE_OF
        select ARCH_SPARSEMEM_ENABLE
@@@ -3274,13 -3274,6 +3274,6 @@@ config I825
        select CLKSRC_I8253
        select CLKEVT_I8253
        select MIPS_EXTERNAL_TIMER
- config ZONE_DMA
-       bool
- config ZONE_DMA32
-       bool
  endmenu
  
  config TRAD_SIGNALS
index d0cf997b4ba84008f9da329419c3f9885ffd0f0c,dd53d0f79cb339915b3bf3cd0c11254cd4d8a647..4b2567d6b2dfbd8e7987ba7d0956b92661dda834
@@@ -28,7 -28,6 +28,6 @@@ static inline void pmd_populate(struct 
  {
        set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
  }
- #define pmd_pgtable(pmd) pmd_page(pmd)
  
  /*
   * Initialize a new pmd table with invalid pointers.
@@@ -59,15 -58,11 +58,15 @@@ do {                                                       
  
  static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
  {
 -      pmd_t *pmd;
 +      pmd_t *pmd = NULL;
 +      struct page *pg;
  
 -      pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, PMD_ORDER);
 -      if (pmd)
 +      pg = alloc_pages(GFP_KERNEL | __GFP_ACCOUNT, PMD_ORDER);
 +      if (pg) {
 +              pgtable_pmd_page_ctor(pg);
 +              pmd = (pmd_t *)page_address(pg);
                pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
 +      }
        return pmd;
  }
  
diff --combined arch/s390/Kconfig
index a49971647f818e77f555b68eaeae114dabe02667,9e14acacb884eeba1bb681238a8739cc4a13cc70..c448567b18ca6e6498fa634ab34d32eba1ea8dc8
@@@ -2,9 -2,6 +2,6 @@@
  config MMU
        def_bool y
  
- config ZONE_DMA
-       def_bool y
  config CPU_BIG_ENDIAN
        def_bool y
  
@@@ -62,7 -59,7 +59,7 @@@ config S39
        select ARCH_BINFMT_ELF_STATE
        select ARCH_ENABLE_MEMORY_HOTPLUG if SPARSEMEM
        select ARCH_ENABLE_MEMORY_HOTREMOVE
-       select ARCH_ENABLE_SPLIT_PMD_PTLOCK
+       select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
        select ARCH_HAS_DEBUG_VM_PGTABLE
        select ARCH_HAS_DEBUG_WX
        select ARCH_HAS_DEVMEM_IS_ALLOWED
        select ARCH_USE_BUILTIN_BSWAP
        select ARCH_USE_CMPXCHG_LOCKREF
        select ARCH_WANTS_DYNAMIC_TASK_STRUCT
 +      select ARCH_WANTS_NO_INSTR
        select ARCH_WANT_DEFAULT_BPF_JIT
        select ARCH_WANT_IPC_PARSE_VERSION
        select BUILDTIME_TABLE_SORT
        select THREAD_INFO_IN_TASK
        select TTY
        select VIRT_CPU_ACCOUNTING
+       select ZONE_DMA
        # Note: keep the above list sorted alphabetically
  
  config SCHED_OMIT_FRAME_POINTER
index 74b0bd2c24d4c134691e5a3e2b5b88f5ace913fb,60cfbd24229b173e0f29a2ab1f542c9657fec4ac..528bb31815c311e76cd7914d11bf315ab937d410
@@@ -44,11 -44,6 +44,6 @@@ void *alloc_insn_page(void
        return page;
  }
  
- void free_insn_page(void *page)
- {
-       module_memfree(page);
- }
  static void *alloc_s390_insn_page(void)
  {
        if (xchg(&insn_page_in_use, 1) == 1)
@@@ -445,6 -440,23 +440,6 @@@ static int kprobe_trap_handler(struct p
                break;
        case KPROBE_HIT_ACTIVE:
        case KPROBE_HIT_SSDONE:
 -              /*
 -               * We increment the nmissed count for accounting,
 -               * we can also use npre/npostfault count for accounting
 -               * these specific fault cases.
 -               */
 -              kprobes_inc_nmissed_count(p);
 -
 -              /*
 -               * We come here because instructions in the pre/post
 -               * handler caused the page_fault, this could happen
 -               * if handler tries to access user space by
 -               * copy_from_user(), get_user() etc. Let the
 -               * user-specified handler try to fix it first.
 -               */
 -              if (p->fault_handler && p->fault_handler(p, regs, trapnr))
 -                      return 1;
 -
                /*
                 * In case the user-specified fault handler returned
                 * zero, try to fix up.
diff --combined arch/x86/Kconfig
index 867e7936dbc548a7dbc495c7f8fd54a628ffe1ad,5f875112f086d95b7ebfd7b5bbaf7ad136d01f2a..49270655e827eed14862c995ab987c2aab61f8e7
@@@ -33,6 -33,7 +33,7 @@@ config X86_6
        select NEED_DMA_MAP_STATE
        select SWIOTLB
        select ARCH_HAS_ELFCORE_COMPAT
+       select ZONE_DMA32
  
  config FORCE_DYNAMIC_FTRACE
        def_bool y
@@@ -63,7 -64,7 +64,7 @@@ config X8
        select ARCH_ENABLE_HUGEPAGE_MIGRATION if X86_64 && HUGETLB_PAGE && MIGRATION
        select ARCH_ENABLE_MEMORY_HOTPLUG if X86_64 || (X86_32 && HIGHMEM)
        select ARCH_ENABLE_MEMORY_HOTREMOVE if MEMORY_HOTPLUG
-       select ARCH_ENABLE_SPLIT_PMD_PTLOCK if X86_64 || X86_PAE
+       select ARCH_ENABLE_SPLIT_PMD_PTLOCK if (PGTABLE_LEVELS > 2) && (X86_64 || X86_PAE)
        select ARCH_ENABLE_THP_MIGRATION if X86_64 && TRANSPARENT_HUGEPAGE
        select ARCH_HAS_ACPI_TABLE_UPGRADE      if ACPI
        select ARCH_HAS_CACHE_LINE_SIZE
@@@ -93,6 -94,7 +94,7 @@@
        select ARCH_HAS_SYSCALL_WRAPPER
        select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARCH_HAS_DEBUG_WX
+       select ARCH_HAS_ZONE_DMA_SET if EXPERT
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
        select ARCH_MIGHT_HAVE_ACPI_PDC         if ACPI
        select ARCH_MIGHT_HAVE_PC_PARPORT
        select ARCH_SUPPORTS_DEBUG_PAGEALLOC
        select ARCH_SUPPORTS_NUMA_BALANCING     if X86_64
        select ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP       if NR_CPUS <= 4096
 -      select ARCH_SUPPORTS_LTO_CLANG          if X86_64
 -      select ARCH_SUPPORTS_LTO_CLANG_THIN     if X86_64
 +      select ARCH_SUPPORTS_LTO_CLANG
 +      select ARCH_SUPPORTS_LTO_CLANG_THIN
        select ARCH_USE_BUILTIN_BSWAP
        select ARCH_USE_MEMTEST
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
        select ARCH_WANT_DEFAULT_BPF_JIT        if X86_64
        select ARCH_WANTS_DYNAMIC_TASK_STRUCT
 +      select ARCH_WANTS_NO_INSTR
        select ARCH_WANT_HUGE_PMD_SHARE
        select ARCH_WANT_LD_ORPHAN_WARN
        select ARCH_WANTS_THP_SWAP              if X86_64
@@@ -344,9 -345,6 +346,6 @@@ config ARCH_SUSPEND_POSSIBL
  config ARCH_WANT_GENERAL_HUGETLB
        def_bool y
  
- config ZONE_DMA32
-       def_bool y if X86_64
  config AUDIT_ARCH
        def_bool y if X86_64
  
@@@ -394,16 -392,6 +393,6 @@@ config CC_HAS_SANE_STACKPROTECTO
  
  menu "Processor type and features"
  
- config ZONE_DMA
-       bool "DMA memory allocation support" if EXPERT
-       default y
-       help
-         DMA memory allocation support allows devices with less than 32-bit
-         addressing to allocate within the first 16MB of address space.
-         Disable if no such devices will be used.
-         If unsure, say Y.
  config SMP
        bool "Symmetric multi-processing support"
        help
@@@ -1694,6 -1682,35 +1683,6 @@@ config X86_BOOTPARAM_MEMORY_CORRUPTION_
          Set whether the default state of memory_corruption_check is
          on or off.
  
 -config X86_RESERVE_LOW
 -      int "Amount of low memory, in kilobytes, to reserve for the BIOS"
 -      default 64
 -      range 4 640
 -      help
 -        Specify the amount of low memory to reserve for the BIOS.
 -
 -        The first page contains BIOS data structures that the kernel
 -        must not use, so that page must always be reserved.
 -
 -        By default we reserve the first 64K of physical RAM, as a
 -        number of BIOSes are known to corrupt that memory range
 -        during events such as suspend/resume or monitor cable
 -        insertion, so it must not be used by the kernel.
 -
 -        You can set this to 4 if you are absolutely sure that you
 -        trust the BIOS to get all its memory reservations and usages
 -        right.  If you know your BIOS have problems beyond the
 -        default 64K area, you can set this to 640 to avoid using the
 -        entire low memory range.
 -
 -        If you have doubts about the BIOS (e.g. suspend/resume does
 -        not work or there's kernel crashes after certain hardware
 -        hotplug events) then you might want to enable
 -        X86_CHECK_BIOS_CORRUPTION=y to allow the kernel to check
 -        typical corruption patterns.
 -
 -        Leave this to the default value of 64 if you are unsure.
 -
  config MATH_EMULATION
        bool
        depends on MODIFY_LDT_SYSCALL
index e63cf582201f8d74abd2238aded53c97ef605052,ceb12683b6d1d96be0d7db30fc7079b9dac174a3..ab97b22ac04a263ab78782a9d00f2237c98e0f20
@@@ -9,6 -9,7 +9,7 @@@
  #include <asm/irq_vectors.h>
  #include <asm/cpu_entry_area.h>
  
+ #include <linux/debug_locks.h>
  #include <linux/smp.h>
  #include <linux/percpu.h>
  
@@@ -224,26 -225,6 +225,26 @@@ static inline void store_idt(struct des
        asm volatile("sidt %0":"=m" (*dtr));
  }
  
 +static inline void native_gdt_invalidate(void)
 +{
 +      const struct desc_ptr invalid_gdt = {
 +              .address = 0,
 +              .size = 0
 +      };
 +
 +      native_load_gdt(&invalid_gdt);
 +}
 +
 +static inline void native_idt_invalidate(void)
 +{
 +      const struct desc_ptr invalid_idt = {
 +              .address = 0,
 +              .size = 0
 +      };
 +
 +      native_load_idt(&invalid_idt);
 +}
 +
  /*
   * The LTR instruction marks the TSS GDT entry as busy. On 64-bit, the GDT is
   * a read-only remapping. To prevent a page fault, the GDT is switched to the
@@@ -441,10 -422,12 +442,10 @@@ extern bool idt_is_f00f_address(unsigne
  
  #ifdef CONFIG_X86_64
  extern void idt_setup_early_pf(void);
 -extern void idt_setup_ist_traps(void);
  #else
  static inline void idt_setup_early_pf(void) { }
 -static inline void idt_setup_ist_traps(void) { }
  #endif
  
 -extern void idt_invalidate(void *addr);
 +extern void idt_invalidate(void);
  
  #endif /* _ASM_X86_DESC_H */
index 01ca94f42e4e970c2b56cfca7b54043b277a0e1a,9e5c6f2b044debe62ab62d7caf2861874a8ec247..cc8f1773deca74bef60d3f3975e74dd565c8b965
@@@ -17,6 -17,7 +17,7 @@@
  #include <linux/irq.h>
  #include <linux/kexec.h>
  #include <linux/i8253.h>
+ #include <linux/panic_notifier.h>
  #include <linux/random.h>
  #include <asm/processor.h>
  #include <asm/hypervisor.h>
@@@ -236,7 -237,7 +237,7 @@@ static void __init hv_smp_prepare_cpus(
        for_each_present_cpu(i) {
                if (i == 0)
                        continue;
 -              ret = hv_call_add_logical_proc(numa_cpu_node(i), i, cpu_physical_id(i));
 +              ret = hv_call_add_logical_proc(numa_cpu_node(i), i, i);
                BUG_ON(ret);
        }
  
  
  static void __init ms_hyperv_init_platform(void)
  {
 +      int hv_max_functions_eax;
        int hv_host_info_eax;
        int hv_host_info_ebx;
        int hv_host_info_ecx;
        ms_hyperv.misc_features = cpuid_edx(HYPERV_CPUID_FEATURES);
        ms_hyperv.hints    = cpuid_eax(HYPERV_CPUID_ENLIGHTMENT_INFO);
  
 +      hv_max_functions_eax = cpuid_eax(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS);
 +
        pr_info("Hyper-V: privilege flags low 0x%x, high 0x%x, hints 0x%x, misc 0x%x\n",
                ms_hyperv.features, ms_hyperv.priv_high, ms_hyperv.hints,
                ms_hyperv.misc_features);
        /*
         * Extract host information.
         */
 -      if (cpuid_eax(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS) >=
 -          HYPERV_CPUID_VERSION) {
 +      if (hv_max_functions_eax >= HYPERV_CPUID_VERSION) {
                hv_host_info_eax = cpuid_eax(HYPERV_CPUID_VERSION);
                hv_host_info_ebx = cpuid_ebx(HYPERV_CPUID_VERSION);
                hv_host_info_ecx = cpuid_ecx(HYPERV_CPUID_VERSION);
                        ms_hyperv.isolation_config_a, ms_hyperv.isolation_config_b);
        }
  
 -      if (ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED) {
 +      if (hv_max_functions_eax >= HYPERV_CPUID_NESTED_FEATURES) {
                ms_hyperv.nested_features =
                        cpuid_eax(HYPERV_CPUID_NESTED_FEATURES);
 +              pr_info("Hyper-V: Nested features: 0x%x\n",
 +                      ms_hyperv.nested_features);
        }
  
        /*
index c492ad3001ca3d043ef302afb23b2e2a2bf08c2d,3bce67d3a03cc8a8f2066cdc188f09ea76111650..b6e046e4b2895138404da91069ac232d9ffdb663
@@@ -422,12 -422,6 +422,6 @@@ void *alloc_insn_page(void
        return page;
  }
  
- /* Recover page to RW mode before releasing it */
- void free_insn_page(void *page)
- {
-       module_memfree(page);
- }
  /* Kprobe x86 instruction emulation - only regs->ip or IF flag modifiers */
  
  static void kprobe_emulate_ifmodifiers(struct kprobe *p, struct pt_regs *regs)
@@@ -674,7 -668,7 +668,7 @@@ static int prepare_emulation(struct kpr
                        break;
  
                if (insn->addr_bytes != sizeof(unsigned long))
 -                      return -EOPNOTSUPP;     /* Don't support differnt size */
 +                      return -EOPNOTSUPP;     /* Don't support different size */
                if (X86_MODRM_MOD(opcode) != 3)
                        return -EOPNOTSUPP;     /* TODO: support memory addressing */
  
@@@ -1102,6 -1096,24 +1096,6 @@@ int kprobe_fault_handler(struct pt_reg
                        restore_previous_kprobe(kcb);
                else
                        reset_current_kprobe();
 -      } else if (kcb->kprobe_status == KPROBE_HIT_ACTIVE ||
 -                 kcb->kprobe_status == KPROBE_HIT_SSDONE) {
 -              /*
 -               * We increment the nmissed count for accounting,
 -               * we can also use npre/npostfault count for accounting
 -               * these specific fault cases.
 -               */
 -              kprobes_inc_nmissed_count(cur);
 -
 -              /*
 -               * We come here because instructions in the pre/post
 -               * handler caused the page_fault, this could happen
 -               * if handler tries to access user space by
 -               * copy_from_user(), get_user() etc. Let the
 -               * user-specified handler try to fix it first.
 -               */
 -              if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
 -                      return 1;
        }
  
        return 0;
diff --combined arch/x86/kernel/setup.c
index 85acd22f8022cf05e19ba8d210fce1d1d9cd7412,d21ba6fa39d9d53915de81fad6505dd814fc0407..9f1d9215a9fb2f1806da18d66426f80575d0bdb9
@@@ -14,6 -14,7 +14,7 @@@
  #include <linux/initrd.h>
  #include <linux/iscsi_ibft.h>
  #include <linux/memblock.h>
+ #include <linux/panic_notifier.h>
  #include <linux/pci.h>
  #include <linux/root_dev.h>
  #include <linux/hugetlb.h>
@@@ -695,6 -696,30 +696,6 @@@ static void __init e820_add_kernel_rang
        e820__range_add(start, size, E820_TYPE_RAM);
  }
  
 -static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
 -
 -static int __init parse_reservelow(char *p)
 -{
 -      unsigned long long size;
 -
 -      if (!p)
 -              return -EINVAL;
 -
 -      size = memparse(p, &p);
 -
 -      if (size < 4096)
 -              size = 4096;
 -
 -      if (size > 640*1024)
 -              size = 640*1024;
 -
 -      reserve_low = size;
 -
 -      return 0;
 -}
 -
 -early_param("reservelow", parse_reservelow);
 -
  static void __init early_reserve_memory(void)
  {
        /*
@@@ -1060,18 -1085,17 +1061,18 @@@ void __init setup_arch(char **cmdline_p
  #endif
  
        /*
 -       * Find free memory for the real mode trampoline and place it
 -       * there.
 -       * If there is not enough free memory under 1M, on EFI-enabled
 -       * systems there will be additional attempt to reclaim the memory
 -       * for the real mode trampoline at efi_free_boot_services().
 +       * Find free memory for the real mode trampoline and place it there. If
 +       * there is not enough free memory under 1M, on EFI-enabled systems
 +       * there will be additional attempt to reclaim the memory for the real
 +       * mode trampoline at efi_free_boot_services().
 +       *
 +       * Unconditionally reserve the entire first 1M of RAM because BIOSes
 +       * are known to corrupt low memory and several hundred kilobytes are not
 +       * worth complex detection what memory gets clobbered. Windows does the
 +       * same thing for very similar reasons.
         *
 -       * Unconditionally reserve the entire first 1M of RAM because
 -       * BIOSes are know to corrupt low memory and several
 -       * hundred kilobytes are not worth complex detection what memory gets
 -       * clobbered. Moreover, on machines with SandyBridge graphics or in
 -       * setups that use crashkernel the entire 1M is reserved anyway.
 +       * Moreover, on machines with SandyBridge graphics or in setups that use
 +       * crashkernel the entire 1M is reserved anyway.
         */
        reserve_real_mode();
  
index 74c411911b6eacc82cd32c69523b3886b14034dc,6e73dc3c276903e07ba06b7d8845e2df30b2f10d..80c3b43b4828fa553a1daaf0403e2c4776ddc3f3
@@@ -112,9 -112,9 +112,9 @@@ struct zram 
        /*
         * zram is claimed so open request will be failed
         */
 -      bool claim; /* Protected by bdev->bd_mutex */
 +      bool claim; /* Protected by disk->open_mutex */
-       struct file *backing_dev;
  #ifdef CONFIG_ZRAM_WRITEBACK
+       struct file *backing_dev;
        spinlock_t wb_limit_lock;
        bool wb_limit_enable;
        u64 bd_wb_limit;
index 3b1947575dcc571506a1bb504a51c7b532b1a3d3,7c64ea52a8d5e73124fac2940a36584a65b818a2..09ca82356399301ccd7e165bc357271dfec532cf
  
  #include <linux/bug.h>
  #include <linux/err.h>
+ #include <linux/limits.h>
  #include <linux/log2.h>
  #include <linux/math64.h>
+ #include <linux/math.h>
+ #include <linux/minmax.h>
  #include <linux/clk/analogbits-wrpll-cln28hpc.h>
  
  /* MIN_INPUT_FREQ: minimum input clock frequency, in Hz (Fref_min) */
@@@ -198,7 -202,7 +202,7 @@@ static int __wrpll_update_parent_rate(s
  }
  
  /**
 - * wrpll_configure() - compute PLL configuration for a target rate
 + * wrpll_configure_for_rate() - compute PLL configuration for a target rate
   * @c: ptr to a struct wrpll_cfg record to write into
   * @target_rate: target PLL output clock rate (post-Q-divider)
   * @parent_rate: PLL input refclk rate (pre-R-divider)
index cf709df70d280810f845ad0b29b550bee32cd95c,34b68dc438869ec3f4cd723cff8639960aff39e7..93270e50b6b3587266fab0c283ad389d3bd885bd
@@@ -8,6 -8,7 +8,7 @@@
  #include <linux/device.h>
  #include <linux/interrupt.h>
  #include <linux/notifier.h>
+ #include <linux/panic_notifier.h>
  #include <linux/soc/qcom/smem.h>
  #include <linux/soc/qcom/smem_state.h>
  
@@@ -176,8 -177,11 +177,8 @@@ static int ipa_smp2p_irq_init(struct ip
        int ret;
  
        ret = platform_get_irq_byname(smp2p->ipa->pdev, name);
 -      if (ret <= 0) {
 -              dev_err(dev, "DT error %d getting \"%s\" IRQ property\n",
 -                      ret, name);
 +      if (ret <= 0)
                return ret ? : -EINVAL;
 -      }
        irq = ret;
  
        ret = request_threaded_irq(irq, NULL, handler, 0, name, smp2p);
diff --combined fs/exec.c
index f2bcdbeb3afb7a970eb7dab58de3134014f6b25e,379afcf5d106e2e3973add48ea3c08e8cdda5d6e..38f63451b92827cef1aebaf948848d286b04900a
+++ b/fs/exec.c
@@@ -84,9 -84,6 +84,6 @@@ static DEFINE_RWLOCK(binfmt_lock)
  
  void __register_binfmt(struct linux_binfmt * fmt, int insert)
  {
-       BUG_ON(!fmt);
-       if (WARN_ON(!fmt->load_binary))
-               return;
        write_lock(&binfmt_lock);
        insert ? list_add(&fmt->lh, &formats) :
                 list_add_tail(&fmt->lh, &formats);
@@@ -1360,10 -1357,6 +1357,10 @@@ int begin_new_exec(struct linux_binprm 
        WRITE_ONCE(me->self_exec_id, me->self_exec_id + 1);
        flush_signal_handlers(me, 0);
  
 +      retval = set_cred_ucounts(bprm->cred);
 +      if (retval < 0)
 +              goto out_unlock;
 +
        /*
         * install the new credentials for this executable
         */
@@@ -1878,7 -1871,7 +1875,7 @@@ static int do_execveat_common(int fd, s
         * whether NPROC limit is still exceeded.
         */
        if ((current->flags & PF_NPROC_EXCEEDED) &&
 -          atomic_read(&current_user()->processes) > rlimit(RLIMIT_NPROC)) {
 +          is_ucounts_overlimit(current_ucounts(), UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC))) {
                retval = -EAGAIN;
                goto out_ret;
        }
diff --combined fs/open.c
index 53bc0573c0eca56633388b8126ad887c089996d2,f76e960d10eaf394700ca57b7d0da3d9cb72bd99..1a325b3194dfebd48075c956579e839f03302ce9
+++ b/fs/open.c
@@@ -852,8 -852,17 +852,17 @@@ static int do_dentry_open(struct file *
         * XXX: Huge page cache doesn't support writing yet. Drop all page
         * cache for this file before processing writes.
         */
-       if ((f->f_mode & FMODE_WRITE) && filemap_nr_thps(inode->i_mapping))
-               truncate_pagecache(inode, 0);
+       if (f->f_mode & FMODE_WRITE) {
+               /*
+                * Paired with smp_mb() in collapse_file() to ensure nr_thps
+                * is up to date and the update to i_writecount by
+                * get_write_access() is visible. Ensures subsequent insertion
+                * of THPs into the page cache will fail.
+                */
+               smp_mb();
+               if (filemap_nr_thps(inode->i_mapping))
+                       truncate_pagecache(inode, 0);
+       }
  
        return 0;
  
@@@ -1002,20 -1011,12 +1011,20 @@@ inline struct open_how build_open_how(i
  
  inline int build_open_flags(const struct open_how *how, struct open_flags *op)
  {
 -      int flags = how->flags;
 +      u64 flags = how->flags;
 +      u64 strip = FMODE_NONOTIFY | O_CLOEXEC;
        int lookup_flags = 0;
        int acc_mode = ACC_MODE(flags);
  
 -      /* Must never be set by userspace */
 -      flags &= ~(FMODE_NONOTIFY | O_CLOEXEC);
 +      BUILD_BUG_ON_MSG(upper_32_bits(VALID_OPEN_FLAGS),
 +                       "struct open_flags doesn't yet handle flags > 32 bits");
 +
 +      /*
 +       * Strip flags that either shouldn't be set by userspace like
 +       * FMODE_NONOTIFY or that aren't relevant in determining struct
 +       * open_flags like O_CLOEXEC.
 +       */
 +      flags &= ~strip;
  
        /*
         * Older syscalls implicitly clear all of the invalid flags or argument
diff --combined fs/userfaultfd.c
index dd7a6c62b56f03e49fd788345d8ac2c69ad204d3,19ebae443ade96cf454bb4b5e79f36beeb47b295..f6e0f0c0d0e577f0be543d9bb3c3bc2cce6891fa
@@@ -337,7 -337,7 +337,7 @@@ out
        return ret;
  }
  
 -static inline long userfaultfd_get_blocking_state(unsigned int flags)
 +static inline unsigned int userfaultfd_get_blocking_state(unsigned int flags)
  {
        if (flags & FAULT_FLAG_INTERRUPTIBLE)
                return TASK_INTERRUPTIBLE;
@@@ -370,7 -370,7 +370,7 @@@ vm_fault_t handle_userfault(struct vm_f
        struct userfaultfd_wait_queue uwq;
        vm_fault_t ret = VM_FAULT_SIGBUS;
        bool must_wait;
 -      long blocking_state;
 +      unsigned int blocking_state;
  
        /*
         * We don't do userfault handling for the final child pid update.
@@@ -1267,8 -1267,7 +1267,7 @@@ static inline bool vma_can_userfault(st
        }
  
        if (vm_flags & VM_UFFD_MINOR) {
-               /* FIXME: Add minor fault interception for shmem. */
-               if (!is_vm_hugetlb_page(vma))
+               if (!(is_vm_hugetlb_page(vma) || vma_is_shmem(vma)))
                        return false;
        }
  
@@@ -1304,8 -1303,12 +1303,12 @@@ static int userfaultfd_register(struct 
        vm_flags = 0;
        if (uffdio_register.mode & UFFDIO_REGISTER_MODE_MISSING)
                vm_flags |= VM_UFFD_MISSING;
-       if (uffdio_register.mode & UFFDIO_REGISTER_MODE_WP)
+       if (uffdio_register.mode & UFFDIO_REGISTER_MODE_WP) {
+ #ifndef CONFIG_HAVE_ARCH_USERFAULTFD_WP
+               goto out;
+ #endif
                vm_flags |= VM_UFFD_WP;
+       }
        if (uffdio_register.mode & UFFDIO_REGISTER_MODE_MINOR) {
  #ifndef CONFIG_HAVE_ARCH_USERFAULTFD_MINOR
                goto out;
@@@ -1941,7 -1944,11 +1944,11 @@@ static int userfaultfd_api(struct userf
        /* report all available features and ioctls to userland */
        uffdio_api.features = UFFD_API_FEATURES;
  #ifndef CONFIG_HAVE_ARCH_USERFAULTFD_MINOR
-       uffdio_api.features &= ~UFFD_FEATURE_MINOR_HUGETLBFS;
+       uffdio_api.features &=
+               ~(UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM);
+ #endif
+ #ifndef CONFIG_HAVE_ARCH_USERFAULTFD_WP
+       uffdio_api.features &= ~UFFD_FEATURE_PAGEFAULT_FLAG_WP;
  #endif
        uffdio_api.ioctls = UFFD_API_IOCTLS;
        ret = -EFAULT;
index bafc51f483c49ab808e5c2dc75ee148c8d405e4f,f152b9bb916fccb4df26f33d87079543bdb71b00..edb0e2a602a89e66d70e196637d8c90a794e075b
@@@ -4,7 -4,6 +4,7 @@@
  
  #include <linux/compiler.h>
  #include <linux/instrumentation.h>
 +#include <linux/once_lite.h>
  
  #define CUT_HERE              "------------[ cut here ]------------\n"
  
@@@ -18,7 -17,8 +18,8 @@@
  #endif
  
  #ifndef __ASSEMBLY__
- #include <linux/kernel.h>
+ #include <linux/panic.h>
+ #include <linux/printk.h>
  
  #ifdef CONFIG_BUG
  
@@@ -141,15 -141,39 +142,15 @@@ void __warn(const char *file, int line
  })
  
  #ifndef WARN_ON_ONCE
 -#define WARN_ON_ONCE(condition)       ({                              \
 -      static bool __section(".data.once") __warned;           \
 -      int __ret_warn_once = !!(condition);                    \
 -                                                              \
 -      if (unlikely(__ret_warn_once && !__warned)) {           \
 -              __warned = true;                                \
 -              WARN_ON(1);                                     \
 -      }                                                       \
 -      unlikely(__ret_warn_once);                              \
 -})
 +#define WARN_ON_ONCE(condition)                                       \
 +      DO_ONCE_LITE_IF(condition, WARN_ON, 1)
  #endif
  
 -#define WARN_ONCE(condition, format...)       ({                      \
 -      static bool __section(".data.once") __warned;           \
 -      int __ret_warn_once = !!(condition);                    \
 -                                                              \
 -      if (unlikely(__ret_warn_once && !__warned)) {           \
 -              __warned = true;                                \
 -              WARN(1, format);                                \
 -      }                                                       \
 -      unlikely(__ret_warn_once);                              \
 -})
 +#define WARN_ONCE(condition, format...)                               \
 +      DO_ONCE_LITE_IF(condition, WARN, 1, format)
  
 -#define WARN_TAINT_ONCE(condition, taint, format...)  ({      \
 -      static bool __section(".data.once") __warned;           \
 -      int __ret_warn_once = !!(condition);                    \
 -                                                              \
 -      if (unlikely(__ret_warn_once && !__warned)) {           \
 -              __warned = true;                                \
 -              WARN_TAINT(1, taint, format);                   \
 -      }                                                       \
 -      unlikely(__ret_warn_once);                              \
 -})
 +#define WARN_TAINT_ONCE(condition, taint, format...)          \
 +      DO_ONCE_LITE_IF(condition, WARN_TAINT, 1, taint, format)
  
  #else /* !CONFIG_BUG */
  #ifndef HAVE_ARCH_BUG
index d509169860f1269b8e8605975f72c0a5e9b7cfd5,cc2bee7f097776b5eed49faba902c58399f49e15..e4ea86fc584d638f1b15131dcf71c2623c5501e3
@@@ -210,7 -210,7 +210,7 @@@ struct ftrace_likely_data 
  /* Section for code which can't be instrumented at all */
  #define noinstr                                                               \
        noinline notrace __attribute((__section__(".noinstr.text")))    \
-       __no_kcsan __no_sanitize_address __no_profile
 -      __no_kcsan __no_sanitize_address __no_sanitize_coverage
++      __no_kcsan __no_sanitize_address __no_profile __no_sanitize_coverage
  
  #endif /* __KERNEL__ */
  
diff --combined include/linux/hugetlb.h
index 8ba79dc64ab828a45fc66a7e7503e4d38c7d17ff,a58e11f2db1512daca636222e3c85ff3903566db..8e0f32f935bd59dac13b55d1d5d9b535ea869271
@@@ -29,6 -29,23 +29,23 @@@ typedef struct { unsigned long pd; } hu
  #include <linux/shm.h>
  #include <asm/tlbflush.h>
  
+ /*
+  * For HugeTLB page, there are more metadata to save in the struct page. But
+  * the head struct page cannot meet our needs, so we have to abuse other tail
+  * struct page to store the metadata. In order to avoid conflicts caused by
+  * subsequent use of more tail struct pages, we gather these discrete indexes
+  * of tail struct page here.
+  */
+ enum {
+       SUBPAGE_INDEX_SUBPOOL = 1,      /* reuse page->private */
+ #ifdef CONFIG_CGROUP_HUGETLB
+       SUBPAGE_INDEX_CGROUP,           /* reuse page->private */
+       SUBPAGE_INDEX_CGROUP_RSVD,      /* reuse page->private */
+       __MAX_CGROUP_SUBPAGE_INDEX = SUBPAGE_INDEX_CGROUP_RSVD,
+ #endif
+       __NR_USED_SUBPAGE,
+ };
  struct hugepage_subpool {
        spinlock_t lock;
        long count;
@@@ -451,7 -468,7 +468,7 @@@ static inline struct hugetlbfs_inode_in
  extern const struct file_operations hugetlbfs_file_operations;
  extern const struct vm_operations_struct hugetlb_vm_ops;
  struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct,
 -                              struct user_struct **user, int creat_flags,
 +                              struct ucounts **ucounts, int creat_flags,
                                int page_size_log);
  
  static inline bool is_file_hugepages(struct file *file)
@@@ -471,7 -488,7 +488,7 @@@ static inline struct hstate *hstate_ino
  #define is_file_hugepages(file)                       false
  static inline struct file *
  hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag,
 -              struct user_struct **user, int creat_flags,
 +              struct ucounts **ucounts, int creat_flags,
                int page_size_log)
  {
        return ERR_PTR(-ENOSYS);
@@@ -515,12 -532,14 +532,14 @@@ unsigned long hugetlb_get_unmapped_area
   *    modifications require hugetlb_lock.
   * HPG_freed - Set when page is on the free lists.
   *    Synchronization: hugetlb_lock held for examination and modification.
+  * HPG_vmemmap_optimized - Set when the vmemmap pages of the page are freed.
   */
  enum hugetlb_page_flags {
        HPG_restore_reserve = 0,
        HPG_migratable,
        HPG_temporary,
        HPG_freed,
+       HPG_vmemmap_optimized,
        __NR_HPAGEFLAGS,
  };
  
@@@ -566,6 -585,7 +585,7 @@@ HPAGEFLAG(RestoreReserve, restore_reser
  HPAGEFLAG(Migratable, migratable)
  HPAGEFLAG(Temporary, temporary)
  HPAGEFLAG(Freed, freed)
+ HPAGEFLAG(VmemmapOptimized, vmemmap_optimized)
  
  #ifdef CONFIG_HUGETLB_PAGE
  
@@@ -588,6 -608,9 +608,9 @@@ struct hstate 
        unsigned int nr_huge_pages_node[MAX_NUMNODES];
        unsigned int free_huge_pages_node[MAX_NUMNODES];
        unsigned int surplus_huge_pages_node[MAX_NUMNODES];
+ #ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP
+       unsigned int nr_free_vmemmap_pages;
+ #endif
  #ifdef CONFIG_CGROUP_HUGETLB
        /* cgroup control files */
        struct cftype cgroup_files_dfl[7];
@@@ -635,13 -658,13 +658,13 @@@ extern unsigned int default_hstate_idx
   */
  static inline struct hugepage_subpool *hugetlb_page_subpool(struct page *hpage)
  {
-       return (struct hugepage_subpool *)(hpage+1)->private;
+       return (void *)page_private(hpage + SUBPAGE_INDEX_SUBPOOL);
  }
  
  static inline void hugetlb_set_page_subpool(struct page *hpage,
                                        struct hugepage_subpool *subpool)
  {
-       set_page_private(hpage+1, (unsigned long)subpool);
+       set_page_private(hpage + SUBPAGE_INDEX_SUBPOOL, (unsigned long)subpool);
  }
  
  static inline struct hstate *hstate_file(struct file *f)
@@@ -718,8 -741,8 +741,8 @@@ static inline void arch_clear_hugepage_
  #endif
  
  #ifndef arch_make_huge_pte
- static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
-                                      struct page *page, int writable)
+ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
+                                      vm_flags_t flags)
  {
        return entry;
  }
@@@ -875,6 -898,11 +898,11 @@@ static inline void huge_ptep_modify_pro
  #else /* CONFIG_HUGETLB_PAGE */
  struct hstate {};
  
+ static inline struct hugepage_subpool *hugetlb_page_subpool(struct page *hpage)
+ {
+       return NULL;
+ }
  static inline int isolate_or_dissolve_huge_page(struct page *page,
                                                struct list_head *list)
  {
@@@ -1028,6 -1056,12 +1056,12 @@@ static inline void set_huge_swap_pte_at
  }
  #endif        /* CONFIG_HUGETLB_PAGE */
  
+ #ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP
+ extern bool hugetlb_free_vmemmap_enabled;
+ #else
+ #define hugetlb_free_vmemmap_enabled  false
+ #endif
  static inline spinlock_t *huge_pte_lock(struct hstate *h,
                                        struct mm_struct *mm, pte_t *pte)
  {
diff --combined include/linux/kernel.h
index f2ad8a53f71f896da7ee4aae0e8ba776bb2688cc,7bb0a5cb7d57fdef251e00225639a54827097ad7..1b2f0a7e00d688b875ec94d8e93bf9206e697a86
  #include <linux/types.h>
  #include <linux/compiler.h>
  #include <linux/bitops.h>
+ #include <linux/kstrtox.h>
  #include <linux/log2.h>
  #include <linux/math.h>
  #include <linux/minmax.h>
  #include <linux/typecheck.h>
+ #include <linux/panic.h>
  #include <linux/printk.h>
  #include <linux/build_bug.h>
  #include <linux/static_call_types.h>
   */
  #define lower_32_bits(n) ((u32)((n) & 0xffffffff))
  
 +/**
 + * upper_16_bits - return bits 16-31 of a number
 + * @n: the number we're accessing
 + */
 +#define upper_16_bits(n) ((u16)((n) >> 16))
 +
 +/**
 + * lower_16_bits - return bits 0-15 of a number
 + * @n: the number we're accessing
 + */
 +#define lower_16_bits(n) ((u16)((n) & 0xffff))
 +
  struct completion;
- struct pt_regs;
  struct user;
  
  #ifdef CONFIG_PREEMPT_VOLUNTARY
@@@ -189,159 -178,9 +190,9 @@@ void __might_fault(const char *file, in
  static inline void might_fault(void) { }
  #endif
  
- extern struct atomic_notifier_head panic_notifier_list;
- extern long (*panic_blink)(int state);
- __printf(1, 2)
- void panic(const char *fmt, ...) __noreturn __cold;
- void nmi_panic(struct pt_regs *regs, const char *msg);
- extern void oops_enter(void);
- extern void oops_exit(void);
- extern bool oops_may_print(void);
  void do_exit(long error_code) __noreturn;
  void complete_and_exit(struct completion *, long) __noreturn;
  
- /* Internal, do not use. */
- int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
- int __must_check _kstrtol(const char *s, unsigned int base, long *res);
- int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res);
- int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
- /**
-  * kstrtoul - convert a string to an unsigned long
-  * @s: The start of the string. The string must be null-terminated, and may also
-  *  include a single newline before its terminating null. The first character
-  *  may also be a plus sign, but not a minus sign.
-  * @base: The number base to use. The maximum supported base is 16. If base is
-  *  given as 0, then the base of the string is automatically detected with the
-  *  conventional semantics - If it begins with 0x the number will be parsed as a
-  *  hexadecimal (case insensitive), if it otherwise begins with 0, it will be
-  *  parsed as an octal number. Otherwise it will be parsed as a decimal.
-  * @res: Where to write the result of the conversion on success.
-  *
-  * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
-  * Preferred over simple_strtoul(). Return code must be checked.
- */
- static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
- {
-       /*
-        * We want to shortcut function call, but
-        * __builtin_types_compatible_p(unsigned long, unsigned long long) = 0.
-        */
-       if (sizeof(unsigned long) == sizeof(unsigned long long) &&
-           __alignof__(unsigned long) == __alignof__(unsigned long long))
-               return kstrtoull(s, base, (unsigned long long *)res);
-       else
-               return _kstrtoul(s, base, res);
- }
- /**
-  * kstrtol - convert a string to a long
-  * @s: The start of the string. The string must be null-terminated, and may also
-  *  include a single newline before its terminating null. The first character
-  *  may also be a plus sign or a minus sign.
-  * @base: The number base to use. The maximum supported base is 16. If base is
-  *  given as 0, then the base of the string is automatically detected with the
-  *  conventional semantics - If it begins with 0x the number will be parsed as a
-  *  hexadecimal (case insensitive), if it otherwise begins with 0, it will be
-  *  parsed as an octal number. Otherwise it will be parsed as a decimal.
-  * @res: Where to write the result of the conversion on success.
-  *
-  * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
-  * Preferred over simple_strtol(). Return code must be checked.
-  */
- static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
- {
-       /*
-        * We want to shortcut function call, but
-        * __builtin_types_compatible_p(long, long long) = 0.
-        */
-       if (sizeof(long) == sizeof(long long) &&
-           __alignof__(long) == __alignof__(long long))
-               return kstrtoll(s, base, (long long *)res);
-       else
-               return _kstrtol(s, base, res);
- }
- int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res);
- int __must_check kstrtoint(const char *s, unsigned int base, int *res);
- static inline int __must_check kstrtou64(const char *s, unsigned int base, u64 *res)
- {
-       return kstrtoull(s, base, res);
- }
- static inline int __must_check kstrtos64(const char *s, unsigned int base, s64 *res)
- {
-       return kstrtoll(s, base, res);
- }
- static inline int __must_check kstrtou32(const char *s, unsigned int base, u32 *res)
- {
-       return kstrtouint(s, base, res);
- }
- static inline int __must_check kstrtos32(const char *s, unsigned int base, s32 *res)
- {
-       return kstrtoint(s, base, res);
- }
- int __must_check kstrtou16(const char *s, unsigned int base, u16 *res);
- int __must_check kstrtos16(const char *s, unsigned int base, s16 *res);
- int __must_check kstrtou8(const char *s, unsigned int base, u8 *res);
- int __must_check kstrtos8(const char *s, unsigned int base, s8 *res);
- int __must_check kstrtobool(const char *s, bool *res);
- int __must_check kstrtoull_from_user(const char __user *s, size_t count, unsigned int base, unsigned long long *res);
- int __must_check kstrtoll_from_user(const char __user *s, size_t count, unsigned int base, long long *res);
- int __must_check kstrtoul_from_user(const char __user *s, size_t count, unsigned int base, unsigned long *res);
- int __must_check kstrtol_from_user(const char __user *s, size_t count, unsigned int base, long *res);
- int __must_check kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, unsigned int *res);
- int __must_check kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, int *res);
- int __must_check kstrtou16_from_user(const char __user *s, size_t count, unsigned int base, u16 *res);
- int __must_check kstrtos16_from_user(const char __user *s, size_t count, unsigned int base, s16 *res);
- int __must_check kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, u8 *res);
- int __must_check kstrtos8_from_user(const char __user *s, size_t count, unsigned int base, s8 *res);
- int __must_check kstrtobool_from_user(const char __user *s, size_t count, bool *res);
- static inline int __must_check kstrtou64_from_user(const char __user *s, size_t count, unsigned int base, u64 *res)
- {
-       return kstrtoull_from_user(s, count, base, res);
- }
- static inline int __must_check kstrtos64_from_user(const char __user *s, size_t count, unsigned int base, s64 *res)
- {
-       return kstrtoll_from_user(s, count, base, res);
- }
- static inline int __must_check kstrtou32_from_user(const char __user *s, size_t count, unsigned int base, u32 *res)
- {
-       return kstrtouint_from_user(s, count, base, res);
- }
- static inline int __must_check kstrtos32_from_user(const char __user *s, size_t count, unsigned int base, s32 *res)
- {
-       return kstrtoint_from_user(s, count, base, res);
- }
- /*
-  * Use kstrto<foo> instead.
-  *
-  * NOTE: simple_strto<foo> does not check for the range overflow and,
-  *     depending on the input, may give interesting results.
-  *
-  * Use these functions if and only if you cannot use kstrto<foo>, because
-  * the conversion ends on the first non-digit character, which may be far
-  * beyond the supported range. It might be useful to parse the strings like
-  * 10x50 or 12:21 without altering original string or temporary buffer in use.
-  * Keep in mind above caveat.
-  */
- extern unsigned long simple_strtoul(const char *,char **,unsigned int);
- extern long simple_strtol(const char *,char **,unsigned int);
- extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
- extern long long simple_strtoll(const char *,char **,unsigned int);
  extern int num_to_str(char *buf, int size,
                      unsigned long long num, unsigned int width);
  
@@@ -384,52 -223,8 +235,8 @@@ extern int __kernel_text_address(unsign
  extern int kernel_text_address(unsigned long addr);
  extern int func_ptr_is_kernel_text(void *ptr);
  
- #ifdef CONFIG_SMP
- extern unsigned int sysctl_oops_all_cpu_backtrace;
- #else
- #define sysctl_oops_all_cpu_backtrace 0
- #endif /* CONFIG_SMP */
  extern void bust_spinlocks(int yes);
- extern int panic_timeout;
- extern unsigned long panic_print;
- extern int panic_on_oops;
- extern int panic_on_unrecovered_nmi;
- extern int panic_on_io_nmi;
- extern int panic_on_warn;
- extern unsigned long panic_on_taint;
- extern bool panic_on_taint_nousertaint;
- extern int sysctl_panic_on_rcu_stall;
- extern int sysctl_max_rcu_stall_to_panic;
- extern int sysctl_panic_on_stackoverflow;
- extern bool crash_kexec_post_notifiers;
  
- /*
-  * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It
-  * holds a CPU number which is executing panic() currently. A value of
-  * PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec().
-  */
- extern atomic_t panic_cpu;
- #define PANIC_CPU_INVALID     -1
- /*
-  * Only to be used by arch init code. If the user over-wrote the default
-  * CONFIG_PANIC_TIMEOUT, honor it.
-  */
- static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout)
- {
-       if (panic_timeout == arch_default_timeout)
-               panic_timeout = timeout;
- }
- extern const char *print_tainted(void);
- enum lockdep_ok {
-       LOCKDEP_STILL_OK,
-       LOCKDEP_NOW_UNRELIABLE
- };
- extern void add_taint(unsigned flag, enum lockdep_ok);
- extern int test_taint(unsigned flag);
- extern unsigned long get_taint(void);
  extern int root_mountflags;
  
  extern bool early_boot_irqs_disabled;
@@@ -448,36 -243,6 +255,6 @@@ extern enum system_states 
        SYSTEM_SUSPEND,
  } system_state;
  
- /* This cannot be an enum because some may be used in assembly source. */
- #define TAINT_PROPRIETARY_MODULE      0
- #define TAINT_FORCED_MODULE           1
- #define TAINT_CPU_OUT_OF_SPEC         2
- #define TAINT_FORCED_RMMOD            3
- #define TAINT_MACHINE_CHECK           4
- #define TAINT_BAD_PAGE                        5
- #define TAINT_USER                    6
- #define TAINT_DIE                     7
- #define TAINT_OVERRIDDEN_ACPI_TABLE   8
- #define TAINT_WARN                    9
- #define TAINT_CRAP                    10
- #define TAINT_FIRMWARE_WORKAROUND     11
- #define TAINT_OOT_MODULE              12
- #define TAINT_UNSIGNED_MODULE         13
- #define TAINT_SOFTLOCKUP              14
- #define TAINT_LIVEPATCH                       15
- #define TAINT_AUX                     16
- #define TAINT_RANDSTRUCT              17
- #define TAINT_FLAGS_COUNT             18
- #define TAINT_FLAGS_MAX                       ((1UL << TAINT_FLAGS_COUNT) - 1)
- struct taint_flag {
-       char c_true;    /* character printed when tainted */
-       char c_false;   /* character printed when not tainted */
-       bool module;    /* also show as a per-module taint flag */
- };
- extern const struct taint_flag taint_flags[TAINT_FLAGS_COUNT];
  extern const char hex_asc[];
  #define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
  #define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
diff --combined include/linux/kprobes.h
index 523ffc7bc3a8b4c7a409aea361ce8b83af5afb54,c98a35a75f40a7d5313a44be95182b4f17536324..4d0c28c2ba124cdcf2aa36cfd0faf7cd105891e1
@@@ -54,6 -54,8 +54,6 @@@ struct kretprobe_instance
  typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *);
  typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *,
                                       unsigned long flags);
 -typedef int (*kprobe_fault_handler_t) (struct kprobe *, struct pt_regs *,
 -                                     int trapnr);
  typedef int (*kretprobe_handler_t) (struct kretprobe_instance *,
                                    struct pt_regs *);
  
@@@ -81,6 -83,12 +81,6 @@@ struct kprobe 
        /* Called after addr is executed, unless... */
        kprobe_post_handler_t post_handler;
  
 -      /*
 -       * ... called if executing addr causes a fault (eg. page fault).
 -       * Return 1 if it handled fault, otherwise kernel will see it.
 -       */
 -      kprobe_fault_handler_t fault_handler;
 -
        /* Saved opcode (which has been replaced with breakpoint) */
        kprobe_opcode_t opcode;
  
@@@ -399,7 -407,6 +399,6 @@@ int enable_kprobe(struct kprobe *kp)
  void dump_kprobe(struct kprobe *kp);
  
  void *alloc_insn_page(void);
- void free_insn_page(void *page);
  
  int kprobe_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
                       char *sym);
diff --combined include/linux/mm.h
index b8bc39237dac39e6b9d176181d9d9e36ee866a08,714ad9b26ed2e5ada554c64b9d8d22655c378d34..788a0b1323d0024d04eae708f6c32261799fada9
@@@ -124,6 -124,16 +124,6 @@@ extern int mmap_rnd_compat_bits __read_
  #define lm_alias(x)   __va(__pa_symbol(x))
  #endif
  
 -/*
 - * With CONFIG_CFI_CLANG, the compiler replaces function addresses in
 - * instrumented C code with jump table addresses. Architectures that
 - * support CFI can define this macro to return the actual function address
 - * when needed.
 - */
 -#ifndef function_nocfi
 -#define function_nocfi(x) (x)
 -#endif
 -
  /*
   * To prevent common memory management code establishing
   * a zero page mapping on a read fault.
  /* This function must be updated when the size of struct page grows above 80
   * or reduces below 56. The idea that compiler optimizes out switch()
   * statement, and only leaves move/store instructions. Also the compiler can
-  * combine write statments if they are both assignments and can be reordered,
+  * combine write statements if they are both assignments and can be reordered,
   * this can result in several of the writes here being dropped.
   */
  #define       mm_zero_struct_page(pp) __mm_zero_struct_page(pp)
@@@ -540,7 -550,12 +540,12 @@@ struct vm_fault 
        pud_t *pud;                     /* Pointer to pud entry matching
                                         * the 'address'
                                         */
-       pte_t orig_pte;                 /* Value of PTE at the time of fault */
+       union {
+               pte_t orig_pte;         /* Value of PTE at the time of fault */
+               pmd_t orig_pmd;         /* Value of PMD at the time of fault,
+                                        * used by PMD fault only.
+                                        */
+       };
  
        struct page *cow_page;          /* Page handler may use for COW fault */
        struct page *page;              /* ->fault handlers should return a
@@@ -1662,11 -1677,10 +1667,11 @@@ struct address_space *page_mapping(stru
  static inline bool page_is_pfmemalloc(const struct page *page)
  {
        /*
 -       * Page index cannot be this large so this must be
 -       * a pfmemalloc page.
 +       * lru.next has bit 1 set if the page is allocated from the
 +       * pfmemalloc reserves.  Callers may simply overwrite it if
 +       * they do not need to preserve that information.
         */
 -      return page->index == -1UL;
 +      return (uintptr_t)page->lru.next & BIT(1);
  }
  
  /*
   */
  static inline void set_page_pfmemalloc(struct page *page)
  {
 -      page->index = -1UL;
 +      page->lru.next = (void *)BIT(1);
  }
  
  static inline void clear_page_pfmemalloc(struct page *page)
  {
 -      page->index = 0;
 +      page->lru.next = NULL;
  }
  
  /*
@@@ -1704,8 -1718,8 +1709,8 @@@ extern bool can_do_mlock(void)
  #else
  static inline bool can_do_mlock(void) { return false; }
  #endif
 -extern int user_shm_lock(size_t, struct user_struct *);
 -extern void user_shm_unlock(size_t, struct user_struct *);
 +extern int user_shm_lock(size_t, struct ucounts *);
 +extern void user_shm_unlock(size_t, struct ucounts *);
  
  /*
   * Parameter block passed down to zap_pte_range in exceptional cases.
@@@ -3067,6 -3081,11 +3072,11 @@@ static inline void print_vma_addr(char 
  }
  #endif
  
+ int vmemmap_remap_free(unsigned long start, unsigned long end,
+                      unsigned long reuse);
+ int vmemmap_remap_alloc(unsigned long start, unsigned long end,
+                       unsigned long reuse, gfp_t gfp_mask);
  void *sparse_buffer_alloc(unsigned long size);
  struct page * __populate_section_memmap(unsigned long pfn,
                unsigned long nr_pages, int nid, struct vmem_altmap *altmap);
diff --combined include/linux/mm_types.h
index d33d97c69da92a7f4829d4542e6b6a490012799a,7486177809240443bae2d1c15e19f8c138ab9bd8..52bbd2b7cb4658acfbc480e762123158b0b1e3d4
@@@ -96,13 -96,6 +96,13 @@@ struct page 
                        unsigned long private;
                };
                struct {        /* page_pool used by netstack */
 +                      /**
 +                       * @pp_magic: magic value to avoid recycling non
 +                       * page_pool allocated pages.
 +                       */
 +                      unsigned long pp_magic;
 +                      struct page_pool *pp;
 +                      unsigned long _pp_mapping_pad;
                        /**
                         * @dma_addr: might require a 64-bit value on
                         * 32-bit architectures.
@@@ -404,7 -397,7 +404,7 @@@ struct mm_struct 
                unsigned long mmap_base;        /* base of mmap area */
                unsigned long mmap_legacy_base; /* base of mmap area in bottom-up allocations */
  #ifdef CONFIG_HAVE_ARCH_COMPAT_MMAP_BASES
-               /* Base adresses for compatible mmap() */
+               /* Base addresses for compatible mmap() */
                unsigned long mmap_compat_base;
                unsigned long mmap_compat_legacy_base;
  #endif
index 4586965500288ad146cede5e789361fcc5832f95,3e7e616067fc29e4b7f77c642e23991bab497d99..5922031ffab6e533e34ab81a72b1920a6849bee2
@@@ -137,9 -137,6 +137,9 @@@ enum pageflags 
  #endif
  #ifdef CONFIG_64BIT
        PG_arch_2,
 +#endif
 +#ifdef CONFIG_KASAN_HW_TAGS
 +      PG_skip_kasan_poison,
  #endif
        __NR_PAGEFLAGS,
  
@@@ -446,12 -443,6 +446,12 @@@ TESTCLEARFLAG(Young, young, PF_ANY
  PAGEFLAG(Idle, idle, PF_ANY)
  #endif
  
 +#ifdef CONFIG_KASAN_HW_TAGS
 +PAGEFLAG(SkipKASanPoison, skip_kasan_poison, PF_HEAD)
 +#else
 +PAGEFLAG_FALSE(SkipKASanPoison)
 +#endif
 +
  /*
   * PageReported() is used to track reported free pages within the Buddy
   * allocator. We can use the non-atomic version of the test and set
@@@ -703,6 -694,18 +703,18 @@@ PAGEFLAG_FALSE(DoubleMap
        TESTSCFLAG_FALSE(DoubleMap)
  #endif
  
+ /*
+  * Check if a page is currently marked HWPoisoned. Note that this check is
+  * best effort only and inherently racy: there is no way to synchronize with
+  * failing hardware.
+  */
+ static inline bool is_page_hwpoison(struct page *page)
+ {
+       if (PageHWPoison(page))
+               return true;
+       return PageHuge(page) && PageHWPoison(compound_head(page));
+ }
  /*
   * For pages that are never mapped to userspace (and aren't PageSlab),
   * page_type may be used.  Because it is initialised to -1, we invert the
@@@ -766,9 -769,19 +778,19 @@@ PAGE_TYPE_OPS(Buddy, buddy
   * relies on this feature is aware that re-onlining the memory block will
   * require to re-set the pages PageOffline() and not giving them to the
   * buddy via online_page_callback_t.
+  *
+  * There are drivers that mark a page PageOffline() and expect there won't be
+  * any further access to page content. PFN walkers that read content of random
+  * pages should check PageOffline() and synchronize with such drivers using
+  * page_offline_freeze()/page_offline_thaw().
   */
  PAGE_TYPE_OPS(Offline, offline)
  
+ extern void page_offline_freeze(void);
+ extern void page_offline_thaw(void);
+ extern void page_offline_begin(void);
+ extern void page_offline_end(void);
  /*
   * Marks pages in use as page tables.
   */
diff --combined include/linux/shmem_fs.h
index aa77dcd1646fbf44060d3bddcc260a8d8a2f535d,a69ea4d97fdd3151ff51c47619adde9219e22c8d..8e775ce517bb37295684c598f7190a973b5c773c
@@@ -65,7 -65,7 +65,7 @@@ extern struct file *shmem_file_setup_wi
  extern int shmem_zero_setup(struct vm_area_struct *);
  extern unsigned long shmem_get_unmapped_area(struct file *, unsigned long addr,
                unsigned long len, unsigned long pgoff, unsigned long flags);
 -extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
 +extern int shmem_lock(struct file *file, int lock, struct ucounts *ucounts);
  #ifdef CONFIG_SHMEM
  extern const struct address_space_operations shmem_aops;
  static inline bool shmem_mapping(struct address_space *mapping)
@@@ -122,21 -122,18 +122,18 @@@ static inline bool shmem_file(struct fi
  extern bool shmem_charge(struct inode *inode, long pages);
  extern void shmem_uncharge(struct inode *inode, long pages);
  
+ #ifdef CONFIG_USERFAULTFD
  #ifdef CONFIG_SHMEM
- extern int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
+ extern int shmem_mfill_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
                                  struct vm_area_struct *dst_vma,
                                  unsigned long dst_addr,
                                  unsigned long src_addr,
+                                 bool zeropage,
                                  struct page **pagep);
- extern int shmem_mfill_zeropage_pte(struct mm_struct *dst_mm,
-                                   pmd_t *dst_pmd,
-                                   struct vm_area_struct *dst_vma,
-                                   unsigned long dst_addr);
- #else
- #define shmem_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \
-                              src_addr, pagep)        ({ BUG(); 0; })
- #define shmem_mfill_zeropage_pte(dst_mm, dst_pmd, dst_vma, \
-                                dst_addr)      ({ BUG(); 0; })
- #endif
+ #else /* !CONFIG_SHMEM */
+ #define shmem_mfill_atomic_pte(dst_mm, dst_pmd, dst_vma, dst_addr, \
+                              src_addr, zeropage, pagep)       ({ BUG(); 0; })
+ #endif /* CONFIG_SHMEM */
+ #endif /* CONFIG_USERFAULTFD */
  
  #endif
diff --combined init/main.c
index 359358500e5441b1c8a22a27ab0444fecc11ebf8,d4f7af4cf5609f580abd0237918f01d5027de2ce..f88d896c0123a76193277fae095cfaea3566e484
@@@ -692,7 -692,6 +692,7 @@@ noinline void __ref rest_init(void
         */
        rcu_read_lock();
        tsk = find_task_by_pid_ns(pid, &init_pid_ns);
 +      tsk->flags |= PF_NO_SETAFFINITY;
        set_cpus_allowed_ptr(tsk, cpumask_of(smp_processor_id()));
        rcu_read_unlock();
  
@@@ -873,6 -872,47 +873,47 @@@ void __init __weak arch_call_rest_init(
        rest_init();
  }
  
+ static void __init print_unknown_bootoptions(void)
+ {
+       char *unknown_options;
+       char *end;
+       const char *const *p;
+       size_t len;
+       if (panic_later || (!argv_init[1] && !envp_init[2]))
+               return;
+       /*
+        * Determine how many options we have to print out, plus a space
+        * before each
+        */
+       len = 1; /* null terminator */
+       for (p = &argv_init[1]; *p; p++) {
+               len++;
+               len += strlen(*p);
+       }
+       for (p = &envp_init[2]; *p; p++) {
+               len++;
+               len += strlen(*p);
+       }
+       unknown_options = memblock_alloc(len, SMP_CACHE_BYTES);
+       if (!unknown_options) {
+               pr_err("%s: Failed to allocate %zu bytes\n",
+                       __func__, len);
+               return;
+       }
+       end = unknown_options;
+       for (p = &argv_init[1]; *p; p++)
+               end += sprintf(end, " %s", *p);
+       for (p = &envp_init[2]; *p; p++)
+               end += sprintf(end, " %s", *p);
+       pr_notice("Unknown command line parameters:%s\n", unknown_options);
+       memblock_free(__pa(unknown_options), len);
+ }
  asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
  {
        char *command_line;
                                  static_command_line, __start___param,
                                  __stop___param - __start___param,
                                  -1, -1, NULL, &unknown_bootoption);
+       print_unknown_bootoptions();
        if (!IS_ERR_OR_NULL(after_dashes))
                parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,
                           NULL, set_init_arg);
         * time - but meanwhile we still have a functioning scheduler.
         */
        sched_init();
 -      /*
 -       * Disable preemption - early bootup scheduling is extremely
 -       * fragile until we cpu_idle() for the first time.
 -       */
 -      preempt_disable();
 +
        if (WARN(!irqs_disabled(),
                 "Interrupts were enabled *very* early, fixing it\n"))
                local_irq_disable();
@@@ -1441,11 -1486,6 +1483,11 @@@ static int __ref kernel_init(void *unus
  {
        int ret;
  
 +      /*
 +       * Wait until kthreadd is all set-up.
 +       */
 +      wait_for_completion(&kthreadd_done);
 +
        kernel_init_freeable();
        /* need to finish all async __init code before freeing the memory */
        async_synchronize_full();
@@@ -1526,6 -1566,11 +1568,6 @@@ void __init console_on_rootfs(void
  
  static noinline void __init kernel_init_freeable(void)
  {
 -      /*
 -       * Wait until kthreadd is all set-up.
 -       */
 -      wait_for_completion(&kthreadd_done);
 -
        /* Now the scheduler is fully set up and can do blocking allocations */
        gfp_allowed_mask = __GFP_BITS_MASK;
  
diff --combined ipc/shm.c
index 003234fbbd176d8df4ba213b32d779ae492750df,a66b2664558b6e5f72ab50125127a5fbdf7c6f22..748933e376cad6d4dabfc01e6cf2d91b68dd852f
+++ b/ipc/shm.c
@@@ -60,7 -60,7 +60,7 @@@ struct shmid_kernel /* private to the k
        time64_t                shm_ctim;
        struct pid              *shm_cprid;
        struct pid              *shm_lprid;
 -      struct user_struct      *mlock_user;
 +      struct ucounts          *mlock_ucounts;
  
        /* The task created the shm object.  NULL if the task is dead. */
        struct task_struct      *shm_creator;
@@@ -222,7 -222,7 +222,7 @@@ static void shm_rcu_free(struct rcu_hea
        struct shmid_kernel *shp = container_of(ptr, struct shmid_kernel,
                                                        shm_perm);
        security_shm_free(&shp->shm_perm);
-       kvfree(shp);
+       kfree(shp);
  }
  
  static inline void shm_rmid(struct ipc_namespace *ns, struct shmid_kernel *s)
@@@ -286,10 -286,10 +286,10 @@@ static void shm_destroy(struct ipc_name
        shm_rmid(ns, shp);
        shm_unlock(shp);
        if (!is_file_hugepages(shm_file))
 -              shmem_lock(shm_file, 0, shp->mlock_user);
 -      else if (shp->mlock_user)
 +              shmem_lock(shm_file, 0, shp->mlock_ucounts);
 +      else if (shp->mlock_ucounts)
                user_shm_unlock(i_size_read(file_inode(shm_file)),
 -                              shp->mlock_user);
 +                              shp->mlock_ucounts);
        fput(shm_file);
        ipc_update_pid(&shp->shm_cprid, NULL);
        ipc_update_pid(&shp->shm_lprid, NULL);
@@@ -619,18 -619,18 +619,18 @@@ static int newseg(struct ipc_namespace 
                        ns->shm_tot + numpages > ns->shm_ctlall)
                return -ENOSPC;
  
-       shp = kvmalloc(sizeof(*shp), GFP_KERNEL);
+       shp = kmalloc(sizeof(*shp), GFP_KERNEL);
        if (unlikely(!shp))
                return -ENOMEM;
  
        shp->shm_perm.key = key;
        shp->shm_perm.mode = (shmflg & S_IRWXUGO);
 -      shp->mlock_user = NULL;
 +      shp->mlock_ucounts = NULL;
  
        shp->shm_perm.security = NULL;
        error = security_shm_alloc(&shp->shm_perm);
        if (error) {
-               kvfree(shp);
+               kfree(shp);
                return error;
        }
  
                if (shmflg & SHM_NORESERVE)
                        acctflag = VM_NORESERVE;
                file = hugetlb_file_setup(name, hugesize, acctflag,
 -                                &shp->mlock_user, HUGETLB_SHMFS_INODE,
 +                                &shp->mlock_ucounts, HUGETLB_SHMFS_INODE,
                                (shmflg >> SHM_HUGE_SHIFT) & SHM_HUGE_MASK);
        } else {
                /*
  no_id:
        ipc_update_pid(&shp->shm_cprid, NULL);
        ipc_update_pid(&shp->shm_lprid, NULL);
 -      if (is_file_hugepages(file) && shp->mlock_user)
 -              user_shm_unlock(size, shp->mlock_user);
 +      if (is_file_hugepages(file) && shp->mlock_ucounts)
 +              user_shm_unlock(size, shp->mlock_ucounts);
        fput(file);
        ipc_rcu_putref(&shp->shm_perm, shm_rcu_free);
        return error;
@@@ -1105,12 -1105,12 +1105,12 @@@ static int shmctl_do_lock(struct ipc_na
                goto out_unlock0;
  
        if (cmd == SHM_LOCK) {
 -              struct user_struct *user = current_user();
 +              struct ucounts *ucounts = current_ucounts();
  
 -              err = shmem_lock(shm_file, 1, user);
 +              err = shmem_lock(shm_file, 1, ucounts);
                if (!err && !(shp->shm_perm.mode & SHM_LOCKED)) {
                        shp->shm_perm.mode |= SHM_LOCKED;
 -                      shp->mlock_user = user;
 +                      shp->mlock_ucounts = ucounts;
                }
                goto out_unlock0;
        }
        /* SHM_UNLOCK */
        if (!(shp->shm_perm.mode & SHM_LOCKED))
                goto out_unlock0;
 -      shmem_lock(shm_file, 0, shp->mlock_user);
 +      shmem_lock(shm_file, 0, shp->mlock_ucounts);
        shp->shm_perm.mode &= ~SHM_LOCKED;
 -      shp->mlock_user = NULL;
 +      shp->mlock_ucounts = NULL;
        get_file(shm_file);
        ipc_unlock_object(&shp->shm_perm);
        rcu_read_unlock();
diff --combined kernel/hung_task.c
index b0ce8b3f3822c7b777ea003b6ec26a43874ca66f,ebc641664eb00195afab7517a31e57babf4b8698..9888e2bc8c76713b991ef52acf3fcff2331b250d
@@@ -15,6 -15,7 +15,7 @@@
  #include <linux/kthread.h>
  #include <linux/lockdep.h>
  #include <linux/export.h>
+ #include <linux/panic_notifier.h>
  #include <linux/sysctl.h>
  #include <linux/suspend.h>
  #include <linux/utsname.h>
@@@ -196,7 -197,7 +197,7 @@@ static void check_hung_uninterruptible_
                        last_break = jiffies;
                }
                /* use "==" to skip the TASK_KILLABLE tasks waiting on NFS */
 -              if (t->state == TASK_UNINTERRUPTIBLE)
 +              if (READ_ONCE(t->__state) == TASK_UNINTERRUPTIBLE)
                        check_hung_task(t, timeout);
        }
   unlock:
diff --combined kernel/kprobes.c
index e41385afe79dc5886b13cc005395b57fa9e668bc,e0c4c9d572993c583b04ca209db3b96e426d416d..297dc8bbe33398e21d13b5094a3cdb9015e071e6
@@@ -106,7 -106,7 +106,7 @@@ void __weak *alloc_insn_page(void
        return module_alloc(PAGE_SIZE);
  }
  
void __weak free_insn_page(void *page)
static void free_insn_page(void *page)
  {
        module_memfree(page);
  }
@@@ -1183,6 -1183,23 +1183,6 @@@ static void aggr_post_handler(struct kp
  }
  NOKPROBE_SYMBOL(aggr_post_handler);
  
 -static int aggr_fault_handler(struct kprobe *p, struct pt_regs *regs,
 -                            int trapnr)
 -{
 -      struct kprobe *cur = __this_cpu_read(kprobe_instance);
 -
 -      /*
 -       * if we faulted "during" the execution of a user specified
 -       * probe handler, invoke just that probe's fault handler
 -       */
 -      if (cur && cur->fault_handler) {
 -              if (cur->fault_handler(cur, regs, trapnr))
 -                      return 1;
 -      }
 -      return 0;
 -}
 -NOKPROBE_SYMBOL(aggr_fault_handler);
 -
  /* Walks the list and increments nmissed count for multiprobe case */
  void kprobes_inc_nmissed_count(struct kprobe *p)
  {
@@@ -1313,6 -1330,7 +1313,6 @@@ static void init_aggr_kprobe(struct kpr
        ap->addr = p->addr;
        ap->flags = p->flags & ~KPROBE_FLAG_OPTIMIZED;
        ap->pre_handler = aggr_pre_handler;
 -      ap->fault_handler = aggr_fault_handler;
        /* We don't care the kprobe which has gone. */
        if (p->post_handler && !kprobe_gone(p))
                ap->post_handler = aggr_post_handler;
@@@ -1996,6 -2014,7 +1996,6 @@@ int register_kretprobe(struct kretprob
  
        rp->kp.pre_handler = pre_handler_kretprobe;
        rp->kp.post_handler = NULL;
 -      rp->kp.fault_handler = NULL;
  
        /* Pre-allocate memory for max kretprobe instances */
        if (rp->maxactive <= 0) {
diff --combined kernel/signal.c
index de0920353d30139342eaecb2ab394dd9641bc1d2,6b4df88cc630b798f077778fdf81dd83634e82a4..f6371dfa1f895a7f6730a02c18292cf464f1cc93
@@@ -412,8 -412,8 +412,8 @@@ __sigqueue_alloc(int sig, struct task_s
                 int override_rlimit, const unsigned int sigqueue_flags)
  {
        struct sigqueue *q = NULL;
 -      struct user_struct *user;
 -      int sigpending;
 +      struct ucounts *ucounts = NULL;
 +      long sigpending;
  
        /*
         * Protect access to @t credentials. This can go away when all
         * changes from/to zero.
         */
        rcu_read_lock();
 -      user = __task_cred(t)->user;
 -      sigpending = atomic_inc_return(&user->sigpending);
 +      ucounts = task_ucounts(t);
 +      sigpending = inc_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_SIGPENDING, 1);
        if (sigpending == 1)
 -              get_uid(user);
 +              ucounts = get_ucounts(ucounts);
        rcu_read_unlock();
  
 -      if (override_rlimit || likely(sigpending <= task_rlimit(t, RLIMIT_SIGPENDING))) {
 +      if (override_rlimit || (sigpending < LONG_MAX && sigpending <= task_rlimit(t, RLIMIT_SIGPENDING))) {
                q = kmem_cache_alloc(sigqueue_cachep, gfp_flags);
        } else {
                print_dropped_signal(sig);
        }
  
        if (unlikely(q == NULL)) {
 -              if (atomic_dec_and_test(&user->sigpending))
 -                      free_uid(user);
 +              if (ucounts && dec_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_SIGPENDING, 1))
 +                      put_ucounts(ucounts);
        } else {
                INIT_LIST_HEAD(&q->list);
                q->flags = sigqueue_flags;
 -              q->user = user;
 +              q->ucounts = ucounts;
        }
 -
        return q;
  }
  
@@@ -451,10 -452,8 +451,10 @@@ static void __sigqueue_free(struct sigq
  {
        if (q->flags & SIGQUEUE_PREALLOC)
                return;
 -      if (atomic_dec_and_test(&q->user->sigpending))
 -              free_uid(q->user);
 +      if (q->ucounts && dec_rlimit_ucounts(q->ucounts, UCOUNT_RLIMIT_SIGPENDING, 1)) {
 +              put_ucounts(q->ucounts);
 +              q->ucounts = NULL;
 +      }
        kmem_cache_free(sigqueue_cachep, q);
  }
  
@@@ -2830,6 -2829,8 +2830,8 @@@ static void signal_delivered(struct ksi
        if (!(ksig->ka.sa.sa_flags & SA_NODEFER))
                sigaddset(&blocked, ksig->sig);
        set_current_blocked(&blocked);
+       if (current->sas_ss_flags & SS_AUTODISARM)
+               sas_ss_reset(current);
        tracehook_signal_handler(stepping);
  }
  
@@@ -4148,11 -4149,7 +4150,7 @@@ int __save_altstack(stack_t __user *uss
        int err = __put_user((void __user *)t->sas_ss_sp, &uss->ss_sp) |
                __put_user(t->sas_ss_flags, &uss->ss_flags) |
                __put_user(t->sas_ss_size, &uss->ss_size);
-       if (err)
-               return err;
-       if (t->sas_ss_flags & SS_AUTODISARM)
-               sas_ss_reset(t);
-       return 0;
+       return err;
  }
  
  #ifdef CONFIG_COMPAT
@@@ -4207,11 -4204,7 +4205,7 @@@ int __compat_save_altstack(compat_stack
                         &uss->ss_sp) |
                __put_user(t->sas_ss_flags, &uss->ss_flags) |
                __put_user(t->sas_ss_size, &uss->ss_size);
-       if (err)
-               return err;
-       if (t->sas_ss_flags & SS_AUTODISARM)
-               sas_ss_reset(t);
-       return 0;
+       return err;
  }
  #endif
  
@@@ -4680,7 -4673,7 +4674,7 @@@ void kdb_send_sig(struct task_struct *t
        }
        new_t = kdb_prev_t != t;
        kdb_prev_t = t;
 -      if (t->state != TASK_RUNNING && new_t) {
 +      if (!task_is_running(t) && new_t) {
                spin_unlock(&t->sighand->siglock);
                kdb_printf("Process is not RUNNING, sending a signal from "
                           "kdb risks deadlock\n"
diff --combined kernel/sysctl.c
index e1aa24e1545c571ceefff559ee1f5a66f5c0495e,70e286c83d6be440b8c4c294707eb121e749cf64..272f4a272f8cf86f7677dec6ac2278ca1be4263a
@@@ -27,6 -27,7 +27,7 @@@
  #include <linux/sysctl.h>
  #include <linux/bitmap.h>
  #include <linux/signal.h>
+ #include <linux/panic.h>
  #include <linux/printk.h>
  #include <linux/proc_fs.h>
  #include <linux/security.h>
@@@ -71,7 -72,6 +72,7 @@@
  #include <linux/coredump.h>
  #include <linux/latencytop.h>
  #include <linux/pid.h>
 +#include <linux/delayacct.h>
  
  #include "../lib/kstrtox.h"
  
@@@ -1495,7 -1495,6 +1496,6 @@@ int proc_do_large_bitmap(struct ctl_tab
                         void *buffer, size_t *lenp, loff_t *ppos)
  {
        int err = 0;
-       bool first = 1;
        size_t left = *lenp;
        unsigned long bitmap_len = table->maxlen;
        unsigned long *bitmap = *(unsigned long **) table->data;
                        }
  
                        bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
-                       first = 0;
                        proc_skip_char(&p, &left, '\n');
                }
                left += skipped;
        } else {
                unsigned long bit_a, bit_b = 0;
+               bool first = 1;
  
                while (left) {
                        bit_a = find_next_bit(bitmap, bitmap_len, bit_b);
@@@ -1748,17 -1747,6 +1748,17 @@@ static struct ctl_table kern_table[] = 
                .extra2         = SYSCTL_ONE,
        },
  #endif /* CONFIG_SCHEDSTATS */
 +#ifdef CONFIG_TASK_DELAY_ACCT
 +      {
 +              .procname       = "task_delayacct",
 +              .data           = NULL,
 +              .maxlen         = sizeof(unsigned int),
 +              .mode           = 0644,
 +              .proc_handler   = sysctl_delayacct,
 +              .extra1         = SYSCTL_ZERO,
 +              .extra2         = SYSCTL_ONE,
 +      },
 +#endif /* CONFIG_TASK_DELAY_ACCT */
  #ifdef CONFIG_NUMA_BALANCING
        {
                .procname       = "numa_balancing",
@@@ -2962,6 -2950,14 +2962,6 @@@ static struct ctl_table vm_table[] = 
                .mode           = 0644,
                .proc_handler   = proc_dointvec_jiffies,
        },
 -      {
 -              .procname       = "block_dump",
 -              .data           = &block_dump,
 -              .maxlen         = sizeof(block_dump),
 -              .mode           = 0644,
 -              .proc_handler   = proc_dointvec_minmax,
 -              .extra1         = SYSCTL_ZERO,
 -      },
        {
                .procname       = "vfs_cache_pressure",
                .data           = &sysctl_vfs_cache_pressure,
diff --combined lib/Kconfig.debug
index 1c9857fdb1a05ac9d5c141e802a6400127421010,ea9a4096007d62976bfc3e5f2f1a9503d7f9be55..ae62debfd8bfc95fa9ecf7f1dd388f00c298907f
@@@ -1375,6 -1375,7 +1375,6 @@@ config LOCKDE
        bool
        depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
        select STACKTRACE
 -      depends on FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86
        select KALLSYMS
        select KALLSYMS_ALL
  
@@@ -2183,9 -2184,6 +2183,9 @@@ config TEST_KSTRTO
  config TEST_PRINTF
        tristate "Test printf() family of functions at runtime"
  
 +config TEST_SCANF
 +      tristate "Test scanf() family of functions at runtime"
 +
  config TEST_BITMAP
        tristate "Test bitmap_*() family of functions at runtime"
        help
@@@ -2446,6 -2444,18 +2446,18 @@@ config SLUB_KUNIT_TES
  
          If unsure, say N.
  
+ config RATIONAL_KUNIT_TEST
+       tristate "KUnit test for rational.c" if !KUNIT_ALL_TESTS
+       depends on KUNIT
+       select RATIONAL
+       default KUNIT_ALL_TESTS
+       help
+         This builds the rational math unit test.
+         For more information on KUnit and unit tests in general please refer
+         to the KUnit documentation in Documentation/dev-tools/kunit/.
+         If unsure, say N.
  config TEST_UDELAY
        tristate "udelay test driver"
        help
@@@ -2588,18 -2598,6 +2600,18 @@@ config TEST_FP
  
          If unsure, say N.
  
 +config TEST_CLOCKSOURCE_WATCHDOG
 +      tristate "Test clocksource watchdog in kernel space"
 +      depends on CLOCKSOURCE_WATCHDOG
 +      help
 +        Enable this option to create a kernel module that will trigger
 +        a test of the clocksource watchdog.  This module may be loaded
 +        via modprobe or insmod in which case it will run upon being
 +        loaded, or it may be built in, in which case it will run
 +        shortly after boot.
 +
 +        If unsure, say N.
 +
  endif # RUNTIME_TESTING_MENU
  
  config ARCH_USE_MEMTEST
diff --combined lib/kstrtox.c
index 0b5fe8b411732e6dcfc2359ceb541ef9ff1691f0,a0cc8dcf4a35df0ab95297606856b28a8ee57905..059b8b00dc532b00dd656742ca94c7f4f4dbe6d0
   */
  #include <linux/ctype.h>
  #include <linux/errno.h>
- #include <linux/kernel.h>
- #include <linux/math64.h>
  #include <linux/export.h>
+ #include <linux/kstrtox.h>
+ #include <linux/math64.h>
  #include <linux/types.h>
  #include <linux/uaccess.h>
  #include "kstrtox.h"
  
  const char *_parse_integer_fixup_radix(const char *s, unsigned int *base)
  
  /*
   * Convert non-negative integer string representation in explicitly given radix
 - * to an integer.
 + * to an integer. A maximum of max_chars characters will be converted.
 + *
   * Return number of characters consumed maybe or-ed with overflow bit.
   * If overflow occurs, result integer (incorrect) is still returned.
   *
   * Don't you dare use this function.
   */
 -unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *p)
 +unsigned int _parse_integer_limit(const char *s, unsigned int base, unsigned long long *p,
 +                                size_t max_chars)
  {
        unsigned long long res;
        unsigned int rv;
  
        res = 0;
        rv = 0;
 -      while (1) {
 +      while (max_chars--) {
                unsigned int c = *s;
                unsigned int lc = c | 0x20; /* don't tolower() this line */
                unsigned int val;
        return rv;
  }
  
 +unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *p)
 +{
 +      return _parse_integer_limit(s, base, p, INT_MAX);
 +}
 +
  static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
  {
        unsigned long long _res;
diff --combined lib/vsprintf.c
index e5c7afbf7405fcf5064f8b232c6e5943fd63757f,30e1bc22105cf15254600446f89d5e04d8ebc9d8..2926cc27623f414a197a772e2481e4c45d0d7202
  #include <linux/string_helpers.h>
  #include "kstrtox.h"
  
 +static unsigned long long simple_strntoull(const char *startp, size_t max_chars,
 +                                         char **endp, unsigned int base)
 +{
 +      const char *cp;
 +      unsigned long long result = 0ULL;
 +      size_t prefix_chars;
 +      unsigned int rv;
 +
 +      cp = _parse_integer_fixup_radix(startp, &base);
 +      prefix_chars = cp - startp;
 +      if (prefix_chars < max_chars) {
 +              rv = _parse_integer_limit(cp, base, &result, max_chars - prefix_chars);
 +              /* FIXME */
 +              cp += (rv & ~KSTRTOX_OVERFLOW);
 +      } else {
 +              /* Field too short for prefix + digit, skip over without converting */
 +              cp = startp + max_chars;
 +      }
 +
 +      if (endp)
 +              *endp = (char *)cp;
 +
 +      return result;
 +}
 +
  /**
   * simple_strtoull - convert a string to an unsigned long long
   * @cp: The start of the string
   *
   * This function has caveats. Please use kstrtoull instead.
   */
+ noinline
  unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base)
  {
 -      unsigned long long result;
 -      unsigned int rv;
 -
 -      cp = _parse_integer_fixup_radix(cp, &base);
 -      rv = _parse_integer(cp, base, &result);
 -      /* FIXME */
 -      cp += (rv & ~KSTRTOX_OVERFLOW);
 -
 -      if (endp)
 -              *endp = (char *)cp;
 -
 -      return result;
 +      return simple_strntoull(cp, INT_MAX, endp, base);
  }
  EXPORT_SYMBOL(simple_strtoull);
  
@@@ -123,21 -110,6 +124,21 @@@ long simple_strtol(const char *cp, cha
  }
  EXPORT_SYMBOL(simple_strtol);
  
 +static long long simple_strntoll(const char *cp, size_t max_chars, char **endp,
 +                               unsigned int base)
 +{
 +      /*
 +       * simple_strntoull() safely handles receiving max_chars==0 in the
 +       * case cp[0] == '-' && max_chars == 1.
 +       * If max_chars == 0 we can drop through and pass it to simple_strntoull()
 +       * and the content of *cp is irrelevant.
 +       */
 +      if (*cp == '-' && max_chars > 0)
 +              return -simple_strntoull(cp + 1, max_chars - 1, endp, base);
 +
 +      return simple_strntoull(cp, max_chars, endp, base);
 +}
 +
  /**
   * simple_strtoll - convert a string to a signed long long
   * @cp: The start of the string
   */
  long long simple_strtoll(const char *cp, char **endp, unsigned int base)
  {
 -      if (*cp == '-')
 -              return -simple_strtoull(cp + 1, endp, base);
 -
 -      return simple_strtoull(cp, endp, base);
 +      return simple_strntoll(cp, INT_MAX, endp, base);
  }
  EXPORT_SYMBOL(simple_strtoll);
  
@@@ -1860,8 -1835,7 +1861,8 @@@ char *rtc_str(char *buf, char *end, con
              struct printf_spec spec, const char *fmt)
  {
        bool have_t = true, have_d = true;
 -      bool raw = false;
 +      bool raw = false, iso8601_separator = true;
 +      bool found = true;
        int count = 2;
  
        if (check_pointer(&buf, end, tm, spec))
                break;
        }
  
 -      raw = fmt[count] == 'r';
 +      do {
 +              switch (fmt[count++]) {
 +              case 'r':
 +                      raw = true;
 +                      break;
 +              case 's':
 +                      iso8601_separator = false;
 +                      break;
 +              default:
 +                      found = false;
 +                      break;
 +              }
 +      } while (found);
  
        if (have_d)
                buf = date_str(buf, end, tm, raw);
        if (have_d && have_t) {
 -              /* Respect ISO 8601 */
                if (buf < end)
 -                      *buf = 'T';
 +                      *buf = iso8601_separator ? 'T' : ' ';
                buf++;
        }
        if (have_t)
@@@ -2336,7 -2299,7 +2337,7 @@@ early_param("no_hash_pointers", no_hash
   * - 'd[234]' For a dentry name (optionally 2-4 last components)
   * - 'D[234]' Same as 'd' but for a struct file
   * - 'g' For block_device name (gendisk + partition number)
 - * - 't[RT][dt][r]' For time and date as represented by:
 + * - 't[RT][dt][r][s]' For time and date as represented by:
   *      R    struct rtc_time
   *      T    time64_t
   * - 'C' For a clock, it prints the name (Common Clock Framework) or address
@@@ -3603,12 -3566,8 +3604,12 @@@ int vsscanf(const char *buf, const cha
                str = skip_spaces(str);
  
                digit = *str;
 -              if (is_sign && digit == '-')
 +              if (is_sign && digit == '-') {
 +                      if (field_width == 1)
 +                              break;
 +
                        digit = *(str + 1);
 +              }
  
                if (!digit
                    || (base == 16 && !isxdigit(digit))
                        break;
  
                if (is_sign)
 -                      val.s = qualifier != 'L' ?
 -                              simple_strtol(str, &next, base) :
 -                              simple_strtoll(str, &next, base);
 +                      val.s = simple_strntoll(str,
 +                                              field_width >= 0 ? field_width : INT_MAX,
 +                                              &next, base);
                else
 -                      val.u = qualifier != 'L' ?
 -                              simple_strtoul(str, &next, base) :
 -                              simple_strtoull(str, &next, base);
 -
 -              if (field_width > 0 && next - str > field_width) {
 -                      if (base == 0)
 -                              _parse_integer_fixup_radix(str, &base);
 -                      while (next - str > field_width) {
 -                              if (is_sign)
 -                                      val.s = div_s64(val.s, base);
 -                              else
 -                                      val.u = div_u64(val.u, base);
 -                              --next;
 -                      }
 -              }
 +                      val.u = simple_strntoull(str,
 +                                               field_width >= 0 ? field_width : INT_MAX,
 +                                               &next, base);
  
                switch (qualifier) {
                case 'H':       /* that's 'hh' in format */
diff --combined mm/compaction.c
index 3a509fbf2bea3e0031a26685cc8b8b8de038fbcb,4796c197295f4121f9cac0675dd2fa34fa7bc79b..621508e0ecd5da3c4b82ea8d69832375c1bb3e50
@@@ -1297,8 -1297,7 +1297,7 @@@ move_freelist_head(struct list_head *fr
  
        if (!list_is_last(freelist, &freepage->lru)) {
                list_cut_before(&sublist, freelist, &freepage->lru);
-               if (!list_empty(&sublist))
-                       list_splice_tail(&sublist, freelist);
+               list_splice_tail(&sublist, freelist);
        }
  }
  
@@@ -1315,8 -1314,7 +1314,7 @@@ move_freelist_tail(struct list_head *fr
  
        if (!list_is_first(freelist, &freepage->lru)) {
                list_cut_position(&sublist, freelist, &freepage->lru);
-               if (!list_empty(&sublist))
-                       list_splice_tail(&sublist, freelist);
+               list_splice_tail(&sublist, freelist);
        }
  }
  
@@@ -1380,7 -1378,7 +1378,7 @@@ static int next_search_order(struct com
  static unsigned long
  fast_isolate_freepages(struct compact_control *cc)
  {
-       unsigned int limit = min(1U, freelist_scan_limit(cc) >> 1);
+       unsigned int limit = max(1U, freelist_scan_limit(cc) >> 1);
        unsigned int nr_scanned = 0;
        unsigned long low_pfn, min_pfn, highest = 0;
        unsigned long nr_isolated = 0;
                spin_unlock_irqrestore(&cc->zone->lock, flags);
  
                /*
-                * Smaller scan on next order so the total scan ig related
+                * Smaller scan on next order so the total scan is related
                 * to freelist_scan_limit.
                 */
                if (order_scanned >= limit)
-                       limit = min(1U, limit >> 1);
+                       limit = max(1U, limit >> 1);
        }
  
        if (!page) {
@@@ -1955,7 -1953,7 +1953,7 @@@ static inline bool is_via_compact_memor
  
  static bool kswapd_is_running(pg_data_t *pgdat)
  {
 -      return pgdat->kswapd && (pgdat->kswapd->state == TASK_RUNNING);
 +      return pgdat->kswapd && task_is_running(pgdat->kswapd);
  }
  
  /*
@@@ -2722,9 -2720,9 +2720,9 @@@ int sysctl_compaction_handler(struct ct
  }
  
  #if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
- static ssize_t sysfs_compact_node(struct device *dev,
-                       struct device_attribute *attr,
-                       const char *buf, size_t count)
+ static ssize_t compact_store(struct device *dev,
+                            struct device_attribute *attr,
+                            const char *buf, size_t count)
  {
        int nid = dev->id;
  
  
        return count;
  }
- static DEVICE_ATTR(compact, 0200, NULL, sysfs_compact_node);
+ static DEVICE_ATTR_WO(compact);
  
  int compaction_register_node(struct node *node)
  {
diff --combined mm/memcontrol.c
index b80aae448a49da5bb71ca17822861decae362c4e,b826dad6fa366e804c2a687451f0970de560babe..ae1f5d0cb58105c0957e2ac802965bebc3c36742
@@@ -81,14 -81,14 +81,14 @@@ DEFINE_PER_CPU(struct mem_cgroup *, int
  EXPORT_PER_CPU_SYMBOL_GPL(int_active_memcg);
  
  /* Socket memory accounting disabled? */
 -static bool cgroup_memory_nosocket;
 +static bool cgroup_memory_nosocket __ro_after_init;
  
  /* Kernel memory accounting disabled? */
 -bool cgroup_memory_nokmem;
 +bool cgroup_memory_nokmem __ro_after_init;
  
  /* Whether the swap controller is active */
  #ifdef CONFIG_MEMCG_SWAP
 -bool cgroup_memory_noswap __read_mostly;
 +bool cgroup_memory_noswap __ro_after_init;
  #else
  #define cgroup_memory_noswap          1
  #endif
@@@ -256,11 -256,6 +256,11 @@@ struct cgroup_subsys_state *vmpressure_
  #ifdef CONFIG_MEMCG_KMEM
  extern spinlock_t css_set_lock;
  
 +bool mem_cgroup_kmem_disabled(void)
 +{
 +      return cgroup_memory_nokmem;
 +}
 +
  static void obj_cgroup_uncharge_pages(struct obj_cgroup *objcg,
                                      unsigned int nr_pages);
  
@@@ -5537,7 -5532,7 +5537,7 @@@ static struct page *mc_handle_swap_pte(
         * as special swap entry in the CPU page table.
         */
        if (is_device_private_entry(ent)) {
-               page = device_private_entry_to_page(ent);
+               page = pfn_swap_entry_to_page(ent);
                /*
                 * MEMORY_DEVICE_PRIVATE means ZONE_DEVICE page and which have
                 * a refcount of 1 when free (unlike normal page)
@@@ -6644,7 -6639,7 +6644,7 @@@ static unsigned long effective_protecti
  }
  
  /**
-  * mem_cgroup_protected - check if memory consumption is in the normal range
+  * mem_cgroup_calculate_protection - check if memory consumption is in the normal range
   * @root: the top ancestor of the sub-tree being checked
   * @memcg: the memory cgroup to check
   *
diff --combined mm/mlock.c
index e338ebc4ad2953c11f1c24acfad5a1ac1ab32b08,4ab757ab6fe8995c9e172101dab81f56096d9756..0d639bf48794dc9787243afe98c10fb2f63408b8
@@@ -108,7 -108,7 +108,7 @@@ void mlock_vma_page(struct page *page
  /*
   * Finish munlock after successful page isolation
   *
-  * Page must be locked. This is a wrapper for try_to_munlock()
+  * Page must be locked. This is a wrapper for page_mlock()
   * and putback_lru_page() with munlock accounting.
   */
  static void __munlock_isolated_page(struct page *page)
         * and we don't need to check all the other vmas.
         */
        if (page_mapcount(page) > 1)
-               try_to_munlock(page);
+               page_mlock(page);
  
        /* Did try_to_unlock() succeed or punt? */
        if (!PageMlocked(page))
@@@ -158,7 -158,7 +158,7 @@@ static void __munlock_isolation_failed(
   * munlock()ed or munmap()ed, we want to check whether other vmas hold the
   * page locked so that we can leave it on the unevictable lru list and not
   * bother vmscan with it.  However, to walk the page's rmap list in
-  * try_to_munlock() we must isolate the page from the LRU.  If some other
+  * page_mlock() we must isolate the page from the LRU.  If some other
   * task has removed the page from the LRU, we won't be able to do that.
   * So we clear the PageMlocked as we might not get another chance.  If we
   * can't isolate the page, we leave it for putback_lru_page() and vmscan
@@@ -168,7 -168,7 +168,7 @@@ unsigned int munlock_vma_page(struct pa
  {
        int nr_pages;
  
-       /* For try_to_munlock() and to serialize with page migration */
+       /* For page_mlock() and to serialize with page migration */
        BUG_ON(!PageLocked(page));
        VM_BUG_ON_PAGE(PageTail(page), page);
  
@@@ -205,7 -205,7 +205,7 @@@ static int __mlock_posix_error_return(l
   *
   * The fast path is available only for evictable pages with single mapping.
   * Then we can bypass the per-cpu pvec and get better performance.
-  * when mapcount > 1 we need try_to_munlock() which can fail.
+  * when mapcount > 1 we need page_mlock() which can fail.
   * when !page_evictable(), we need the full redo logic of putback_lru_page to
   * avoid leaving evictable page in unevictable list.
   *
@@@ -414,7 -414,7 +414,7 @@@ static unsigned long __munlock_pagevec_
   *
   * We don't save and restore VM_LOCKED here because pages are
   * still on lru.  In unmap path, pages might be scanned by reclaim
-  * and re-mlocked by try_to_{munlock|unmap} before we unmap and
+  * and re-mlocked by page_mlock/try_to_unmap before we unmap and
   * free them.  This will result in freeing mlocked pages.
   */
  void munlock_vma_pages_range(struct vm_area_struct *vma,
@@@ -817,10 -817,9 +817,10 @@@ SYSCALL_DEFINE0(munlockall
   */
  static DEFINE_SPINLOCK(shmlock_user_lock);
  
 -int user_shm_lock(size_t size, struct user_struct *user)
 +int user_shm_lock(size_t size, struct ucounts *ucounts)
  {
        unsigned long lock_limit, locked;
 +      long memlock;
        int allowed = 0;
  
        locked = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
                allowed = 1;
        lock_limit >>= PAGE_SHIFT;
        spin_lock(&shmlock_user_lock);
 -      if (!allowed &&
 -          locked + user->locked_shm > lock_limit && !capable(CAP_IPC_LOCK))
 +      memlock = inc_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_MEMLOCK, locked);
 +
 +      if (!allowed && (memlock == LONG_MAX || memlock > lock_limit) && !capable(CAP_IPC_LOCK)) {
 +              dec_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_MEMLOCK, locked);
 +              goto out;
 +      }
 +      if (!get_ucounts(ucounts)) {
 +              dec_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_MEMLOCK, locked);
                goto out;
 -      get_uid(user);
 -      user->locked_shm += locked;
 +      }
        allowed = 1;
  out:
        spin_unlock(&shmlock_user_lock);
        return allowed;
  }
  
 -void user_shm_unlock(size_t size, struct user_struct *user)
 +void user_shm_unlock(size_t size, struct ucounts *ucounts)
  {
        spin_lock(&shmlock_user_lock);
 -      user->locked_shm -= (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
 +      dec_rlimit_ucounts(ucounts, UCOUNT_RLIMIT_MEMLOCK, (size + PAGE_SIZE - 1) >> PAGE_SHIFT);
        spin_unlock(&shmlock_user_lock);
 -      free_uid(user);
 +      put_ucounts(ucounts);
  }
diff --combined mm/page_alloc.c
index 0817d88383d5e9c6fccf798f6e8619b16a5b73ec,2f71d92c45b44606972c7e6303ab6dcbf0bdbf46..d6e94cc8066c1f46c772e660695010ddce37f817
@@@ -387,7 -387,7 +387,7 @@@ int page_group_by_mobility_disabled __r
  static DEFINE_STATIC_KEY_TRUE(deferred_pages);
  
  /*
 - * Calling kasan_free_pages() only after deferred memory initialization
 + * Calling kasan_poison_pages() only after deferred memory initialization
   * has completed. Poisoning pages during deferred memory init will greatly
   * lengthen the process and cause problem in large memory systems as the
   * deferred pages initialization is done with interrupt disabled.
   * on-demand allocation and then freed again before the deferred pages
   * initialization is done, but this is not likely to happen.
   */
 -static inline void kasan_free_nondeferred_pages(struct page *page, int order,
 -                                              bool init, fpi_t fpi_flags)
 +static inline bool should_skip_kasan_poison(struct page *page, fpi_t fpi_flags)
  {
 -      if (static_branch_unlikely(&deferred_pages))
 -              return;
 -      if (!IS_ENABLED(CONFIG_KASAN_GENERIC) &&
 -                      (fpi_flags & FPI_SKIP_KASAN_POISON))
 -              return;
 -      kasan_free_pages(page, order, init);
 +      return static_branch_unlikely(&deferred_pages) ||
 +             (!IS_ENABLED(CONFIG_KASAN_GENERIC) &&
 +              (fpi_flags & FPI_SKIP_KASAN_POISON)) ||
 +             PageSkipKASanPoison(page);
  }
  
  /* Returns true if the struct page for the pfn is uninitialised */
@@@ -455,11 -458,13 +455,11 @@@ defer_init(int nid, unsigned long pfn, 
        return false;
  }
  #else
 -static inline void kasan_free_nondeferred_pages(struct page *page, int order,
 -                                              bool init, fpi_t fpi_flags)
 +static inline bool should_skip_kasan_poison(struct page *page, fpi_t fpi_flags)
  {
 -      if (!IS_ENABLED(CONFIG_KASAN_GENERIC) &&
 -                      (fpi_flags & FPI_SKIP_KASAN_POISON))
 -              return;
 -      kasan_free_pages(page, order, init);
 +      return (!IS_ENABLED(CONFIG_KASAN_GENERIC) &&
 +              (fpi_flags & FPI_SKIP_KASAN_POISON)) ||
 +             PageSkipKASanPoison(page);
  }
  
  static inline bool early_page_uninitialised(unsigned long pfn)
@@@ -749,7 -754,6 +749,6 @@@ void prep_compound_page(struct page *pa
        __SetPageHead(page);
        for (i = 1; i < nr_pages; i++) {
                struct page *p = page + i;
-               set_page_count(p, 0);
                p->mapping = TAIL_MAPPING;
                set_compound_head(p, page);
        }
        return ret;
  }
  
 -static void kernel_init_free_pages(struct page *page, int numpages)
 +static void kernel_init_free_pages(struct page *page, int numpages, bool zero_tags)
  {
        int i;
  
 +      if (zero_tags) {
 +              for (i = 0; i < numpages; i++)
 +                      tag_clear_highpage(page + i);
 +              return;
 +      }
 +
        /* s390's use of memset() could override KASAN redzones. */
        kasan_disable_current();
        for (i = 0; i < numpages; i++) {
@@@ -1302,7 -1300,7 +1301,7 @@@ static __always_inline bool free_pages_
                        unsigned int order, bool check_free, fpi_t fpi_flags)
  {
        int bad = 0;
 -      bool init;
 +      bool skip_kasan_poison = should_skip_kasan_poison(page, fpi_flags);
  
        VM_BUG_ON_PAGE(PageTail(page), page);
  
         * With hardware tag-based KASAN, memory tags must be set before the
         * page becomes unavailable via debug_pagealloc or arch_free_page.
         */
 -      init = want_init_on_free();
 -      if (init && !kasan_has_integrated_init())
 -              kernel_init_free_pages(page, 1 << order);
 -      kasan_free_nondeferred_pages(page, order, init, fpi_flags);
 +      if (kasan_has_integrated_init()) {
 +              if (!skip_kasan_poison)
 +                      kasan_free_pages(page, order);
 +      } else {
 +              bool init = want_init_on_free();
 +
 +              if (init)
 +                      kernel_init_free_pages(page, 1 << order, false);
 +              if (!skip_kasan_poison)
 +                      kasan_poison_pages(page, order, init);
 +      }
  
        /*
         * arch_free_page() can make the page's contents inaccessible.  s390
@@@ -2407,6 -2398,8 +2406,6 @@@ static bool check_new_pages(struct pag
  inline void post_alloc_hook(struct page *page, unsigned int order,
                                gfp_t gfp_flags)
  {
 -      bool init;
 -
        set_page_private(page, 0);
        set_page_refcounted(page);
  
         * kasan_alloc_pages and kernel_init_free_pages must be
         * kept together to avoid discrepancies in behavior.
         */
 -      init = !want_init_on_free() && want_init_on_alloc(gfp_flags);
 -      kasan_alloc_pages(page, order, init);
 -      if (init && !kasan_has_integrated_init())
 -              kernel_init_free_pages(page, 1 << order);
 +      if (kasan_has_integrated_init()) {
 +              kasan_alloc_pages(page, order, gfp_flags);
 +      } else {
 +              bool init = !want_init_on_free() && want_init_on_alloc(gfp_flags);
 +
 +              kasan_unpoison_pages(page, order, init);
 +              if (init)
 +                      kernel_init_free_pages(page, 1 << order,
 +                                             gfp_flags & __GFP_ZEROTAGS);
 +      }
  
        set_page_owner(page, order, gfp_flags);
  }
@@@ -3193,7 -3180,7 +3192,7 @@@ static void __drain_all_pages(struct zo
        int cpu;
  
        /*
-        * Allocate in the BSS so we wont require allocation in
+        * Allocate in the BSS so we won't require allocation in
         * direct reclaim path for CONFIG_CPUMASK_OFFSTACK=y
         */
        static cpumask_t cpus_with_pcps;
@@@ -3832,7 -3819,7 +3831,7 @@@ static inline bool __should_fail_alloc_
  
  #endif /* CONFIG_FAIL_PAGE_ALLOC */
  
- noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
static noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
  {
        return __should_fail_alloc_page(gfp_mask, order);
  }
diff --combined mm/shmem.c
index 6268b9b4e41abeda9bc8023a12c043af40a51bc2,bd2ffd861ddbe579a834947675c92d25202946bb..70d9ce294bb4975644ec041fe5f523d9f45e9aa2
@@@ -1797,7 -1797,7 +1797,7 @@@ unlock
   * vm. If we swap it in we mark it dirty since we also free the swap
   * entry since a page cannot live in both the swap and page cache.
   *
-  * vmf and fault_type are only supplied by shmem_fault:
+  * vma, vmf, and fault_type are only supplied by shmem_fault:
   * otherwise they are NULL.
   */
  static int shmem_getpage_gfp(struct inode *inode, pgoff_t index,
@@@ -1832,6 -1832,16 +1832,16 @@@ repeat
  
        page = pagecache_get_page(mapping, index,
                                        FGP_ENTRY | FGP_HEAD | FGP_LOCK, 0);
+       if (page && vma && userfaultfd_minor(vma)) {
+               if (!xa_is_value(page)) {
+                       unlock_page(page);
+                       put_page(page);
+               }
+               *fault_type = handle_userfault(vmf, VM_UFFD_MINOR);
+               return 0;
+       }
        if (xa_is_value(page)) {
                error = shmem_swapin_page(inode, index, &page,
                                          sgp, gfp, vma, fault_type);
@@@ -2239,7 -2249,7 +2249,7 @@@ static struct mempolicy *shmem_get_poli
  }
  #endif
  
 -int shmem_lock(struct file *file, int lock, struct user_struct *user)
 +int shmem_lock(struct file *file, int lock, struct ucounts *ucounts)
  {
        struct inode *inode = file_inode(file);
        struct shmem_inode_info *info = SHMEM_I(inode);
         * no serialization needed when called from shm_destroy().
         */
        if (lock && !(info->flags & VM_LOCKED)) {
 -              if (!user_shm_lock(inode->i_size, user))
 +              if (!user_shm_lock(inode->i_size, ucounts))
                        goto out_nomem;
                info->flags |= VM_LOCKED;
                mapping_set_unevictable(file->f_mapping);
        }
 -      if (!lock && (info->flags & VM_LOCKED) && user) {
 -              user_shm_unlock(inode->i_size, user);
 +      if (!lock && (info->flags & VM_LOCKED) && ucounts) {
 +              user_shm_unlock(inode->i_size, ucounts);
                info->flags &= ~VM_LOCKED;
                mapping_clear_unevictable(file->f_mapping);
        }
@@@ -2352,27 -2362,25 +2362,25 @@@ static struct inode *shmem_get_inode(st
        return inode;
  }
  
- static int shmem_mfill_atomic_pte(struct mm_struct *dst_mm,
-                                 pmd_t *dst_pmd,
-                                 struct vm_area_struct *dst_vma,
-                                 unsigned long dst_addr,
-                                 unsigned long src_addr,
-                                 bool zeropage,
-                                 struct page **pagep)
+ #ifdef CONFIG_USERFAULTFD
+ int shmem_mfill_atomic_pte(struct mm_struct *dst_mm,
+                          pmd_t *dst_pmd,
+                          struct vm_area_struct *dst_vma,
+                          unsigned long dst_addr,
+                          unsigned long src_addr,
+                          bool zeropage,
+                          struct page **pagep)
  {
        struct inode *inode = file_inode(dst_vma->vm_file);
        struct shmem_inode_info *info = SHMEM_I(inode);
        struct address_space *mapping = inode->i_mapping;
        gfp_t gfp = mapping_gfp_mask(mapping);
        pgoff_t pgoff = linear_page_index(dst_vma, dst_addr);
-       spinlock_t *ptl;
        void *page_kaddr;
        struct page *page;
-       pte_t _dst_pte, *dst_pte;
        int ret;
-       pgoff_t offset, max_off;
+       pgoff_t max_off;
  
-       ret = -ENOMEM;
        if (!shmem_inode_acct_block(inode, 1)) {
                /*
                 * We may have got a page, returned -ENOENT triggering a retry,
                        put_page(*pagep);
                        *pagep = NULL;
                }
-               goto out;
+               return -ENOMEM;
        }
  
        if (!*pagep) {
+               ret = -ENOMEM;
                page = shmem_alloc_page(gfp, info, pgoff);
                if (!page)
                        goto out_unacct_blocks;
  
-               if (!zeropage) {        /* mcopy_atomic */
+               if (!zeropage) {        /* COPY */
                        page_kaddr = kmap_atomic(page);
                        ret = copy_from_user(page_kaddr,
                                             (const void __user *)src_addr,
                        /* fallback to copy_from_user outside mmap_lock */
                        if (unlikely(ret)) {
                                *pagep = page;
-                               shmem_inode_unacct_blocks(inode, 1);
+                               ret = -ENOENT;
                                /* don't free the page */
-                               return -ENOENT;
+                               goto out_unacct_blocks;
                        }
-               } else {                /* mfill_zeropage_atomic */
+               } else {                /* ZEROPAGE */
                        clear_highpage(page);
                }
        } else {
                *pagep = NULL;
        }
  
-       VM_BUG_ON(PageLocked(page) || PageSwapBacked(page));
+       VM_BUG_ON(PageLocked(page));
+       VM_BUG_ON(PageSwapBacked(page));
        __SetPageLocked(page);
        __SetPageSwapBacked(page);
        __SetPageUptodate(page);
  
        ret = -EFAULT;
-       offset = linear_page_index(dst_vma, dst_addr);
        max_off = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE);
-       if (unlikely(offset >= max_off))
+       if (unlikely(pgoff >= max_off))
                goto out_release;
  
        ret = shmem_add_to_page_cache(page, mapping, pgoff, NULL,
        if (ret)
                goto out_release;
  
-       _dst_pte = mk_pte(page, dst_vma->vm_page_prot);
-       if (dst_vma->vm_flags & VM_WRITE)
-               _dst_pte = pte_mkwrite(pte_mkdirty(_dst_pte));
-       else {
-               /*
-                * We don't set the pte dirty if the vma has no
-                * VM_WRITE permission, so mark the page dirty or it
-                * could be freed from under us. We could do it
-                * unconditionally before unlock_page(), but doing it
-                * only if VM_WRITE is not set is faster.
-                */
-               set_page_dirty(page);
-       }
-       dst_pte = pte_offset_map_lock(dst_mm, dst_pmd, dst_addr, &ptl);
-       ret = -EFAULT;
-       max_off = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE);
-       if (unlikely(offset >= max_off))
-               goto out_release_unlock;
-       ret = -EEXIST;
-       if (!pte_none(*dst_pte))
-               goto out_release_unlock;
-       lru_cache_add(page);
+       ret = mfill_atomic_install_pte(dst_mm, dst_pmd, dst_vma, dst_addr,
+                                      page, true, false);
+       if (ret)
+               goto out_delete_from_cache;
  
        spin_lock_irq(&info->lock);
        info->alloced++;
        shmem_recalc_inode(inode);
        spin_unlock_irq(&info->lock);
  
-       inc_mm_counter(dst_mm, mm_counter_file(page));
-       page_add_file_rmap(page, false);
-       set_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte);
-       /* No need to invalidate - it was non-present before */
-       update_mmu_cache(dst_vma, dst_addr, dst_pte);
-       pte_unmap_unlock(dst_pte, ptl);
+       SetPageDirty(page);
        unlock_page(page);
-       ret = 0;
- out:
-       return ret;
- out_release_unlock:
-       pte_unmap_unlock(dst_pte, ptl);
-       ClearPageDirty(page);
+       return 0;
+ out_delete_from_cache:
        delete_from_page_cache(page);
  out_release:
        unlock_page(page);
        put_page(page);
  out_unacct_blocks:
        shmem_inode_unacct_blocks(inode, 1);
-       goto out;
- }
- int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm,
-                          pmd_t *dst_pmd,
-                          struct vm_area_struct *dst_vma,
-                          unsigned long dst_addr,
-                          unsigned long src_addr,
-                          struct page **pagep)
- {
-       return shmem_mfill_atomic_pte(dst_mm, dst_pmd, dst_vma,
-                                     dst_addr, src_addr, false, pagep);
- }
- int shmem_mfill_zeropage_pte(struct mm_struct *dst_mm,
-                            pmd_t *dst_pmd,
-                            struct vm_area_struct *dst_vma,
-                            unsigned long dst_addr)
- {
-       struct page *page = NULL;
-       return shmem_mfill_atomic_pte(dst_mm, dst_pmd, dst_vma,
-                                     dst_addr, 0, true, &page);
+       return ret;
  }
+ #endif /* CONFIG_USERFAULTFD */
  
  #ifdef CONFIG_TMPFS
  static const struct inode_operations shmem_symlink_inode_operations;
@@@ -4040,8 -3996,7 +3996,7 @@@ bool shmem_huge_enabled(struct vm_area_
        loff_t i_size;
        pgoff_t off;
  
-       if ((vma->vm_flags & VM_NOHUGEPAGE) ||
-           test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags))
+       if (!transhuge_vma_enabled(vma, vma->vm_flags))
                return false;
        if (shmem_huge == SHMEM_HUGE_FORCE)
                return true;
@@@ -4104,7 -4059,7 +4059,7 @@@ int shmem_unuse(unsigned int type, boo
        return 0;
  }
  
 -int shmem_lock(struct file *file, int lock, struct user_struct *user)
 +int shmem_lock(struct file *file, int lock, struct ucounts *ucounts)
  {
        return 0;
  }
This page took 0.424954 seconds and 4 git commands to generate.