* remotes/origin/tmp-0453f563cce0:
FROMLIST: pwm: Convert period and duty cycle to u64
ANDROID: gki_defconfig: FW_CACHE to no
FROMGIT: firmware_class: make firmware caching configurable
ANDROID: gki_defconfig: removed CONFIG_PM_WAKELOCKS
ANDROID: gki_defconfig: enable CONFIG_IKHEADERS as m
ANDROID: update ABI representation
FROMLIST: reboot: Export reboot_mode
FROMLIST: iommu/arm-smmu: Update my email address in MODULE_AUTHOR()
FROMLIST: iommu/arm-smmu: Allow building as a module
FROMLIST: iommu/arm-smmu: Unregister IOMMU and bus ops on device removal
FROMLIST: iommu/arm-smmu-v3: Allow building as a module
FROMLIST: iommu/arm-smmu-v3: Unregister IOMMU and bus ops on device removal
FROMLIST: iommu/arm-smmu: Prevent forced unbinding of Arm SMMU drivers
FROMLIST: Revert "iommu/arm-smmu: Make arm-smmu explicitly non-modular"
FROMLIST: Revert "iommu/arm-smmu: Make arm-smmu-v3 explicitly non-modular"
FROMLIST: drivers/iommu: Allow IOMMU bus ops to be unregistered
FROMLIST: iommu/of: Take a ref to the IOMMU driver during ->of_xlate()
FROMLIST: drivers/iommu: Take a ref to the IOMMU driver prior to ->add_device()
FROMLIST: PCI: Export pci_ats_disabled() as a GPL symbol to modules
FROMLIST: iommu/of: Request ACS from the PCI core when configuring IOMMU linkage
FROMLIST: drivers/iommu: Export core IOMMU API symbols to permit modular drivers
FROMGIT: of: property: Add device link support for "iommu-map"
Revert "FROMLIST: iommu: Export core IOMMU functions to kernel modules"
Revert "FROMLIST: PCI: Export PCI ACS and DMA searching functions to modules"
Revert "FROMLIST: of: Export of_phandle_iterator_args() to modules"
ANDROID: initial branch preparations for 5.4
Linux 5.4
cramfs: fix usage on non-MTD device
Revert "Input: synaptics - enable RMI mode for X1 Extreme 2nd Generation"
afs: Fix large file support
afs: Fix possible assert with callbacks from yfs servers
r8152: avoid to call napi_disable twice
MAINTAINERS: Add myself as maintainer of virtio-vsock
udp: drop skb extensions before marking skb stateless
net: rtnetlink: prevent underflows in do_setvfinfo()
mm/ksm.c: don't WARN if page is still mapped in remove_stable_node()
mm/memory_hotplug: don't access uninitialized memmaps in shrink_zone_span()
Revert "fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry()"
can: m_can_platform: remove unnecessary m_can_class_resume() call
can: m_can_platform: set net_device structure as driver data
hv_netvsc: Fix send_table offset in case of a host bug
hv_netvsc: Fix offset usage in netvsc_send_table()
net-ipv6: IPV6_TRANSPARENT - check NET_RAW prior to NET_ADMIN
ANDROID: gki_defconfig: disable FUNCTION_TRACER
sfc: Only cancel the PPS workqueue if it exists
nfc: port100: handle command failure cleanly
drm/i915/fbdev: Restore physical addresses for fb_mmap()
net-sysfs: fix netdev_queue_add_kobject() breakage
ANDROID: update ABI representation
ANDROID: add unstripped modules to the distribution
Revert "drm/amd/display: enable S/G for RAVEN chip"
drm/amdgpu: disable gfxoff on original raven
drm/amdgpu: disable gfxoff when using register read interface
drm/amd/powerplay: correct fine grained dpm force level setting
drm/amd/powerplay: issue no PPSMC_MSG_GetCurrPkgPwr on unsupported ASICs
drm/amdgpu: remove experimental flag for Navi14
r8152: Re-order napi_disable in rtl8152_close
net: qca_spi: Move reset_count to struct qcaspi
net: qca_spi: fix receive buffer size check
net/ibmvnic: Ignore H_FUNCTION return from H_EOI to tolerate XIVE mode
Revert "net/ibmvnic: Fix EOI when running in XIVE mode"
net/mlxfw: Verify FSM error code translation doesn't exceed array size
net/mlx5: Update the list of the PCI supported devices
net/mlx5: Fix auto group size calculation
net/mlx5e: Add missing capability bit check for IP-in-IP
net/mlx5e: Do not use non-EXT link modes in EXT mode
net/mlx5e: Fix set vf link state error flow
net/mlx5: DR, Limit STE hash table enlarge based on bytemask
net/mlx5: DR, Skip rehash for tables with byte mask zero
net/mlx5: DR, Fix invalid EQ vector number on CQ creation
net/mlx5e: Reorder mirrer action parsing to check for encap first
net/mlx5e: Fix ingress rate configuration for representors
net/mlx5e: Fix error flow cleanup in mlx5e_tc_tun_create_header_ipv4/6
s390/qeth: return proper errno on IO error
s390/qeth: fix potential deadlock on workqueue flush
ipv6/route: return if there is no fib_nh_gw_family
net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject
arm64: uaccess: Remove uaccess_*_not_uao asm macros
arm64: uaccess: Ensure PAN is re-enabled after unhandled uaccess fault
BACKPORT: FROMLIST: pwm: Add support for different PWM output types
ANDROID: SoC: core: Introduce macro SOC_SINGLE_MULTI_EXT
ANDROID: usb: gadget: configfs: fix compiler warning
fork: fix pidfd_poll()'s return type
PM: QoS: Invalidate frequency QoS requests after removal
virtio_balloon: fix shrinker count
virtio_balloon: fix shrinker scan number of pages
mdio_bus: Fix init if CONFIG_RESET_CONTROLLER=n
Revert "mdio_bus: fix mdio_register_device when RESET_CONTROLLER is disabled"
net: hns3: fix a wrong reset interrupt status mask
net: fec: fix clock count mis-match
net/sched: act_pedit: fix WARN() in the traffic path
net: phylink: fix link mode modification in PHY mode
net: phylink: update documentation on create and destroy
r8169: disable TSO on a single version of RTL8168c to fix performance
MAINTAINERS: forcedeth: Change Zhu Yanjun's email address
taprio: don't reject same mqprio settings
net/tls: enable sk_msg redirect to tls socket egress
afs: Fix missing timeout reset
ANDROID: drivers: gpu: drm: add support to batch commands
gve: fix dma sync bug where not all pages synced
drm/i915: make pool objects read-only
mdio_bus: Fix init if CONFIG_RESET_CONTROLLER=n
nbd:fix memory leak in nbd_get_socket()
virtio_console: allocate inbufs in add_port() only if it is needed
virtio_ring: fix return code on DMA mapping fails
mdio_bus: fix mdio_register_device when RESET_CONTROLLER is disabled
net/ipv4: fix sysctl max for fib_multipath_hash_policy
phy: mdio-sun4i: add missed regulator_disable in remove
net/mlx4_en: Fix wrong limitation for number of TX rings
net: sched: ensure opts_len <= IP_TUNNEL_OPTS_MAX in act_tunnel_key
mlxsw: spectrum_router: Fix determining underlay for a GRE tunnel
net: atm: Reduce the severity of logging in unlink_clip_vcc
ANDROID: virtio_blk: Remove BUG_ON for discard/zero ops
drm/i915: Protect request peeking with RCU
drm/i915/userptr: Try to acquire the page lock around set_page_dirty()
drm/i915/pmu: "Frequency" is reported as accumulated cycles
drm/i915: Preload LUTs if the hw isn't currently using them
drm/i915: Don't oops in dumb_create ioctl if we have no crtcs
ANDROID: usb: gadget: configfs: Support multiple android instances
Linux 5.4-rc8
net/mlx4_en: fix mlx4 ethtool -N insertion
Revert "hwrng: core - Freeze khwrng thread during suspend"
ipmr: Fix skb headroom in ipmr_get_route().
net: hns3: cleanup of stray struct hns3_link_mode_mapping
net/smc: fix fastopen for non-blocking connect()
rds: ib: update WR sizes when bringing up connection
net: gemini: add missed free_netdev
net: dsa: tag_8021q: Fix dsa_8021q_restore_pvid for an absent pvid
seg6: fix skb transport_header after decap_and_validate()
seg6: fix srh pointer in get_srh()
net: stmmac: Use the correct style for SPDX License Identifier
octeontx2-af: Use the correct style for SPDX License Identifier
mm/debug.c: PageAnon() is true for PageKsm() pages
mm/debug.c: __dump_page() prints an extra line
mm/page_io.c: do not free shared swap slots
mm/memory_hotplug: fix try_offline_node()
mm,thp: recheck each page before collapsing file THP
mm: slub: really fix slab walking for init_on_free
mm: hugetlb: switch to css_tryget() in hugetlb_cgroup_charge_cgroup()
mm: memcg: switch to css_tryget() in get_mem_cgroup_from_mm()
lib/xz: fix XZ_DYNALLOC to avoid useless memory reallocations
mm: fix trying to reclaim unevictable lru page when calling madvise_pageout
mm: mempolicy: fix the wrong return value and potential pages leak of mbind
ANDROID: ion: Fix buffer_lock mutex initialization
Input: synaptics - enable RMI mode for X1 Extreme 2nd Generation
i2c: core: fix use after free in of_i2c_notify
i2c: acpi: Force bus speed to 400KHz if a Silead touchscreen is present
ptp: Extend the test program to check the external time stamp flags.
mlx5: Reject requests to enable time stamping on both edges.
igb: Reject requests that fail to enable time stamping on both edges.
dp83640: Reject requests to enable time stamping on both edges.
mv88e6xxx: Reject requests to enable time stamping on both edges.
ptp: Introduce strict checking of external time stamp options.
renesas: reject unsupported external timestamp flags
mlx5: reject unsupported external timestamp flags
igb: reject unsupported external timestamp flags
dp83640: reject unsupported external timestamp flags
mv88e6xxx: reject unsupported external timestamp flags
net: reject PTP periodic output requests with unsupported flags
ptp: Validate requests to enable time stamping of external signals.
net: ep93xx_eth: fix mismatch of request_mem_region in remove
ax88172a: fix information leak on short answers
selftests: mlxsw: Adjust test to recent changes
Input: synaptics-rmi4 - destroy F54 poller workqueue when removing
Input: ff-memless - kill timer in destroy()
FROMGIT: driver core: Allow device link operations inside sync_state()
afs: Fix race in commit bulk status fetch
Revert "ANDROID: Revert "Merge tag 'modules-for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux""
sched/uclamp: Fix incorrect condition
KVM: Add a comment describing the /dev/kvm no_compat handling
net: hns3: fix ETS bandwidth validation bug
net: hns3: reallocate SSU' buffer size when pfc_en changes
net: hns3: add compatible handling for MAC VLAN switch parameter configuration
ravb: implement MTU change while device is up
tipc: add back tipc prefix to log messages
ANDROID: uid_sys_stats: avoid double accounting of dying threads
ANDROID: drm: edid: add support for additional CEA extension blocks
ANDROID: include: uapi: drm: add additional drm mode flags
ANDROID: drivers: gpu: drm: fix bugs encountered while fuzzing
ANDROID: driver: gpu: drm: add notifier for panel related events
ANDROID: include: drm: add the definitions for DP Link Compliance tests
ANDROID: drm: dsi: add two DSI mode flags for BLLP
ANDROID: include: drm: support unicasting mipi cmds to dsi ctrls
ANDROID: include: drm: increase DRM max property count to 64
ANDROID: drivers: gpu: drm: add support for secure framebuffer
ANDROID: include: uapi: drm: add additional QCOM modifiers
ANDROID: build kernels with llvm-nm and llvm-objcopy
drm/amdgpu: fix null pointer deref in firmware header printing
rsxx: add missed destroy_workqueue calls in remove
iocost: check active_list of all the ancestors in iocg_activate()
rbd: silence bogus uninitialized warning in rbd_object_map_update_finish()
ceph: increment/decrement dio counter on async requests
ceph: take the inode lock before acquiring cap refs
ALSA: usb-audio: Fix incorrect size check for processing/extension units
KVM: x86/mmu: Take slots_lock when using kvm_mmu_zap_all_fast()
kbuild: tell sparse about the $ARCH
sparc: vdso: fix build error of vdso32
block, bfq: deschedule empty bfq_queues not referred by any process
mmc: sdhci-of-at91: fix quirk2 overwrite
ALSA: usb-audio: Fix incorrect NULL check in create_yamaha_midi_quirk()
slcan: Fix memory leak in error path
io_uring: ensure registered buffer import returns the IO length
net: cdc_ncm: Signedness bug in cdc_ncm_set_dgram_size()
io_uring: Fix getting file for timeout
ANDROID: scsi: ufs-qcom: Enable BROKEN_CRYPTO quirk flag
ANDROID: scsi: ufs-hisi: Enable BROKEN_CRYPTO quirk flag
ANDROID: scsi: ufs: Add quirk bit for controllers that don't play well with inline crypto
ANDROID: scsi: ufs: UFS init should not require inline crypto
gpiolib: acpi: Add Terra Pad 1061 to the run_edge_events_on_boot_blacklist
drm/i915/tgl: MOCS table update
Revert "drm/i915/ehl: Update MOCS table for EHL"
slip: Fix memory leak in slip_open error path
net: usb: qmi_wwan: add support for Foxconn T77W968 LTE modules
KVM: Forbid /dev/kvm being opened by a compat task when CONFIG_KVM_COMPAT=n
KVM: X86: Reset the three MSR list number variables to 0 in kvm_init_msr_list()
selftests: kvm: fix build with glibc >= 2.30
kvm: x86: disable shattered huge page recovery for PREEMPT_RT.
drm/sun4i: tcon: Set min division of TCON0_DCLK to 1.
tools: gpio: Correctly add make dependencies for gpio_utils
x86/resctrl: Fix potential lockdep warning
scripts/tools-support-relr.sh: un-quote variables
Revert "ANDROID: Revert "Merge tag 'modules-for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux""
ALSA: pcm: Fix stream lock usage in snd_pcm_period_elapsed()
ALSA: usb-audio: not submit urb for stopped endpoint
can: j1939: warn if resources are still linked on destroy
can: j1939: j1939_can_recv(): add priv refcounting
can: j1939: transport: j1939_cancel_active_session(): use hrtimer_try_to_cancel() instead of hrtimer_cancel()
can: j1939: make sure socket is held as long as session exists
can: j1939: transport: make sure the aborted session will be deactivated only once
can: j1939: socket: rework socket locking for j1939_sk_release() and j1939_sk_sendmsg()
can: j1939: main: j1939_ndev_to_priv(): avoid crash if can_ml_priv is NULL
can: j1939: move j1939_priv_put() into sk_destruct callback
can: af_can: export can_sock_destruct()
perf/core: Fix missing static inline on perf_cgroup_switch()
perf/core: Consistently fail fork on allocation failures
perf/aux: Disallow aux_output for kernel events
perf/core: Reattach a misplaced comment
perf/aux: Fix the aux_output group inheritance fix
perf/core: Disallow uncore-cgroup events
sched/pelt: Fix update of blocked PELT ordering
sched/core: Avoid spurious lock dependencies
dpaa2-eth: free already allocated channels on probe defer
Input: cyttsp4_core - fix use after free bug
Input: synaptics-rmi4 - clear IRQ enables for F54
Remove VirtualBox guest shared folders filesystem
net/smc: fix refcount non-blocking connect() -part 2
drm/i915: update rawclk also on resume
x86/quirks: Disable HPET on Intel Coffe Lake platforms
block: check bi_size overflow before merge
gpio: bd70528: Use correct unit for debounce times
gpio: max77620: Fixup debounce delays
KVM: MMU: Do not treat ZONE_DEVICE pages as being reserved
KVM: VMX: Introduce pi_is_pir_empty() helper
KVM: VMX: Do not change PID.NDST when loading a blocked vCPU
KVM: VMX: Consider PID.PIR to determine if vCPU has pending interrupts
KVM: VMX: Fix comment to specify PID.ON instead of PIR.ON
KVM: X86: Fix initialization of MSR lists
xfrm: release device reference for invalid state
io_uring: make timeout sequence == 0 mean no sequence
ntp/y2038: Remove incorrect time_t truncation
mdio_bus: Fix PTR_ERR applied after initialization to constant
NFC: nxp-nci: Fix NULL pointer dereference after I2C communication error
mlxsw: core: Enable devlink reload only on probe
FROMGIT: of: property: Add device link support for iommus, mboxes and io-channels
FROMGIT: of: property: Make it easy to add device links from DT properties
FROMGIT: of: property: Minor style clean up of of_link_to_phandle()
Revert "ANDROID: of/property: Add device link support for iommus"
devlink: Add method for time-stamp on reporter's dump
net: ethernet: dwmac-sun8i: Use the correct function in exit path
Btrfs: fix log context list corruption after rename exchange operation
drm/i915/cmdparser: Fix jump whitelist clearing
iommu/vt-d: Fix QI_DEV_IOTLB_PFSID and QI_DEV_EIOTLB_PFSID macros
MAINTAINERS: Update for INTEL IOMMU (VT-d) entry
KVM: fix placement of refcount initialization
KVM: Fix NULL-ptr deref after kvm_create_vm fails
ALSA: hda: hdmi - fix pin setup on Tigerlake
ALSA: hda: Add Cometlake-S PCI ID
Revert "Revert "sched: Rework pick_next_task() slow-path""
Linux 5.4-rc7
lib: Remove select of inexistant GENERIC_IO
ecryptfs_lookup_interpose(): lower_dentry->d_parent is not stable either
ecryptfs_lookup_interpose(): lower_dentry->d_inode is not stable
ecryptfs: fix unlink and rmdir in face of underlying fs modifications
audit_get_nd(): don't unlock parent too early
exportfs_decode_fh(): negative pinned may become positive without the parent locked
cgroup: don't put ERR_PTR() into fc->root
tcp: remove redundant new line from tcp_event_sk_skb
devlink: disallow reload operation during device cleanup
ALSA: usb-audio: Fix missing error check at mixer resolution test
ixgbe: need_wakeup flag might not be set for Tx
i40e: need_wakeup flag might not be set for Tx
igb/igc: use ktime accessors for skb->tstamp
i40e: Fix for ethtool -m issue on X722 NIC
iavf: initialize ITRN registers with correct values
ice: fix potential infinite loop because loop counter being too small
qede: fix NULL pointer deref in __qede_remove()
net: fix data-race in neigh_event_send()
sched: Fix pick_next_task() vs 'change' pattern race
sched/core: Fix compilation error when cgroup not selected
cgroup,writeback: don't switch wbs immediately on dead wbs if the memcg is dead
vsock/virtio: fix sock refcnt holding during the shutdown
iwlwifi: pcie: don't consider IV len in A-MSDU
net: ethernet: octeon_mgmt: Account for second possible VLAN header
pwm: bcm-iproc: Prevent unloading the driver module while in use
block: drbd: remove a stray unlock in __drbd_send_protocol()
cpufreq: intel_pstate: Fix invalid EPB setting
mac80211: fix station inactive_time shortly after boot
net/fq_impl: Switch to kvmalloc() for memory allocation
mac80211: fix ieee80211_txq_setup_flows() failure path
drm/i915/gvt: fix dropping obj reference twice
ANDROID: Kconfig.gki: Add SND_SOC_COMPRESS
ipv4: Fix table id reference in fib_sync_down_addr
ipv6: fixes rt6_probe() and fib6_nh->last_probe init
net: hns: Fix the stray netpoll locks causing deadlock in NAPI path
Revert "ANDROID: Kconfig.gki: Add SND_SOC_COMPRESS"
net: usb: qmi_wwan: add support for DW5821e with eSIM support
CDC-NCM: handle incomplete transfer of MTU
nfc: netlink: fix double device reference drop
ANDROID: Kconfig.gki: Add SND_SOC_COMPRESS
ceph: return -EINVAL if given fsc mount option on kernel w/o support
staging: Fix error return code in vboxsf_fill_super()
staging: vboxsf: fix dereference of pointer dentry before it is null checked
staging: vboxsf: Remove unused including <linux/version.h>
x86/speculation/taa: Fix printing of TAA_MSG_SMT on IBRS_ALL CPUs
xfrm: Fix memleak on xfrm state destroy
pinctrl: stmfx: fix valid_mask init sequence
NFC: st21nfca: fix double free
net: hns3: add compatible handling for command HCLGE_OPC_PF_RST_DONE
r8169: fix page read in r8168g_mdio_read
net: stmmac: Fix the TX IOC in xmit path
net: stmmac: Fix TSO descriptor with Enhanced Addressing
net: stmmac: Fix the packet count in stmmac_rx()
net: stmmac: xgmac: Disable MMC interrupts by default
net: stmmac: xgmac: Disable Flow Control when 1 or more queues are in AV
net: stmmac: xgmac: Fix AV Feature detection
net: stmmac: xgmac: Fix TSA selection
net: stmmac: xgmac: Only get SPH header len if available
net: stmmac: selftests: Prevent false positives in filter tests
net: stmmac: xgmac: bitrev32 returns u32
net: stmmac: gmac4: bitrev32 returns u32
SMB3: Fix persistent handles reconnect
drm/radeon: fix si_enable_smc_cac() failed issue
drm/amdgpu/renoir: move gfxoff handling into gfx9 module
drm/amdgpu: add warning for GRBM 1-cycle delay issue in gfx9
drm/amdgpu: add dummy read by engines for some GCVM status registers in gfx10
drm/amdgpu: register gpu instance before fan boost feature enablment
drm/amd/swSMU: fix smu workload bit map error
net/smc: fix ethernet interface refcounting
selftests/tls: add test for concurrent recv and send
net/tls: add a TX lock
net/tls: don't pay attention to sk_write_pending when pushing partial records
blkcg: make blkcg_print_stat() print stats only for online blkgs
drm/shmem: Add docbook comments for drm_gem_shmem_object madvise fields
net: mscc: ocelot: fix __ocelot_rmw_ix prototype
bpf, offload: Unlock on error in bpf_offload_dev_create()
net: mscc: ocelot: fix NULL pointer on LAG slave removal
net: mscc: ocelot: don't handle netdev events for other netdevs
net/mlx5e: Use correct enum to determine uplink port
net/mlx5: DR, Fix memory leak during rule creation
net/mlx5: DR, Fix memory leak in modify action destroy
net/mlx5e: Fix eswitch debug print of max fdb flow
HID: wacom: generic: Treat serial number and related fields as unsigned
drm/amdgpu: add navi14 PCI ID
Revert "drm/amd/display: setting the DIG_MODE to the correct value."
drm/amd/display: Add ENGINE_ID_DIGD condition check for Navi14
drm/amdgpu: dont schedule jobs while in reset
drm/amdgpu/arcturus: properly set BANK_SELECT and FRAGMENT_SIZE
arm64: Do not mask out PTE_RDONLY in pte_same()
ANDROID: nf: IDLETIMER: Fix possible use before initialization in idletimer_resume
ANDROID: gki_defconfig: enable FW_LOADER configs
net: bcmgenet: reapply manual settings to the PHY
Revert "net: bcmgenet: soft reset 40nm EPHYs before MAC init"
net: bcmgenet: use RGMII loopback for MAC reset
drm/atomic: fix self-refresh helpers crtc state dereference
RDMA/hns: Correct the value of srq_desc_size
RDMA/hns: Correct the value of HNS_ROCE_HEM_CHUNK_LEN
configfs: calculate the depth of parent item
IB/hfi1: TID RDMA WRITE should not return IB_WC_RNR_RETRY_EXC_ERR
IB/hfi1: Calculate flow weight based on QP MTU for TID RDMA
IB/hfi1: Ensure r_tid_ack is valid before building TID RDMA ACK packet
IB/hfi1: Ensure full Gen3 speed in a Gen4 system
ALSA: timer: Fix incorrectly assigned timer instance
mm: memcontrol: fix network errors from failing __GFP_ATOMIC charges
mm/memory_hotplug: fix updating the node span
scripts/gdb: fix debugging modules compiled with hot/cold partitioning
mm: slab: make page_cgroup_ino() to recognize non-compound slab pages properly
MAINTAINERS: update information for "MEMORY MANAGEMENT"
dump_stack: avoid the livelock of the dump_lock
zswap: add Vitaly to the maintainers list
mm/page_alloc.c: ratelimit allocation failure warnings more aggressively
mm/khugepaged: fix might_sleep() warn with CONFIG_HIGHPTE=y
mm, vmstat: reduce zone->lock holding time by /proc/pagetypeinfo
mm, vmstat: hide /proc/pagetypeinfo from normal users
mm/mmu_notifiers: use the right return code for WARN_ON
ocfs2: protect extent tree in ocfs2_prepare_inode_for_write()
mm: thp: handle page cache THP correctly in PageTransCompoundMap
mm, meminit: recalculate pcpu batch and high limits after init completes
mm/gup_benchmark: fix MAP_HUGETLB case
mm: memcontrol: fix NULL-ptr deref in percpu stats flush
MAINTAINERS: update Cavium ThunderX2 maintainers
ASoC: SOF: topology: Fix bytes control size checks
ARM: dts: stm32: change joystick pinctrl definition on stm32mp157c-ev1
ARM: dts: stm32: remove OV5640 pinctrl definition on stm32mp157c-ev1
ARM: dts: stm32: Fix CAN RAM mapping on stm32mp157c
ARM: dts: stm32: relax qspi pins slew-rate for stm32mp157
scsi: core: Handle drivers which set sg_tablesize to zero
scsi: qla2xxx: fix NPIV tear down process
scsi: sd_zbc: Fix sd_zbc_complete()
Documentation: TLS: Add missing counter description
NFC: fdp: fix incorrect free object
net: prevent load/store tearing on sk->sk_stamp
net: qualcomm: rmnet: Fix potential UAF when unregistering
net/tls: fix sk_msg trim on fallback to copy mode
mlx4_core: fix wrong comment about the reason of subtract one from the max_cqes
net: dsa: bcm_sf2: Fix driver removal
net: sched: prevent duplicate flower rules from tcf_proto destroy race
net: hns3: Use the correct style for SPDX License Identifier
bonding: fix state transition issue in link monitoring
taprio: fix panic while hw offload sched list swap
FROMLIST: overlayfs: override_creds=off option bypass creator_cred
FROMLIST: overlayfs: internal getxattr operations without sepolicy checking
FROMLIST: overlayfs: handle XATTR_NOSECURITY flag for get xattr method
FROMLIST: Add flags option to get xattr method paired to __vfs_getxattr
FROMLIST: afs: xattr: use scnprintf
nvme: change nvme_passthru_cmd64 to explicitly mark rsvd
drm/i915/gen8+: Add RC6 CTX corruption WA
drm/i915: Lower RM timeout to avoid DSI hard hangs
drm/i915/cmdparser: Ignore Length operands during command matching
drm/i915/cmdparser: Add support for backward jumps
drm/i915/cmdparser: Use explicit goto for error paths
drm/i915: Add gen9 BCS cmdparsing
drm/i915: Allow parsing of unsized batches
drm/i915: Support ro ppgtt mapped cmdparser shadow buffers
drm/i915: Add support for mandatory cmdparsing
drm/i915: Remove Master tables from cmdparser
drm/i915: Disable Secure Batches for gen6+
drm/i915: Rename gen7 cmdparser tables
ALSA: hda: hdmi - add Tigerlake support
ASoC: max98373: replace gpio_request with devm_gpio_request
ASoC: stm32: sai: add restriction on mmap support
watchdog: bd70528: Add MODULE_ALIAS to allow module auto loading
watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format
watchdog: meson: Fix the wrong value of left time
watchdog: pm8916_wdt: fix pretimeout registration flow
watchdog: cpwd: fix build regression
nvme-multipath: fix crash in nvme_mpath_clear_ctrl_paths
nvme-rdma: fix a segmentation fault during module unload
clone3: validate stack arguments
ceph: don't allow copy_file_range when stripe_count != 1
ceph: don't try to handle hashed dentries in non-O_CREAT atomic_open
ALSA: hda/ca0132 - Fix possible workqueue stall
scripts/nsdeps: make sure to pass all module source files to spatch
perf tools: Fix time sorting
can: don't use deprecated license identifiers
can: mcp251x: mcp251x_restart_work_handler(): Fix potential force_quit race condition
perf tools: Remove unused trace_find_next_event()
perf scripting engines: Iterate on tep event arrays directly
FROMGIT: of: property: Skip adding device links to suppliers that aren't devices
x86/tsc: Respect tsc command line paraemeter for clocksource_tsc_early
Input: synaptics-rmi4 - remove unused result_bits mask
Input: synaptics-rmi4 - do not consume more data than we have (F11, F12)
Input: synaptics-rmi4 - disable the relative position IRQ in the F12 driver
Input: synaptics-rmi4 - fix video buffer size
x86/dumpstack/64: Don't evaluate exception stacks before setup
irq/irqdomain: Update __irq_domain_alloc_fwnode() function documentation
x86/apic/32: Avoid bogus LDR warnings
timekeeping/vsyscall: Update VDSO data unconditionally
drm/i915/dp: Do not switch aux to TBT mode for non-TC ports
drm/i915: Avoid HPD poll detect triggering a new detect cycle
can: j1939: transport: j1939_xtp_rx_eoma_one(): Add sanity check for correct total message size
can: j1939: transport: j1939_session_fresh_new(): make sure EOMA is send with the total message size set
can: j1939: fix memory leak if filters was set
can: j1939: fix resource leak of skb on error return paths
can: ti_hecc: add missing state changes
can: ti_hecc: properly report state changes
can: ti_hecc: add fifo overflow error reporting
can: ti_hecc: release the mailbox a bit earlier
can: ti_hecc: keep MIM and MD set
can: ti_hecc: ti_hecc_stop(): stop the CPK on down
can: ti_hecc: ti_hecc_error(): increase error counters if skb enqueueing via can_rx_offload_queue_sorted() fails
can: flexcan: increase error counters if skb enqueueing via can_rx_offload_queue_sorted() fails
can: rx-offload: can_rx_offload_irq_offload_fifo(): continue on error
can: rx-offload: can_rx_offload_irq_offload_timestamp(): continue on error
can: rx-offload: can_rx_offload_offload_one(): use ERR_PTR() to propagate error value in case of errors
can: rx-offload: can_rx_offload_offload_one(): increment rx_fifo_errors on queue overflow or OOM
can: rx-offload: can_rx_offload_offload_one(): do not increase the skb_queue beyond skb_queue_len_max
can: rx-offload: can_rx_offload_queue_tail(): fix error handling, avoid skb mem leak
can: rx-offload: can_rx_offload_queue_sorted(): fix error handling, avoid skb mem leak
can: xilinx_can: Fix flags field initialization for axi can
can: c_can: C_CAN: add bus recovery events
can: c_can: D_CAN: c_can_chip_config(): perform a sofware reset on open
can: c_can: c_can_poll(): only read status register after status IRQ
can: peak_usb: report bus recovery as well
can: peak_usb: fix slab info leak
can: peak_usb: fix a potential out-of-sync while decoding packets
can: flexcan: disable completely the ECC mechanism
can: usb_8dev: fix use-after-free on disconnect
can: mcba_usb: fix use-after-free on disconnect
can: gs_usb: gs_can_open(): prevent memory leak
can: dev: add missing of_node_put() after calling of_get_child_by_name()
btrfs: un-deprecate ioctls START_SYNC and WAIT_SYNC
btrfs: save i_size to avoid double evaluation of i_size_read in compress_file_range
stacktrace: Don't skip first entry on noncurrent tasks
netfilter: nf_tables_offload: skip EBUSY on chain update
netfilter: nf_tables: bogus EOPNOTSUPP on basechain update
bridge: ebtables: don't crash when using dnat target in output chains
netfilter: nf_tables: fix unexpected EOPNOTSUPP error
netfilter: nf_tables: Align nft_expr private data to 64-bit
netfilter: ipset: Fix nla_policies to fully support NL_VALIDATE_STRICT
netfilter: ipset: Copy the right MAC address in hash:ip,mac IPv6 sets
netfilter: ipset: Fix an error code in ip_set_sockfn_get()
dccp: do not leak jiffies on the wire
net: fec: add missed clk_disable_unprepare in remove
Documentation: Add ITLB_MULTIHIT documentation
kvm: x86: mmu: Recovery of shattered NX large pages
MAINTAINERS: Remove Kevin as maintainer of BMIPS generic platforms
clk: ti: clkctrl: Fix failed to enable error with double udelay timeout
clk: ti: dra7-atl-clock: Remove ti_clk_add_alias call
netfilter: nf_tables_offload: check for register data length mismatches
intel_th: pci: Add Jasper Lake PCH support
intel_th: pci: Add Comet Lake PCH support
intel_th: msu: Fix possible memory leak in mode_store()
intel_th: msu: Fix overflow in shift of an unsigned int
intel_th: msu: Fix missing allocation failure check on a kstrndup
intel_th: msu: Fix an uninitialized mutex
intel_th: gth: Fix the window switching sequence
ASoC: hdac_hda: fix race in device removal
kvm: Add helper function for creating VM worker threads
kvm: mmu: ITLB_MULTIHIT mitigation
cpu/speculation: Uninline and export CPU mitigations helpers
x86/cpu: Add Tremont to the cpu vulnerability whitelist
x86/bugs: Add ITLB_MULTIHIT bug infrastructure
fbdev: c2p: Fix link failure on non-inlining
ALSA: bebob: fix to detect configured source of sampling clock for Focusrite Saffire Pro i/o series
arm64: dts: zii-ultra: fix ARM regulator GPIO handle
Revert "gpio: merrifield: Pass irqchip when adding gpiochip"
Revert "gpio: merrifield: Restore use of irq_base"
Revert "gpio: merrifield: Move hardware initialization to callback"
x86/resctrl: Prevent NULL pointer dereference when reading mondata
idr: Fix idr_alloc_u32 on 32-bit systems
idr: Fix integer overflow in idr_for_each_entry
HID: i2c-hid: Send power-on command after reset
radix tree: Remove radix_tree_iter_find
idr: Fix idr_get_next_ul race with idr_remove
powerpc/bpf: Fix tail call implementation
MIPS: SGI-IP27: fix exception handler replication
bpf: Change size to u64 for bpf_map_{area_alloc, charge_init}()
samples/bpf: fix build by setting HAVE_ATTR_TEST to zero
perf tools: Make usage of test_attr__* optional for perf-sys.h
bpf: Allow narrow loads of bpf_sysctl fields with offset > 0
staging: Add VirtualBox guest shared folder (vboxsf) support
ceph: add missing check in d_revalidate snapdir handling
ceph: fix RCU case handling in ceph_d_revalidate()
ceph: fix use-after-free in __ceph_remove_cap()
bpf, doc: Add Andrii as official reviewer to BPF subsystem
ARM: sunxi: Fix CPU powerdown on A83T
ARM: dts: sun8i-a83t-tbs-a711: Fix WiFi resume from suspend
clk: sunxi-ng: a80: fix the zero'ing of bits 16 and 18
clk: sunxi: Fix operator precedence in sunxi_divs_clk_setup
clk: ast2600: Fix enabling of clocks
clk: at91: avoid sleeping early
ASoC: rockchip: rockchip_max98090: Enable SHDN to fix headset detection
ASoC: ti: sdma-pcm: Add back the flags parameter for non standard dma names
ASoC: SOF: ipc: Fix memory leak in sof_set_get_large_ctrl_data
ASoC: SOF: Fix memory leak in sof_dfsentry_write
ASoC: SOF: Intel: hda-stream: fix the CONFIG_ prefix missing
arm64: dts: imx8mn: fix compatible string for sdma
arm64: dts: imx8mm: fix compatible string for sdma
reset: fix reset_control_ops kerneldoc comment
clk: imx8m: Use SYS_PLL1_800M as intermediate parent of CLK_ARM
x86/tsx: Add config options to set tsx=on|off|auto
x86/speculation/taa: Add documentation for TSX Async Abort
x86/tsx: Add "auto" option to the tsx= cmdline parameter
kvm/x86: Export MDS_NO=0 to guests when TSX is enabled
x86/speculation/taa: Add sysfs reporting for TSX Async Abort
x86/speculation/taa: Add mitigation for TSX Async Abort
x86/cpu: Add a "tsx=" cmdline option with TSX disabled by default
x86/cpu: Add a helper function x86_read_arch_cap_msr()
x86/msr: Add the IA32_TSX_CTRL MSR
ARM: dts: imx6-logicpd: Re-enable SNVS power key
iio: adc: stm32-adc: fix stopping dma
soc: imx: gpc: fix initialiser format
ARM: dts: imx6qdl-sabreauto: Fix storm of accelerometer interrupts
Btrfs: fix race leading to metadata space leak after task received signal
btrfs: tree-checker: Fix wrong check on max devid
btrfs: Consider system chunk array size for new SYSTEM chunks
pinctrl: cherryview: Allocate IRQ chip dynamic
clk: samsung: exynos5420: Preserve PLL configuration during suspend/resume
arm64: dts: ls1028a: fix a compatible issue
autofs: fix a leak in autofs_expire_indirect()
soundwire: slave: fix scanf format
reset: fix reset_control_get_exclusive kerneldoc comment
reset: fix reset_control_lookup kerneldoc comment
reset: fix of_reset_control_get_count kerneldoc comment
reset: fix of_reset_simple_xlate kerneldoc comment
ASoC: kirkwood: fix device remove ordering
ASoC: rsnd: dma: fix SSI9 4/5/6/7 busif dma address
ASoC: hdmi-codec: drop mutex locking again
ASoC: kirkwood: fix external clock probe defer
clk: samsung: exynos542x: Move G3D subsystem clocks to its sub-CMU
clk: samsung: exynos5433: Fix error paths
tools: gpio: Use !building_out_of_srctree to determine srctree
iio: imu: inv_mpu6050: fix no data on MPU6050
reset: Fix memory leak in reset_control_array_put()
aio: Fix io_pgetevents() struct __compat_aio_sigset layout
pinctrl: cherryview: Fix irq_valid_mask calculation
ASoC: compress: fix unsigned integer overflow check
ASoC: msm8916-wcd-analog: Fix RX1 selection in RDAC2 MUX
pinctrl: intel: Avoid potential glitches if pin is in GPIO mode
soundwire: intel: fix intel_register_dai PDI offsets and numbers
interconnect: Add locking in icc_set_tag()
interconnect: qcom: Fix icc_onecell_data allocation
clocksource/drivers/sh_mtu2: Do not loop using platform_get_irq_by_name()
fs/namespace.c: fix use-after-free of mount in mnt_warn_timestamp_expiry()
clocksource/drivers/mediatek: Fix error handling
soundwire: depend on ACPI || OF
soundwire: depend on ACPI
iio: srf04: fix wrong limitation in distance measuring
iio: imu: adis16480: make sure provided frequency is positive
cgroup: freezer: call cgroup_enter_frozen() with preemption disabled in ptrace_stop()
thunderbolt: Drop unnecessary read when writing LC command in Ice Lake
thunderbolt: Fix lockdep circular locking depedency warning
thunderbolt: Read DP IN adapter first two dwords in one go
clk: at91: sam9x60: fix programmable clock
clk: meson: g12a: set CLK_MUX_ROUND_CLOSEST on the cpu clock muxes
clk: meson: g12a: fix cpu clock rate setting
clk: meson: gxbb: let sar_adc_clk_div set the parent clock rate
XArray: Fix xas_next() with a single entry at 0
Change-Id: I594a629aca56b3ff5a224d65f0d8d79fe4f4f34b
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
438 lines
10 KiB
C
438 lines
10 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* linux/mm/page_io.c
|
|
*
|
|
* Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
|
|
*
|
|
* Swap reorganised 29.12.95,
|
|
* Asynchronous swapping added 30.12.95. Stephen Tweedie
|
|
* Removed race in async swapping. 14.4.1996. Bruno Haible
|
|
* Add swap of shared pages through the page cache. 20.2.1998. Stephen Tweedie
|
|
* Always use brw_page, life becomes simpler. 12 May 1998 Eric Biederman
|
|
*/
|
|
|
|
#include <linux/mm.h>
|
|
#include <linux/kernel_stat.h>
|
|
#include <linux/gfp.h>
|
|
#include <linux/pagemap.h>
|
|
#include <linux/swap.h>
|
|
#include <linux/bio.h>
|
|
#include <linux/swapops.h>
|
|
#include <linux/buffer_head.h>
|
|
#include <linux/writeback.h>
|
|
#include <linux/frontswap.h>
|
|
#include <linux/blkdev.h>
|
|
#include <linux/uio.h>
|
|
#include <linux/sched/task.h>
|
|
#include <asm/pgtable.h>
|
|
|
|
static struct bio *get_swap_bio(gfp_t gfp_flags,
|
|
struct page *page, bio_end_io_t end_io)
|
|
{
|
|
struct bio *bio;
|
|
|
|
bio = bio_alloc(gfp_flags, 1);
|
|
if (bio) {
|
|
struct block_device *bdev;
|
|
|
|
bio->bi_iter.bi_sector = map_swap_page(page, &bdev);
|
|
bio_set_dev(bio, bdev);
|
|
bio->bi_iter.bi_sector <<= PAGE_SHIFT - 9;
|
|
bio->bi_end_io = end_io;
|
|
|
|
bio_add_page(bio, page, PAGE_SIZE * hpage_nr_pages(page), 0);
|
|
}
|
|
return bio;
|
|
}
|
|
|
|
void end_swap_bio_write(struct bio *bio)
|
|
{
|
|
struct page *page = bio_first_page_all(bio);
|
|
|
|
if (bio->bi_status) {
|
|
SetPageError(page);
|
|
/*
|
|
* We failed to write the page out to swap-space.
|
|
* Re-dirty the page in order to avoid it being reclaimed.
|
|
* Also print a dire warning that things will go BAD (tm)
|
|
* very quickly.
|
|
*
|
|
* Also clear PG_reclaim to avoid rotate_reclaimable_page()
|
|
*/
|
|
set_page_dirty(page);
|
|
pr_alert_ratelimited("Write-error on swap-device (%u:%u:%llu)\n",
|
|
MAJOR(bio_dev(bio)),
|
|
MINOR(bio_dev(bio)),
|
|
(unsigned long long)bio->bi_iter.bi_sector);
|
|
ClearPageReclaim(page);
|
|
}
|
|
end_page_writeback(page);
|
|
bio_put(bio);
|
|
}
|
|
|
|
static void swap_slot_free_notify(struct page *page)
|
|
{
|
|
struct swap_info_struct *sis;
|
|
struct gendisk *disk;
|
|
swp_entry_t entry;
|
|
|
|
/*
|
|
* There is no guarantee that the page is in swap cache - the software
|
|
* suspend code (at least) uses end_swap_bio_read() against a non-
|
|
* swapcache page. So we must check PG_swapcache before proceeding with
|
|
* this optimization.
|
|
*/
|
|
if (unlikely(!PageSwapCache(page)))
|
|
return;
|
|
|
|
sis = page_swap_info(page);
|
|
if (!(sis->flags & SWP_BLKDEV))
|
|
return;
|
|
|
|
/*
|
|
* The swap subsystem performs lazy swap slot freeing,
|
|
* expecting that the page will be swapped out again.
|
|
* So we can avoid an unnecessary write if the page
|
|
* isn't redirtied.
|
|
* This is good for real swap storage because we can
|
|
* reduce unnecessary I/O and enhance wear-leveling
|
|
* if an SSD is used as the as swap device.
|
|
* But if in-memory swap device (eg zram) is used,
|
|
* this causes a duplicated copy between uncompressed
|
|
* data in VM-owned memory and compressed data in
|
|
* zram-owned memory. So let's free zram-owned memory
|
|
* and make the VM-owned decompressed page *dirty*,
|
|
* so the page should be swapped out somewhere again if
|
|
* we again wish to reclaim it.
|
|
*/
|
|
disk = sis->bdev->bd_disk;
|
|
entry.val = page_private(page);
|
|
if (disk->fops->swap_slot_free_notify && __swap_count(entry) == 1) {
|
|
unsigned long offset;
|
|
|
|
offset = swp_offset(entry);
|
|
|
|
SetPageDirty(page);
|
|
disk->fops->swap_slot_free_notify(sis->bdev,
|
|
offset);
|
|
}
|
|
}
|
|
|
|
static void end_swap_bio_read(struct bio *bio)
|
|
{
|
|
struct page *page = bio_first_page_all(bio);
|
|
struct task_struct *waiter = bio->bi_private;
|
|
|
|
if (bio->bi_status) {
|
|
SetPageError(page);
|
|
ClearPageUptodate(page);
|
|
pr_alert("Read-error on swap-device (%u:%u:%llu)\n",
|
|
MAJOR(bio_dev(bio)), MINOR(bio_dev(bio)),
|
|
(unsigned long long)bio->bi_iter.bi_sector);
|
|
goto out;
|
|
}
|
|
|
|
SetPageUptodate(page);
|
|
swap_slot_free_notify(page);
|
|
out:
|
|
unlock_page(page);
|
|
WRITE_ONCE(bio->bi_private, NULL);
|
|
bio_put(bio);
|
|
if (waiter) {
|
|
blk_wake_io_task(waiter);
|
|
put_task_struct(waiter);
|
|
}
|
|
}
|
|
|
|
int generic_swapfile_activate(struct swap_info_struct *sis,
|
|
struct file *swap_file,
|
|
sector_t *span)
|
|
{
|
|
struct address_space *mapping = swap_file->f_mapping;
|
|
struct inode *inode = mapping->host;
|
|
unsigned blocks_per_page;
|
|
unsigned long page_no;
|
|
unsigned blkbits;
|
|
sector_t probe_block;
|
|
sector_t last_block;
|
|
sector_t lowest_block = -1;
|
|
sector_t highest_block = 0;
|
|
int nr_extents = 0;
|
|
int ret;
|
|
|
|
blkbits = inode->i_blkbits;
|
|
blocks_per_page = PAGE_SIZE >> blkbits;
|
|
|
|
/*
|
|
* Map all the blocks into the extent tree. This code doesn't try
|
|
* to be very smart.
|
|
*/
|
|
probe_block = 0;
|
|
page_no = 0;
|
|
last_block = i_size_read(inode) >> blkbits;
|
|
while ((probe_block + blocks_per_page) <= last_block &&
|
|
page_no < sis->max) {
|
|
unsigned block_in_page;
|
|
sector_t first_block;
|
|
|
|
cond_resched();
|
|
|
|
first_block = bmap(inode, probe_block);
|
|
if (first_block == 0)
|
|
goto bad_bmap;
|
|
|
|
/*
|
|
* It must be PAGE_SIZE aligned on-disk
|
|
*/
|
|
if (first_block & (blocks_per_page - 1)) {
|
|
probe_block++;
|
|
goto reprobe;
|
|
}
|
|
|
|
for (block_in_page = 1; block_in_page < blocks_per_page;
|
|
block_in_page++) {
|
|
sector_t block;
|
|
|
|
block = bmap(inode, probe_block + block_in_page);
|
|
if (block == 0)
|
|
goto bad_bmap;
|
|
if (block != first_block + block_in_page) {
|
|
/* Discontiguity */
|
|
probe_block++;
|
|
goto reprobe;
|
|
}
|
|
}
|
|
|
|
first_block >>= (PAGE_SHIFT - blkbits);
|
|
if (page_no) { /* exclude the header page */
|
|
if (first_block < lowest_block)
|
|
lowest_block = first_block;
|
|
if (first_block > highest_block)
|
|
highest_block = first_block;
|
|
}
|
|
|
|
/*
|
|
* We found a PAGE_SIZE-length, PAGE_SIZE-aligned run of blocks
|
|
*/
|
|
ret = add_swap_extent(sis, page_no, 1, first_block);
|
|
if (ret < 0)
|
|
goto out;
|
|
nr_extents += ret;
|
|
page_no++;
|
|
probe_block += blocks_per_page;
|
|
reprobe:
|
|
continue;
|
|
}
|
|
ret = nr_extents;
|
|
*span = 1 + highest_block - lowest_block;
|
|
if (page_no == 0)
|
|
page_no = 1; /* force Empty message */
|
|
sis->max = page_no;
|
|
sis->pages = page_no - 1;
|
|
sis->highest_bit = page_no - 1;
|
|
out:
|
|
return ret;
|
|
bad_bmap:
|
|
pr_err("swapon: swapfile has holes\n");
|
|
ret = -EINVAL;
|
|
goto out;
|
|
}
|
|
|
|
/*
|
|
* We may have stale swap cache pages in memory: notice
|
|
* them here and get rid of the unnecessary final write.
|
|
*/
|
|
int swap_writepage(struct page *page, struct writeback_control *wbc)
|
|
{
|
|
int ret = 0;
|
|
|
|
if (try_to_free_swap(page)) {
|
|
unlock_page(page);
|
|
goto out;
|
|
}
|
|
if (frontswap_store(page) == 0) {
|
|
set_page_writeback(page);
|
|
unlock_page(page);
|
|
end_page_writeback(page);
|
|
goto out;
|
|
}
|
|
ret = __swap_writepage(page, wbc, end_swap_bio_write);
|
|
out:
|
|
return ret;
|
|
}
|
|
|
|
static sector_t swap_page_sector(struct page *page)
|
|
{
|
|
return (sector_t)__page_file_index(page) << (PAGE_SHIFT - 9);
|
|
}
|
|
|
|
static inline void count_swpout_vm_event(struct page *page)
|
|
{
|
|
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
|
if (unlikely(PageTransHuge(page)))
|
|
count_vm_event(THP_SWPOUT);
|
|
#endif
|
|
count_vm_events(PSWPOUT, hpage_nr_pages(page));
|
|
}
|
|
|
|
int __swap_writepage(struct page *page, struct writeback_control *wbc,
|
|
bio_end_io_t end_write_func)
|
|
{
|
|
struct bio *bio;
|
|
int ret;
|
|
struct swap_info_struct *sis = page_swap_info(page);
|
|
|
|
VM_BUG_ON_PAGE(!PageSwapCache(page), page);
|
|
if (sis->flags & SWP_FS) {
|
|
struct kiocb kiocb;
|
|
struct file *swap_file = sis->swap_file;
|
|
struct address_space *mapping = swap_file->f_mapping;
|
|
struct bio_vec bv = {
|
|
.bv_page = page,
|
|
.bv_len = PAGE_SIZE,
|
|
.bv_offset = 0
|
|
};
|
|
struct iov_iter from;
|
|
|
|
iov_iter_bvec(&from, WRITE, &bv, 1, PAGE_SIZE);
|
|
init_sync_kiocb(&kiocb, swap_file);
|
|
kiocb.ki_pos = page_file_offset(page);
|
|
|
|
set_page_writeback(page);
|
|
unlock_page(page);
|
|
ret = mapping->a_ops->direct_IO(&kiocb, &from);
|
|
if (ret == PAGE_SIZE) {
|
|
count_vm_event(PSWPOUT);
|
|
ret = 0;
|
|
} else {
|
|
/*
|
|
* In the case of swap-over-nfs, this can be a
|
|
* temporary failure if the system has limited
|
|
* memory for allocating transmit buffers.
|
|
* Mark the page dirty and avoid
|
|
* rotate_reclaimable_page but rate-limit the
|
|
* messages but do not flag PageError like
|
|
* the normal direct-to-bio case as it could
|
|
* be temporary.
|
|
*/
|
|
set_page_dirty(page);
|
|
ClearPageReclaim(page);
|
|
pr_err_ratelimited("Write error on dio swapfile (%llu)\n",
|
|
page_file_offset(page));
|
|
}
|
|
end_page_writeback(page);
|
|
return ret;
|
|
}
|
|
|
|
ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc);
|
|
if (!ret) {
|
|
count_swpout_vm_event(page);
|
|
return 0;
|
|
}
|
|
|
|
ret = 0;
|
|
bio = get_swap_bio(GFP_NOIO, page, end_write_func);
|
|
if (bio == NULL) {
|
|
set_page_dirty(page);
|
|
unlock_page(page);
|
|
ret = -ENOMEM;
|
|
goto out;
|
|
}
|
|
bio->bi_opf = REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc);
|
|
bio_associate_blkg_from_page(bio, page);
|
|
count_swpout_vm_event(page);
|
|
set_page_writeback(page);
|
|
unlock_page(page);
|
|
submit_bio(bio);
|
|
out:
|
|
return ret;
|
|
}
|
|
|
|
int swap_readpage(struct page *page, bool synchronous)
|
|
{
|
|
struct bio *bio;
|
|
int ret = 0;
|
|
struct swap_info_struct *sis = page_swap_info(page);
|
|
blk_qc_t qc;
|
|
struct gendisk *disk;
|
|
|
|
VM_BUG_ON_PAGE(!PageSwapCache(page) && !synchronous, page);
|
|
VM_BUG_ON_PAGE(!PageLocked(page), page);
|
|
VM_BUG_ON_PAGE(PageUptodate(page), page);
|
|
if (frontswap_load(page) == 0) {
|
|
SetPageUptodate(page);
|
|
unlock_page(page);
|
|
goto out;
|
|
}
|
|
|
|
if (sis->flags & SWP_FS) {
|
|
struct file *swap_file = sis->swap_file;
|
|
struct address_space *mapping = swap_file->f_mapping;
|
|
|
|
ret = mapping->a_ops->readpage(swap_file, page);
|
|
if (!ret)
|
|
count_vm_event(PSWPIN);
|
|
return ret;
|
|
}
|
|
|
|
ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
|
|
if (!ret) {
|
|
if (trylock_page(page)) {
|
|
swap_slot_free_notify(page);
|
|
unlock_page(page);
|
|
}
|
|
|
|
count_vm_event(PSWPIN);
|
|
return 0;
|
|
}
|
|
|
|
ret = 0;
|
|
bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read);
|
|
if (bio == NULL) {
|
|
unlock_page(page);
|
|
ret = -ENOMEM;
|
|
goto out;
|
|
}
|
|
disk = bio->bi_disk;
|
|
/*
|
|
* Keep this task valid during swap readpage because the oom killer may
|
|
* attempt to access it in the page fault retry time check.
|
|
*/
|
|
bio_set_op_attrs(bio, REQ_OP_READ, 0);
|
|
if (synchronous) {
|
|
bio->bi_opf |= REQ_HIPRI;
|
|
get_task_struct(current);
|
|
bio->bi_private = current;
|
|
}
|
|
count_vm_event(PSWPIN);
|
|
bio_get(bio);
|
|
qc = submit_bio(bio);
|
|
while (synchronous) {
|
|
set_current_state(TASK_UNINTERRUPTIBLE);
|
|
if (!READ_ONCE(bio->bi_private))
|
|
break;
|
|
|
|
if (!blk_poll(disk->queue, qc, true))
|
|
io_schedule();
|
|
}
|
|
__set_current_state(TASK_RUNNING);
|
|
bio_put(bio);
|
|
|
|
out:
|
|
return ret;
|
|
}
|
|
|
|
int swap_set_page_dirty(struct page *page)
|
|
{
|
|
struct swap_info_struct *sis = page_swap_info(page);
|
|
|
|
if (sis->flags & SWP_FS) {
|
|
struct address_space *mapping = sis->swap_file->f_mapping;
|
|
|
|
VM_BUG_ON_PAGE(!PageSwapCache(page), page);
|
|
return mapping->a_ops->set_page_dirty(page);
|
|
} else {
|
|
return __set_page_dirty_no_writeback(page);
|
|
}
|
|
}
|