1. 07 Sep, 2017 40 commits
    • Linus Torvalds's avatar
      Merge tag '4.14-smb3-xattr-enable' of git://git.samba.org/sfrench/cifs-2.6 · 8dc5b3a6
      Linus Torvalds authored
      Pull cifs update from Steve French:
       "Enable xattr support for smb3 and also a bugfix"
      
      * tag '4.14-smb3-xattr-enable' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: Check for timeout on Negotiate stage
        cifs: Add support for writing attributes on SMB2+
        cifs: Add support for reading attributes on SMB2+
      8dc5b3a6
    • Linus Torvalds's avatar
      Merge git://git.kvack.org/~bcrl/aio-next · 2500e287
      Linus Torvalds authored
      Pull aio fix from Ben LaHaise:
       "Improve aio-nr counting on large SMP systems.
      
        It has been in linux-next for quite some time"
      
      * git://git.kvack.org/~bcrl/aio-next:
        fs: aio: fix the increment of aio-nr and counting against aio-max-nr
      2500e287
    • Linus Torvalds's avatar
      Merge branch 'quota_scaling' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · ae8ac6b7
      Linus Torvalds authored
      Pull quota scaling updates from Jan Kara:
       "This contains changes to make the quota subsystem more scalable.
      
        Reportedly it improves number of files created per second on ext4
        filesystem on fast storage by about a factor of 2x"
      
      * 'quota_scaling' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: (28 commits)
        quota: Add lock annotations to struct members
        quota: Reduce contention on dq_data_lock
        fs: Provide __inode_get_bytes()
        quota: Inline dquot_[re]claim_reserved_space() into callsite
        quota: Inline inode_{incr,decr}_space() into callsites
        quota: Inline functions into their callsites
        ext4: Disable dirty list tracking of dquots when journalling quotas
        quota: Allow disabling tracking of dirty dquots in a list
        quota: Remove dq_wait_unused from dquot
        quota: Move locking into clear_dquot_dirty()
        quota: Do not dirty bad dquots
        quota: Fix possible corruption of dqi_flags
        quota: Propagate ->quota_read errors from v2_read_file_info()
        quota: Fix error codes in v2_read_file_info()
        quota: Push dqio_sem down to ->read_file_info()
        quota: Push dqio_sem down to ->write_file_info()
        quota: Push dqio_sem down to ->get_next_id()
        quota: Push dqio_sem down to ->release_dqblk()
        quota: Remove locking for writing to the old quota format
        quota: Do not acquire dqio_sem for dquot overwrites in v2 format
        ...
      ae8ac6b7
    • Linus Torvalds's avatar
      Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · 460352c2
      Linus Torvalds authored
      Pull UDF, reiserfs, quota, fsnotify cleanups from Jan Kara:
       "Several UDF, reiserfs, quota and fsnotify cleanups.
      
        Note that there is also a patch updating MAINTAINERS entry for
        notification subsystem to point to me as a maintainer since current
        entries are stale"
      
      * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        fsnotify: make dnotify_fsnotify_ops const
        isofs: Delete an unnecessary variable initialisation in isofs_read_inode()
        isofs: Adjust four checks for null pointers
        isofs: Delete an error message for a failed memory allocation in isofs_read_inode()
        quota_v2: Delete an error message for a failed memory allocation in v2_read_file_info()
        fs-udf: Delete an error message for a failed memory allocation in two functions
        fs-udf: Improve six size determinations
        fs-udf: Adjust two checks for null pointers
        reiserfs: fix spelling mistake: "tranasction" -> "transaction"
        MAINTAINERS: Update entries for notification subsystem
        uapi/linux/quota.h: Do not include linux/errno.h
      460352c2
    • Linus Torvalds's avatar
      Merge tag 'devicetree-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 74fee4e8
      Linus Torvalds authored
      Pull DeviceTree updates from Rob Herring:
       "There's a few orphans in the conversion to %pOF printf specifiers
        included here that no one else picked up.
      
        Summary:
      
         - Convert more DT code to use of_property_read_* API.
      
         - Improve DT overlay support when adding multiple overlays
      
         - Convert printk's to %pOF format specifiers. Most went via subsystem
           trees, but picked up the remaining orphans
      
         - Correct unittests to use preferred "okay" for "status" property
           value
      
         - Add a KASLR seed property
      
         - Vendor prefixes for Mellanox, Theobroma System, Adaptrum, Moxa
      
         - Fix modalias buffer handling
      
         - Clean-up of include paths for building dtbs
      
         - Add bindings for amc6821, isl1208, tsl2x7x, srf02, and srf10
           devices
      
         - Add nvmem bindings for MediaTek MT7623 and MT7622 SoC
      
         - Add compatible string for Allwinner H5 Mali-450 GPU
      
         - Fix links to old OpenFirmware docs with new mirror on
           devicetree.org
      
         - Remove status property from binding doc examples"
      
      * tag 'devicetree-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (45 commits)
        devicetree: Adjust status "ok" -> "okay" under drivers/of/
        dt-bindings: Remove "status" from examples
        dt-bindings: pinctrl: sh-pfc: Use generic node name
        dt-bindings: Add vendor Mellanox
        dt-binding: net/phy: fix interrupts description
        virt: Convert to using %pOF instead of full_name
        macintosh: Convert to using %pOF instead of full_name
        ide: pmac: Convert to using %pOF instead of full_name
        microblaze: Convert to using %pOF instead of full_name
        dt-bindings: usb: musb: Grammar s/the/to/, s/is/are/
        of: Use PLATFORM_DEVID_NONE definition
        of/device: Fix of_device_get_modalias() buffer handling
        of/device: Prevent buffer overflow in of_device_modalias()
        dt-bindings: add amc6821, isl1208 trivial bindings
        dt-bindings: add vendor prefix for Theobroma Systems
        of: search scripts/dtc/include-prefixes path for both CPP and DTC
        of: remove arch/$(SRCARCH)/boot/dts from include search path for CPP
        of: remove drivers/of/testcase-data from include search path for CPP
        of: return of_get_cpu_node from of_cpu_device_node_get if CPUs are not registered
        iio: srf08: add device tree binding for srf02 and srf10
        ...
      74fee4e8
    • Linus Torvalds's avatar
      Merge tag 'drm-intel-next-fixes-2017-09-07' of git://anongit.freedesktop.org/git/drm-intel · 7d955656
      Linus Torvalds authored
      Pull i916 drm fixes from Rodrigo Vivi:
       "Since Dave is on paternity leave we are sending drm/i915 fixes for
        v4.14-rc1 directly to you as he had asked us to do.
      
        The most critical ones are the GPU reset fix for gen2-4 and GVT fix
        for a regression that is blocking gvt init to work on your tree.
      
        The rest is general fixes for patches coming from drm-next"
      Acked-by: default avatarDave Airlie <airlied@redhat.com>
      
      * tag 'drm-intel-next-fixes-2017-09-07' of git://anongit.freedesktop.org/git/drm-intel:
        drm/i915: Re-enable GTT following a device reset
        drm/i915: Annotate user relocs with __user
        drm/i915: Silence sparse by using gfp_t
        drm/i915: Add __rcu to radix tree slot pointer
        drm/i915: Fix the missing PPAT cache attributes on CNL
        drm/i915/gvt: Remove one duplicated MMIO
        drm/i915: Fix enum pipe vs. enum transcoder for the PCH transcoder
        drm/i915: Make i2c lock ops static
        drm/i915: Make i9xx_load_ycbcr_conversion_matrix() static
        drm/i915/edp: Increase T12 panel delay to 900 ms to fix DP AUX CH timeouts
        drm/i915: Ignore duplicate VMA stored within the per-object handle LUT
        drm/i915: Skip fence alignemnt check for the CCS plane
        drm/i915: Treat fb->offsets[] as a raw byte offset instead of a linear offset
        drm/i915: Always wake the device to flush the GTT
        drm/i915: Recreate vmapping even when the object is pinned
        drm/i915: Quietly cancel FBC activation if CRTC is turned off before worker
      7d955656
    • Linus Torvalds's avatar
      Merge tag 'leds_for_4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds · 5f9cc570
      Linus Torvalds authored
      Pull LED updates from Jacek Anaszewski:
       "LED class drivers improvements:
      
        leds-pca955x:
         - add Device Tree support and bindings
         - use devm_led_classdev_register()
         - add GPIO support
         - prevent crippled LED class device name
         - check for I2C errors
      
        leds-gpio:
         - add optional retain-state-shutdown DT property
         - allow LED to retain state at shutdown
      
        leds-tlc591xx:
         - merge conditional tests
         - add missing of_node_put
      
        leds-powernv:
         - delete an error message for a failed memory allocation in
           powernv_led_create()
      
        leds-is31fl32xx.c
         - convert to using custom %pOF printf format specifier
      
        Constify attribute_group structures in:
         - leds-blinkm
         - leds-lm3533
      
        Make several arrays static const in:
         - leds-aat1290
         - leds-lp5521
         - leds-lp5562
         - leds-lp8501"
      
      * tag 'leds_for_4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds:
        leds: pca955x: check for I2C errors
        leds: gpio: Allow LED to retain state at shutdown
        dt-bindings: leds: gpio: Add optional retain-state-shutdown property
        leds: powernv: Delete an error message for a failed memory allocation in powernv_led_create()
        leds: lp8501: make several arrays static const
        leds: lp5562: make several arrays static const
        leds: lp5521: make several arrays static const
        leds: aat1290: make array max_mm_current_percent static const
        leds: pca955x: Prevent crippled LED device name
        leds: lm3533: constify attribute_group structure
        dt-bindings: leds: add pca955x
        leds: pca955x: add GPIO support
        leds: pca955x: use devm_led_classdev_register
        leds: pca955x: add device tree support
        leds: Convert to using %pOF instead of full_name
        leds: blinkm: constify attribute_group structures.
        leds: tlc591xx: add missing of_node_put
        leds: tlc591xx: merge conditional tests
      5f9cc570
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-4.14-rc1' of git://git.infradead.org/users/vkoul/slave-dma · cd7b34fe
      Linus Torvalds authored
      Pull dmaengine updates from Vinod Koul:
       "This one features the usual updates to the drivers and one good part
        of removing DA_SG from core as it has no users.
      
        Summary:
      
         - Remove DMA_SG support as we have no users for this feature
         - New driver for Altera / Intel mSGDMA IP core
         - Support for memset in dmatest and qcom_hidma driver
         - Update for non cyclic mode in k3dma, bunch of update in bam_dma,
           bcm sba-raid
         - Constify device ids across drivers"
      
      * tag 'dmaengine-4.14-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (52 commits)
        dmaengine: sun6i: support V3s SoC variant
        dmaengine: sun6i: make gate bit in sun8i's DMA engines a common quirk
        dmaengine: rcar-dmac: document R8A77970 bindings
        dmaengine: xilinx_dma: Fix error code format specifier
        dmaengine: altera: Use macros instead of structs to describe the registers
        dmaengine: ti-dma-crossbar: Fix dra7 reserve function
        dmaengine: pl330: constify amba_id
        dmaengine: pl08x: constify amba_id
        dmaengine: bcm-sba-raid: Remove redundant SBA_REQUEST_STATE_COMPLETED
        dmaengine: bcm-sba-raid: Explicitly ACK mailbox message after sending
        dmaengine: bcm-sba-raid: Add debugfs support
        dmaengine: bcm-sba-raid: Remove redundant SBA_REQUEST_STATE_RECEIVED
        dmaengine: bcm-sba-raid: Re-factor sba_process_deferred_requests()
        dmaengine: bcm-sba-raid: Pre-ack async tx descriptor
        dmaengine: bcm-sba-raid: Peek mbox when we have no free requests
        dmaengine: bcm-sba-raid: Alloc resources before registering DMA device
        dmaengine: bcm-sba-raid: Improve sba_issue_pending() run duration
        dmaengine: bcm-sba-raid: Increase number of free sba_request
        dmaengine: bcm-sba-raid: Allow arbitrary number free sba_request
        dmaengine: bcm-sba-raid: Remove reqs_free_count from sba_device
        ...
      cd7b34fe
    • Linus Torvalds's avatar
      Merge tag 'backlight-next-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight · 75c72715
      Linus Torvalds authored
      Pull backlight updates from Lee Jones:
       "Fix-ups:
         - Constification; pwm_bl
         - Use new GPIO API; gpio_backlight
         - Remove unused functionality; gpio_backlight
      
        Bug Fixes:
         - Fix artificial MAXREG limit; lm3630a_bl"
      
      * tag 'backlight-next-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight:
        backlight: gpio_backlight: Delete pdata inversion
        backlight: gpio_backlight: Convert to use GPIO descriptor
        backlight: pwm_bl: Make of_device_ids const
        backlight: lm3630a: Bump REG_MAX value to 0x50 instead of 0x1F
      75c72715
    • Linus Torvalds's avatar
      Merge tag 'mfd-next-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd · 968c61f7
      Linus Torvalds authored
      Pull MFD updates from Lee Jones:
       "New Drivers
         - RK805 Power Management IC (PMIC)
         - ROHM BD9571MWV-M MFD Power Management IC (PMIC)
         - Texas Instruments TPS68470 Power Management IC (PMIC) & LEDs
      
        New Device Support:
         - Add support for HiSilicon Hi6421v530 to hi6421-pmic-core
         - Add support for X-Powers AXP806 to axp20x
         - Add support for X-Powers AXP813 to axp20x
         - Add support for Intel Sunrise Point LPSS to intel-lpss-pci
      
        New Functionality:
         - Amend API to provide register layout; atmel-smc
      
        Fix-ups:
         - DT re-work; omap, nokia
         - Header file location change {I2C => MFD}; dm355evm_msp, tps65010
         - Fix chip ID formatting issue(s); rk808
         - Optionally register touchscreen devices; da9052-core
         - Documentation improvements; twl-core
         - Constification; rtsx_pcr, ab8500-core, da9055-i2c, da9052-spi
         - Drop unnecessary static declaration; max8925-i2c
         - Kconfig changes (missing deps and remove module support)
         - Slim down oversized licence statement; hi6421-pmic-core
         - Use managed resources (devm_*); lp87565
         - Supply proper error checking/handling; t7l66xb
      
        Bug Fixes:
         - Fix counter duplication issue; da9052-core
         - Fix potential NULL deference issue; max8998
         - Leave SPI-NOR write-protection bit alone; lpc_ich
         - Ensure device is put into reset during suspend; intel-lpss
         - Correct register offset variable size; omap-usb-tll"
      
      * tag 'mfd-next-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (61 commits)
        mfd: intel_soc_pmic: Differentiate between Bay and Cherry Trail CRC variants
        mfd: intel_soc_pmic: Export separate mfd-cell configs for BYT and CHT
        dt-bindings: mfd: Add bindings for ZII RAVE devices
        mfd: omap-usb-tll: Fix register offsets
        mfd: da9052: Constify spi_device_id
        mfd: intel-lpss: Put I2C and SPI controllers into reset state on suspend
        mfd: da9055: Constify i2c_device_id
        mfd: intel-lpss: Add missing PCI ID for Intel Sunrise Point LPSS devices
        mfd: t7l66xb: Handle return value of clk_prepare_enable
        mfd: Add ROHM BD9571MWV-M PMIC DT bindings
        mfd: intel_soc_pmic_chtwc: Turn Kconfig option into a bool
        mfd: lp87565: Convert to use devm_mfd_add_devices()
        mfd: Add support for TPS68470 device
        mfd: lpc_ich: Do not touch SPI-NOR write protection bit on Haswell/Broadwell
        mfd: syscon: atmel-smc: Add helper to retrieve register layout
        mfd: axp20x: Use correct platform device ID for many PEK
        dt-bindings: mfd: axp20x: Introduce bindings for AXP813
        mfd: axp20x: Add support for AXP813 PMIC
        dt-bindings: mfd: axp20x: Add AXP806 to supported list of chips
        mfd: Add ROHM BD9571MWV-M MFD PMIC driver
        ...
      968c61f7
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 9d71941d
      Linus Torvalds authored
      Pull input updates from Dmitry Torokhov:
      
       - a new GPIO bit-banging driver implementing PS/2 protocol
      
       - a new power key driver for Rockchip RK805 PMIC
      
       - bunch of patches constifying various device ID structures
      
       - Elan I2C touchpad driver now supports devices with 2 buttons
      
       - other assorted fixes
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (76 commits)
        Input: byd - make array seq static, reduces object code size
        Input: xilinx_ps2 - fix multiline comment style
        Input: pxa27x_keypad - handle return value of clk_prepare_enable
        Input: tegra-kbc - handle return value of clk_prepare_enable
        Input: PS/2 gpio bit banging driver for serio bus
        Input: xen-kbdfront - enable auto repeat for xen keyboard frontend driver
        Input: ambakmi - constify amba_id
        Input: atmel_mxt_ts - add support for reset line
        Input: atmel_mxt_ts - use more managed resources
        Input: wacom_w8001 - constify serio_device_id
        Input: tsc40 - constify serio_device_id
        Input: touchwin - constify serio_device_id
        Input: touchright - constify serio_device_id
        Input: touchit213 - constify serio_device_id
        Input: penmount - constify serio_device_id
        Input: mtouch - constify serio_device_id
        Input: inexio - constify serio_device_id
        Input: hampshire - constify serio_device_id
        Input: gunze - constify serio_device_id
        Input: fujitsu_ts - constify serio_device_id
        ...
      9d71941d
    • Linus Torvalds's avatar
      Merge tag 'mailbox-v4.14' of git://git.linaro.org/landing-teams/working/fujitsu/integration · dfd9e6d2
      Linus Torvalds authored
      Pull mailbox updates from Jassi Brar:
       "Just behavorial changes to a controller driver: the Broadcom's Flexrm
        mailbox driver has been modifified to support debugfs and TX-Done
        mechanism by ACK.
      
        Nothing for the core mailbox stack"
      
      * tag 'mailbox-v4.14' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
        mailbox: bcm-flexrm-mailbox: Use txdone_ack instead of txdone_poll
        mailbox: bcm-flexrm-mailbox: Use bitmap instead of IDA
        mailbox: bcm-flexrm-mailbox: Fix mask used in CMPL_START_ADDR_VALUE()
        mailbox: bcm-flexrm-mailbox: Add debugfs support
        mailbox: bcm-flexrm-mailbox: Set IRQ affinity hint for FlexRM ring IRQs
      dfd9e6d2
    • Linus Torvalds's avatar
      Merge tag 'media/v4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · c0da4fa0
      Linus Torvalds authored
      Pull media updates from Mauro Carvalho Chehab:
       "Brazil's Independence Day pull request :-)
      
        This is one of the biggest media pull requests, with 625 patches
        affecting almost all parts of media (RC, DVB, V4L2, CEC, docs).
      
        This contains:
      
         - A lot of new drivers:
           * DVB frontends: mxl5xx, stv0910, stv6111;
           * camera flash: as3645a led driver;
           * HDMI receiver: adv748X;
           * camera sensor: Omnivision 6650 5M driver (ov6650);
           * HDMI CEC: ao-cec meson driver;
           * V4L2: Qualcom camss driver;
           * Remote controller: gpio-ir-tx, pwm-ir-tx and zx-irdec drivers.
      
         - The DDbridge DVB driver got a massive update, with makes it in sync
           with modern hardware from that vendor;
      
         - There's an important milestone on this series: the DVB
           documentation was written in 2003, but only started to be updated
           in 2007. It also used to contain several gaps from the time it was
           kept out of tree, mentioning error codes and device nodes that
           never existed upstream. On this series, it received a massive
           update: all non-deprecated digital TV APIs are now in sync with the
           current implementation;
      
         - Some DVB APIs that aren't used by any upstream driver got removed;
      
         - Other parts of the media documentation algo got updated, fixing
           some bugs on its PDF output and making it compatible with Sphinx
           version 1.6.
      
           As the number of hacks required to build PDF output reduced, I hope
           we'll have less troubles as newer versions of our documentation
           toolchain are released (famous last words);
      
         - As usual, lots of driver cleanups and improvements"
      
      * tag 'media/v4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (624 commits)
        media: leds: as3645a: add V4L2_FLASH_LED_CLASS dependency
        media: get rid of removed DMX_GET_CAPS and DMX_SET_SOURCE leftovers
        media: Revert "[media] v4l: async: make v4l2 coexist with devicetree nodes in a dt overlay"
        media: staging: atomisp: sh_css_calloc shall return a pointer to the allocated space
        media: Revert "[media] lirc_dev: remove superfluous get/put_device() calls"
        media: add qcom_camss.rst to v4l-drivers rst file
        media: dvb headers: make checkpatch happier
        media: dvb uapi: move frontend legacy API to another part of the book
        media: pixfmt-srggb12p.rst: better format the table for PDF output
        media: docs-rst: media: Don't use \small for V4L2_PIX_FMT_SRGGB10 documentation
        media: index.rst: don't write "Contents:" on PDF output
        media: pixfmt*.rst: replace a two dots by a comma
        media: vidioc-g-fmt.rst: adjust table format
        media: vivid.rst: add a blank line to correct ReST format
        media: v4l2 uapi book: get rid of driver programming's chapter
        media: format.rst: use the right markup for important notes
        media: docs-rst: cardlists: change their format to flat-tables
        media: em28xx-cardlist.rst: update to reflect last changes
        media: v4l2-event.rst: adjust table to fit on PDF output
        media: docs: don't show ToC for each part on PDF output
        ...
      c0da4fa0
    • Linus Torvalds's avatar
      Merge tag 'sound-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · d9694430
      Linus Torvalds authored
      Pull sound updates from Takashi Iwai:
       "We have touched quite a lot of files but with fewer changes at this
        cycle; as you can see, most of changes are trivial fixes, especially
        constification patches.
      
        Among the massive attacks by constification gangs, we had a few core
        changes (mostly for ASoC core), as well the fixes and the updates by
        major vendors.
      
        Some highlights:
      
        ALSA core:
      
         - Fix possible races in control API user-TLV codes
      
         - Small cleanup of PCM core
      
        ASoC:
      
         - Continued work for componentization; still half-baked, but we're
           certainly progressing
      
         - Use of devres for jack detection GPIOs, rather as a cleanup
      
         - Jack detection support for Qualcomm MSM8916
      
         - Support for Allwinner H3, Cirrus Logic CS43130, Intel Kabylake
           systems with RT5663, Realtek RT274, TI TLV320AIC32x6 and Wolfson
           WM8523"
      
      * tag 'sound-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (512 commits)
        ALSA: hda/ca0132 - Fix memory leak at error path
        ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe
        ASoC: cs43130: Fix unused compiler warnings for PM runtime
        ASoC: cs43130: Fix possible Oops with invalid dev_id
        ASoC: cs43130: fix spelling mistake: "irq_occurrance" -> "irq_occurrence"
        ALSA: atmel: Remove leftovers of AVR32 removal
        ALSA: atmel: convert AC97c driver to GPIO descriptor API
        ALSA: hda/realtek - Enable jack detection function for Intel ALC700
        ALSA: hda: Fix regression of hdmi eld control created based on invalid pcm
        ASoC: Intel: Skylake: Add IPC to configure the copier secondary pins
        ASoC: add missing compile rule for max98371
        ASoC: add missing compile rule for sirf-audio-codec
        ASoC: add missing compile rule for max98371
        ASoC: cs43130: Add devicetree bindings for CS43130
        ASoC: cs43130: Add support for CS43130 codec
        ASoC: make clock direction configurable in asoc-simple
        ALSA: ctxfi: Remove null check before kfree
        ASoC: max98927: Changed device property read function
        ASoC: max98927: Modified DAPM widget and map to enable/disable VI sense path
        ASoC: max98927: Added PM suspend and resume function
        ...
      d9694430
    • Linus Torvalds's avatar
      Merge tag 'md/4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md · 3645e6d0
      Linus Torvalds authored
      Pull MD updates from Shaohua Li:
       "This update mainly fixes bugs:
      
         - Make raid5 ppl support several ppl from Pawel
      
         - Several raid5-cache bug fixes from Song
      
         - Bitmap fixes from Neil and Me
      
         - One raid1/10 regression fix since 4.12 from Me
      
         - Other small fixes and cleanup"
      
      * tag 'md/4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md:
        md/bitmap: disable bitmap_resize for file-backed bitmaps.
        raid5-ppl: Recovery support for multiple partial parity logs
        md: Runtime support for multiple ppls
        md/raid0: attach correct cgroup info in bio
        lib/raid6: align AVX512 constants to 512 bits, not bytes
        raid5: remove raid5_build_block
        md/r5cache: call mddev_lock/unlock() in r5c_journal_mode_show
        md: replace seq_release_private with seq_release
        md: notify about new spare disk in the container
        md/raid1/10: reset bio allocated from mempool
        md/raid5: release/flush io in raid5_do_work()
        md/bitmap: copy correct data for bitmap super
      3645e6d0
    • Linus Torvalds's avatar
      Merge tag 'mmc-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 15d8ffc9
      Linus Torvalds authored
      Pull MMC updates from Ulf Hansson:
       "MMC core:
         - Continue to refactor the mmc block code to prepare for blkmq
         - Move mmc block debugfs into block module
         - Next step for eMMC CMDQ by adding a new mmc host interface for it
         - Move Kconfig option MMC_DEBUG from core to host
         - Some additional minor improvements
      
        MMC host:
         - Declare structs as const when applicable
         - Explicitly request exclusive reset control when applicable
         - Improve some error paths and other various cleanups
         - sdhci: Preparations to support SDHCI OMAP
         - sdhci: Improve some PM related code
         - sdhci: Re-factoring and modernizations
         - sdhci-xenon: Add runtime PM and system sleep support
         - sdhci-xenon: Add support for eMMC HS400 Enhanced Strobe
         - sdhci-cadence: Add system sleep support
         - sdhci-of-at91: Improve system sleep support
         - dw_mmc: Add support for Hisilicon hi3660
         - sunxi: Add support for A83T eMMC
         - sunxi: Add support for DDR52 mode
         - meson-gx: Add support for UHS-I SD-cards
         - meson-gx: Cleanups and improvements
         - tmio: Fix CMD12 (STOP) handling
         - tmio: Cleanups and improvements
         - renesas_sdhi: Add r8a7743/5 support
         - renesas-sdhi: Add support for R-Car Gen3 SDHI DMAC
         - renesas_sdhi: Cleanups and improvements"
      
      * tag 'mmc-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (145 commits)
        mmc: renesas_sdhi: Add r8a7743/5 support
        mmc: meson-gx: fix __ffsdi2 undefined on arm32
        mmc: sdhci-xenon: add runtime pm support and reimplement standby
        mmc: core: Move mmc_start_areq() declaration
        mmc: mmci: stop building qcom dml as module
        mmc: sunxi: Reset the device at probe time
        clk: sunxi-ng: Provide a default reset hook
        mmc: meson-gx: rework tuning function
        mmc: meson-gx: change default tx phase
        mmc: meson-gx: implement voltage switch callback
        mmc: meson-gx: use CCF to handle the clock phases
        mmc: meson-gx: implement card_busy callback
        mmc: meson-gx: simplify interrupt handler
        mmc: meson-gx: work around clk-stop issue
        mmc: meson-gx: fix dual data rate mode frequencies
        mmc: meson-gx: rework clock init function
        mmc: meson-gx: rework clk_set function
        mmc: meson-gx: rework set_ios function
        mmc: meson-gx: cfg init overwrite values
        mmc: meson-gx: initialize sane clk default before clock register
        ...
      15d8ffc9
    • Linus Torvalds's avatar
      Merge branch 'for-4.14/block' of git://git.kernel.dk/linux-block · a0725ab0
      Linus Torvalds authored
      Pull block layer updates from Jens Axboe:
       "This is the first pull request for 4.14, containing most of the code
        changes. It's a quiet series this round, which I think we needed after
        the churn of the last few series. This contains:
      
         - Fix for a registration race in loop, from Anton Volkov.
      
         - Overflow complaint fix from Arnd for DAC960.
      
         - Series of drbd changes from the usual suspects.
      
         - Conversion of the stec/skd driver to blk-mq. From Bart.
      
         - A few BFQ improvements/fixes from Paolo.
      
         - CFQ improvement from Ritesh, allowing idling for group idle.
      
         - A few fixes found by Dan's smatch, courtesy of Dan.
      
         - A warning fixup for a race between changing the IO scheduler and
           device remova. From David Jeffery.
      
         - A few nbd fixes from Josef.
      
         - Support for cgroup info in blktrace, from Shaohua.
      
         - Also from Shaohua, new features in the null_blk driver to allow it
           to actually hold data, among other things.
      
         - Various corner cases and error handling fixes from Weiping Zhang.
      
         - Improvements to the IO stats tracking for blk-mq from me. Can
           drastically improve performance for fast devices and/or big
           machines.
      
         - Series from Christoph removing bi_bdev as being needed for IO
           submission, in preparation for nvme multipathing code.
      
         - Series from Bart, including various cleanups and fixes for switch
           fall through case complaints"
      
      * 'for-4.14/block' of git://git.kernel.dk/linux-block: (162 commits)
        kernfs: checking for IS_ERR() instead of NULL
        drbd: remove BIOSET_NEED_RESCUER flag from drbd_{md_,}io_bio_set
        drbd: Fix allyesconfig build, fix recent commit
        drbd: switch from kmalloc() to kmalloc_array()
        drbd: abort drbd_start_resync if there is no connection
        drbd: move global variables to drbd namespace and make some static
        drbd: rename "usermode_helper" to "drbd_usermode_helper"
        drbd: fix race between handshake and admin disconnect/down
        drbd: fix potential deadlock when trying to detach during handshake
        drbd: A single dot should be put into a sequence.
        drbd: fix rmmod cleanup, remove _all_ debugfs entries
        drbd: Use setup_timer() instead of init_timer() to simplify the code.
        drbd: fix potential get_ldev/put_ldev refcount imbalance during attach
        drbd: new disk-option disable-write-same
        drbd: Fix resource role for newly created resources in events2
        drbd: mark symbols static where possible
        drbd: Send P_NEG_ACK upon write error in protocol != C
        drbd: add explicit plugging when submitting batches
        drbd: change list_for_each_safe to while(list_first_entry_or_null)
        drbd: introduce drbd_recv_header_maybe_unplug
        ...
      a0725ab0
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.14b-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 3ee31b89
      Linus Torvalds authored
      Pull xen updates from Juergen Gross:
      
       - the new pvcalls backend for routing socket calls from a guest to dom0
      
       - some cleanups of Xen code
      
       - a fix for wrong usage of {get,put}_cpu()
      
      * tag 'for-linus-4.14b-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: (27 commits)
        xen/mmu: set MMU_NORMAL_PT_UPDATE in remap_area_mfn_pte_fn
        xen: Don't try to call xen_alloc_p2m_entry() on autotranslating guests
        xen/events: events_fifo: Don't use {get,put}_cpu() in xen_evtchn_fifo_init()
        xen/pvcalls: use WARN_ON(1) instead of __WARN()
        xen: remove not used trace functions
        xen: remove unused function xen_set_domain_pte()
        xen: remove tests for pvh mode in pure pv paths
        xen-platform: constify pci_device_id.
        xen: cleanup xen.h
        xen: introduce a Kconfig option to enable the pvcalls backend
        xen/pvcalls: implement write
        xen/pvcalls: implement read
        xen/pvcalls: implement the ioworker functions
        xen/pvcalls: disconnect and module_exit
        xen/pvcalls: implement release command
        xen/pvcalls: implement poll command
        xen/pvcalls: implement accept command
        xen/pvcalls: implement listen command
        xen/pvcalls: implement bind command
        xen/pvcalls: implement connect command
        ...
      3ee31b89
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · bac65d9d
      Linus Torvalds authored
      Pull powerpc updates from Michael Ellerman:
       "Nothing really major this release, despite quite a lot of activity.
        Just lots of things all over the place.
      
        Some things of note include:
      
         - Access via perf to a new type of PMU (IMC) on Power9, which can
           count both core events as well as nest unit events (Memory
           controller etc).
      
         - Optimisations to the radix MMU TLB flushing, mostly to avoid
           unnecessary Page Walk Cache (PWC) flushes when the structure of the
           tree is not changing.
      
         - Reworks/cleanups of do_page_fault() to modernise it and bring it
           closer to other architectures where possible.
      
         - Rework of our page table walking so that THP updates only need to
           send IPIs to CPUs where the affected mm has run, rather than all
           CPUs.
      
         - The size of our vmalloc area is increased to 56T on 64-bit hash MMU
           systems. This avoids problems with the percpu allocator on systems
           with very sparse NUMA layouts.
      
         - STRICT_KERNEL_RWX support on PPC32.
      
         - A new sched domain topology for Power9, to capture the fact that
           pairs of cores may share an L2 cache.
      
         - Power9 support for VAS, which is a new mechanism for accessing
           coprocessors, and initial support for using it with the NX
           compression accelerator.
      
         - Major work on the instruction emulation support, adding support for
           many new instructions, and reworking it so it can be used to
           implement the emulation needed to fixup alignment faults.
      
         - Support for guests under PowerVM to use the Power9 XIVE interrupt
           controller.
      
        And probably that many things again that are almost as interesting,
        but I had to keep the list short. Plus the usual fixes and cleanups as
        always.
      
        Thanks to: Alexey Kardashevskiy, Alistair Popple, Andreas Schwab,
        Aneesh Kumar K.V, Anju T Sudhakar, Arvind Yadav, Balbir Singh,
        Benjamin Herrenschmidt, Bhumika Goyal, Breno Leitao, Bryant G. Ly,
        Christophe Leroy, Cédric Le Goater, Dan Carpenter, Dou Liyang,
        Frederic Barrat, Gautham R. Shenoy, Geliang Tang, Geoff Levand, Hannes
        Reinecke, Haren Myneni, Ivan Mikhaylov, John Allen, Julia Lawall,
        LABBE Corentin, Laurentiu Tudor, Madhavan Srinivasan, Markus Elfring,
        Masahiro Yamada, Matt Brown, Michael Neuling, Murilo Opsfelder Araujo,
        Nathan Fontenot, Naveen N. Rao, Nicholas Piggin, Oliver O'Halloran,
        Paul Mackerras, Rashmica Gupta, Rob Herring, Rui Teng, Sam Bobroff,
        Santosh Sivaraj, Scott Wood, Shilpasri G Bhat, Sukadev Bhattiprolu,
        Suraj Jitindar Singh, Tobin C. Harding, Victor Aoqui"
      
      * tag 'powerpc-4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (321 commits)
        powerpc/xive: Fix section __init warning
        powerpc: Fix kernel crash in emulation of vector loads and stores
        powerpc/xive: improve debugging macros
        powerpc/xive: add XIVE Exploitation Mode to CAS
        powerpc/xive: introduce H_INT_ESB hcall
        powerpc/xive: add the HW IRQ number under xive_irq_data
        powerpc/xive: introduce xive_esb_write()
        powerpc/xive: rename xive_poke_esb() in xive_esb_read()
        powerpc/xive: guest exploitation of the XIVE interrupt controller
        powerpc/xive: introduce a common routine xive_queue_page_alloc()
        powerpc/sstep: Avoid used uninitialized error
        axonram: Return directly after a failed kzalloc() in axon_ram_probe()
        axonram: Improve a size determination in axon_ram_probe()
        axonram: Delete an error message for a failed memory allocation in axon_ram_probe()
        powerpc/powernv/npu: Move tlb flush before launching ATSD
        powerpc/macintosh: constify wf_sensor_ops structures
        powerpc/iommu: Use permission-specific DEVICE_ATTR variants
        powerpc/eeh: Delete an error out of memory message at init time
        powerpc/mm: Use seq_putc() in two functions
        macintosh: Convert to using %pOF instead of full_name
        ...
      bac65d9d
    • Linus Torvalds's avatar
      Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f92e3da1
      Linus Torvalds authored
      Pull EFI updates from Ingo Molnar:
       "The main changes in this cycle were:
      
         - Transparently fall back to other poweroff method(s) if EFI poweroff
           fails (and returns)
      
         - Use separate PE/COFF section headers for the RX and RW parts of the
           ARM stub loader so that the firmware can use strict mapping
           permissions
      
         - Add support for requesting the firmware to wipe RAM at warm reboot
      
         - Increase the size of the random seed obtained from UEFI so CRNG
           fast init can complete earlier
      
         - Update the EFI framebuffer address if it points to a BAR that gets
           moved by the PCI resource allocation code
      
         - Enable "reset attack mitigation" of TPM environments: this is
           enabled if the kernel is configured with
           CONFIG_RESET_ATTACK_MITIGATION=y.
      
         - Clang related fixes
      
         - Misc cleanups, constification, refactoring, etc"
      
      * 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi/bgrt: Use efi_mem_type()
        efi: Move efi_mem_type() to common code
        efi/reboot: Make function pointer orig_pm_power_off static
        efi/random: Increase size of firmware supplied randomness
        efi/libstub: Enable reset attack mitigation
        firmware/efi/esrt: Constify attribute_group structures
        firmware/efi: Constify attribute_group structures
        firmware/dcdbas: Constify attribute_group structures
        arm/efi: Split zImage code and data into separate PE/COFF sections
        arm/efi: Replace open coded constants with symbolic ones
        arm/efi: Remove pointless dummy .reloc section
        arm/efi: Remove forbidden values from the PE/COFF header
        drivers/fbdev/efifb: Allow BAR to be moved instead of claiming it
        efi/reboot: Fall back to original power-off method if EFI_RESET_SHUTDOWN returns
        efi/arm/arm64: Add missing assignment of efi.config_table
        efi/libstub/arm64: Set -fpie when building the EFI stub
        efi/libstub/arm64: Force 'hidden' visibility for section markers
        efi/libstub/arm64: Use hidden attribute for struct screen_info reference
        efi/arm: Don't mark ACPI reclaim memory as MEMBLOCK_NOMAP
      f92e3da1
    • Mauricio Faria de Oliveira's avatar
      fs: aio: fix the increment of aio-nr and counting against aio-max-nr · 2a8a9867
      Mauricio Faria de Oliveira authored
      Currently, aio-nr is incremented in steps of 'num_possible_cpus() * 8'
      for io_setup(nr_events, ..) with 'nr_events < num_possible_cpus() * 4':
      
          ioctx_alloc()
          ...
              nr_events = max(nr_events, num_possible_cpus() * 4);
              nr_events *= 2;
          ...
              ctx->max_reqs = nr_events;
          ...
              aio_nr += ctx->max_reqs;
          ....
      
      This limits the number of aio contexts actually available to much less
      than aio-max-nr, and is increasingly worse with greater number of CPUs.
      
      For example, with 64 CPUs, only 256 aio contexts are actually available
      (with aio-max-nr = 65536) because the increment is 512 in that scenario.
      
      Note: 65536 [max aio contexts] / (64*4*2) [increment per aio context]
      is 128, but make it 256 (double) as counting against 'aio-max-nr * 2':
      
          ioctx_alloc()
          ...
              if (aio_nr + nr_events > (aio_max_nr * 2UL) ||
              ...
                  goto err_ctx;
          ...
      
      This patch uses the original value of nr_events (from userspace) to
      increment aio-nr and count against aio-max-nr, which resolves those.
      Signed-off-by: default avatarMauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
      Reported-by: default avatarLekshmi C. Pillai <lekshmi.cpillai@in.ibm.com>
      Tested-by: default avatarLekshmi C. Pillai <lekshmi.cpillai@in.ibm.com>
      Tested-by: default avatarPaul Nguyen <nguyenp@us.ibm.com>
      Reviewed-by: default avatarJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: default avatarBenjamin LaHaise <bcrl@kvack.org>
      2a8a9867
    • Linus Torvalds's avatar
      Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 57e88b43
      Linus Torvalds authored
      Pull x86 platform updates from Ingo Molnar:
       "The main changes include various Hyper-V optimizations such as faster
        hypercalls and faster/better TLB flushes - and there's also some
        Intel-MID cleanups"
      
      * 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        tracing/hyper-v: Trace hyperv_mmu_flush_tlb_others()
        x86/hyper-v: Support extended CPU ranges for TLB flush hypercalls
        x86/platform/intel-mid: Make several arrays static, to make code smaller
        MAINTAINERS: Add missed file for Hyper-V
        x86/hyper-v: Use hypercall for remote TLB flush
        hyper-v: Globalize vp_index
        x86/hyper-v: Implement rep hypercalls
        hyper-v: Use fast hypercall for HVCALL_SIGNAL_EVENT
        x86/hyper-v: Introduce fast hypercall implementation
        x86/hyper-v: Make hv_do_hypercall() inline
        x86/hyper-v: Include hyperv/ only when CONFIG_HYPERV is set
        x86/platform/intel-mid: Make 'bt_sfi_data' const
        x86/platform/intel-mid: Make IRQ allocation a bit more flexible
        x86/platform/intel-mid: Group timers callbacks together
      57e88b43
    • Linus Torvalds's avatar
      Merge branch 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata · 3b9f8ed2
      Linus Torvalds authored
      Pull libata updates from Tejun Heo:
       "Except for the ahci fix that fixes a boot issue, nothing major in this
        pull request. Some new platform controller support and device specific
        changes"
      
      * 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
        libata: zpodd: make arrays cdb static, reduces object code size
        ahci: don't use MSI for devices with the silly Intel NVMe remapping scheme
        dt-bindings: ata: add DT bindings for MediaTek SATA controller
        ata: mediatek: add support for MediaTek SATA controller
        pata_octeon_cf: use of_property_read_{bool|u32}()
        cs5536: add support for IDE controller variant
        ata: sata_gemini: Introduce explicit IDE pin control
        ata: sata_gemini: Retire custom pin control
        ata: ahci_platform: Add shutdown handler
        ata: sata_gemini: explicitly request exclusive reset control
        ata: Drop unnecessary static
        ata: Convert to using %pOF instead of full_name
      3b9f8ed2
    • Linus Torvalds's avatar
      Merge branch 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup · 608c1d3c
      Linus Torvalds authored
      Pull cgroup updates from Tejun Heo:
       "Several notable changes this cycle:
      
         - Thread mode was merged. This will be used for cgroup2 support for
           CPU and possibly other controllers. Unfortunately, CPU controller
           cgroup2 support didn't make this pull request but most contentions
           have been resolved and the support is likely to be merged before
           the next merge window.
      
         - cgroup.stat now shows the number of descendant cgroups.
      
         - cpuset now can enable the easier-to-configure v2 behavior on v1
           hierarchy"
      
      * 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (21 commits)
        cpuset: Allow v2 behavior in v1 cgroup
        cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup
        cgroup: remove unneeded checks
        cgroup: misc changes
        cgroup: short-circuit cset_cgroup_from_root() on the default hierarchy
        cgroup: re-use the parent pointer in cgroup_destroy_locked()
        cgroup: add cgroup.stat interface with basic hierarchy stats
        cgroup: implement hierarchy limits
        cgroup: keep track of number of descent cgroups
        cgroup: add comment to cgroup_enable_threaded()
        cgroup: remove unnecessary empty check when enabling threaded mode
        cgroup: update debug controller to print out thread mode information
        cgroup: implement cgroup v2 thread support
        cgroup: implement CSS_TASK_ITER_THREADED
        cgroup: introduce cgroup->dom_cgrp and threaded css_set handling
        cgroup: add @flags to css_task_iter_start() and implement CSS_TASK_ITER_PROCS
        cgroup: reorganize cgroup.procs / task write path
        cgroup: replace css_set walking populated test with testing cgrp->nr_populated_csets
        cgroup: distinguish local and children populated states
        cgroup: remove now unused list_head @pending in cgroup_apply_cftypes()
        ...
      608c1d3c
    • Linus Torvalds's avatar
      Merge branch 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq · 9954d489
      Linus Torvalds authored
      Pull workqueue updates from Tejun Heo:
       "Nothing major. I introduced a flag collsion bug during v4.13 cycle
        which is fixed in this pull request. Fortunately, the flag is for
        debugging / verification and the bug isn't critical"
      
      * 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
        workqueue: Fix flag collision
        workqueue: Use TASK_IDLE
        workqueue: fix path to documentation
        workqueue: doc change for ST behavior on NUMA systems
      9954d489
    • Linus Torvalds's avatar
      Merge branch 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu · a7cbfd05
      Linus Torvalds authored
      Pull percpu updates from Tejun Heo:
       "A lot of changes for percpu this time around. percpu inherited the
        same area allocator from the original pre-virtual-address-mapped
        implementation. This was from the time when percpu allocator wasn't
        used all that much and the implementation was focused on simplicity,
        with the unfortunate computational complexity of O(number of areas
        allocated from the chunk) per alloc / free.
      
        With the increase in percpu usage, we're hitting cases where the lack
        of scalability is hurting. The most prominent one right now is bpf
        perpcu map creation / destruction which may allocate and free a lot of
        entries consecutively and it's likely that the problem will become
        more prominent in the future.
      
        To address the issue, Dennis replaced the area allocator with hinted
        bitmap allocator which is more consistent. While the new allocator
        does perform a bit worse in some cases, it outperforms the old
        allocator way more than an order of magnitude in other more common
        scenarios while staying mostly flat in CPU overhead and completely
        flat in memory consumption"
      
      * 'for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: (27 commits)
        percpu: update header to contain bitmap allocator explanation.
        percpu: update pcpu_find_block_fit to use an iterator
        percpu: use metadata blocks to update the chunk contig hint
        percpu: update free path to take advantage of contig hints
        percpu: update alloc path to only scan if contig hints are broken
        percpu: keep track of the best offset for contig hints
        percpu: skip chunks if the alloc does not fit in the contig hint
        percpu: add first_bit to keep track of the first free in the bitmap
        percpu: introduce bitmap metadata blocks
        percpu: replace area map allocator with bitmap
        percpu: generalize bitmap (un)populated iterators
        percpu: increase minimum percpu allocation size and align first regions
        percpu: introduce nr_empty_pop_pages to help empty page accounting
        percpu: change the number of pages marked in the first_chunk pop bitmap
        percpu: combine percpu address checks
        percpu: modify base_addr to be region specific
        percpu: setup_first_chunk rename schunk/dchunk to chunk
        percpu: end chunk area maps page aligned for the populated bitmap
        percpu: unify allocation of schunk and dchunk
        percpu: setup_first_chunk remove dyn_size and consolidate logic
        ...
      a7cbfd05
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · d34fc1ad
      Linus Torvalds authored
      Merge updates from Andrew Morton:
      
       - various misc bits
      
       - DAX updates
      
       - OCFS2
      
       - most of MM
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (119 commits)
        mm,fork: introduce MADV_WIPEONFORK
        x86,mpx: make mpx depend on x86-64 to free up VMA flag
        mm: add /proc/pid/smaps_rollup
        mm: hugetlb: clear target sub-page last when clearing huge page
        mm: oom: let oom_reap_task and exit_mmap run concurrently
        swap: choose swap device according to numa node
        mm: replace TIF_MEMDIE checks by tsk_is_oom_victim
        mm, oom: do not rely on TIF_MEMDIE for memory reserves access
        z3fold: use per-cpu unbuddied lists
        mm, swap: don't use VMA based swap readahead if HDD is used as swap
        mm, swap: add sysfs interface for VMA based swap readahead
        mm, swap: VMA based swap readahead
        mm, swap: fix swap readahead marking
        mm, swap: add swap readahead hit statistics
        mm/vmalloc.c: don't reinvent the wheel but use existing llist API
        mm/vmstat.c: fix wrong comment
        selftests/memfd: add memfd_create hugetlbfs selftest
        mm/shmem: add hugetlbfs support to memfd_create()
        mm, devm_memremap_pages: use multi-order radix for ZONE_DEVICE lookups
        mm/vmalloc.c: halve the number of comparisons performed in pcpu_get_vm_areas()
        ...
      d34fc1ad
    • Andy Lutomirski's avatar
      x86/mm: Document how CR4.PCIDE restore works · 1c9fe440
      Andy Lutomirski authored
      While debugging a problem, I thought that using
      cr4_set_bits_and_update_boot() to restore CR4.PCIDE would be
      helpful.  It turns out to be counterproductive.
      
      Add a comment documenting how this works.
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1c9fe440
    • Andy Lutomirski's avatar
      x86/mm: Reinitialize TLB state on hotplug and resume · 72c0098d
      Andy Lutomirski authored
      When Linux brings a CPU down and back up, it switches to init_mm and then
      loads swapper_pg_dir into CR3.  With PCID enabled, this has the side effect
      of masking off the ASID bits in CR3.
      
      This can result in some confusion in the TLB handling code.  If we
      bring a CPU down and back up with any ASID other than 0, we end up
      with the wrong ASID active on the CPU after resume.  This could
      cause our internal state to become corrupt, although major
      corruption is unlikely because init_mm doesn't have any user pages.
      More obviously, if CONFIG_DEBUG_VM=y, we'll trip over an assertion
      in the next context switch.  The result of *that* is a failure to
      resume from suspend with probability 1 - 1/6^(cpus-1).
      
      Fix it by reinitializing cpu_tlbstate on resume and CPU bringup.
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Reported-by: default avatarJiri Kosina <jikos@kernel.org>
      Fixes: 10af6235 ("x86/mm: Implement PCID based optimization: try to preserve old TLB entries using PCID")
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      72c0098d
    • Rik van Riel's avatar
      mm,fork: introduce MADV_WIPEONFORK · d2cd9ede
      Rik van Riel authored
      Introduce MADV_WIPEONFORK semantics, which result in a VMA being empty
      in the child process after fork.  This differs from MADV_DONTFORK in one
      important way.
      
      If a child process accesses memory that was MADV_WIPEONFORK, it will get
      zeroes.  The address ranges are still valid, they are just empty.
      
      If a child process accesses memory that was MADV_DONTFORK, it will get a
      segmentation fault, since those address ranges are no longer valid in
      the child after fork.
      
      Since MADV_DONTFORK also seems to be used to allow very large programs
      to fork in systems with strict memory overcommit restrictions, changing
      the semantics of MADV_DONTFORK might break existing programs.
      
      MADV_WIPEONFORK only works on private, anonymous VMAs.
      
      The use case is libraries that store or cache information, and want to
      know that they need to regenerate it in the child process after fork.
      
      Examples of this would be:
       - systemd/pulseaudio API checks (fail after fork) (replacing a getpid
         check, which is too slow without a PID cache)
       - PKCS#11 API reinitialization check (mandated by specification)
       - glibc's upcoming PRNG (reseed after fork)
       - OpenSSL PRNG (reseed after fork)
      
      The security benefits of a forking server having a re-inialized PRNG in
      every child process are pretty obvious.  However, due to libraries
      having all kinds of internal state, and programs getting compiled with
      many different versions of each library, it is unreasonable to expect
      calling programs to re-initialize everything manually after fork.
      
      A further complication is the proliferation of clone flags, programs
      bypassing glibc's functions to call clone directly, and programs calling
      unshare, causing the glibc pthread_atfork hook to not get called.
      
      It would be better to have the kernel take care of this automatically.
      
      The patch also adds MADV_KEEPONFORK, to undo the effects of a prior
      MADV_WIPEONFORK.
      
      This is similar to the OpenBSD minherit syscall with MAP_INHERIT_ZERO:
      
          https://man.openbsd.org/minherit.2
      
      [akpm@linux-foundation.org: numerically order arch/parisc/include/uapi/asm/mman.h #defines]
      Link: http://lkml.kernel.org/r/20170811212829.29186-3-riel@redhat.comSigned-off-by: default avatarRik van Riel <riel@redhat.com>
      Reported-by: default avatarFlorian Weimer <fweimer@redhat.com>
      Reported-by: default avatarColm MacCártaigh <colm@allcosts.net>
      Reviewed-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Cc: <linux-api@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d2cd9ede
    • Rik van Riel's avatar
      x86,mpx: make mpx depend on x86-64 to free up VMA flag · df3735c5
      Rik van Riel authored
      Patch series "mm,fork,security: introduce MADV_WIPEONFORK", v4.
      
      If a child process accesses memory that was MADV_WIPEONFORK, it will get
      zeroes.  The address ranges are still valid, they are just empty.
      
      If a child process accesses memory that was MADV_DONTFORK, it will get a
      segmentation fault, since those address ranges are no longer valid in
      the child after fork.
      
      Since MADV_DONTFORK also seems to be used to allow very large programs
      to fork in systems with strict memory overcommit restrictions, changing
      the semantics of MADV_DONTFORK might break existing programs.
      
      The use case is libraries that store or cache information, and want to
      know that they need to regenerate it in the child process after fork.
      
      Examples of this would be:
       - systemd/pulseaudio API checks (fail after fork) (replacing a getpid
         check, which is too slow without a PID cache)
       - PKCS#11 API reinitialization check (mandated by specification)
       - glibc's upcoming PRNG (reseed after fork)
       - OpenSSL PRNG (reseed after fork)
      
      The security benefits of a forking server having a re-inialized PRNG in
      every child process are pretty obvious.  However, due to libraries
      having all kinds of internal state, and programs getting compiled with
      many different versions of each library, it is unreasonable to expect
      calling programs to re-initialize everything manually after fork.
      
      A further complication is the proliferation of clone flags, programs
      bypassing glibc's functions to call clone directly, and programs calling
      unshare, causing the glibc pthread_atfork hook to not get called.
      
      It would be better to have the kernel take care of this automatically.
      
      The patchset also adds MADV_KEEPONFORK, to undo the effects of a prior
      MADV_WIPEONFORK.
      
      This is similar to the OpenBSD minherit syscall with MAP_INHERIT_ZERO:
      
          https://man.openbsd.org/minherit.2
      
      This patch (of 2):
      
      MPX only seems to be available on 64 bit CPUs, starting with Skylake and
      Goldmont.  Move VM_MPX into the 64 bit only portion of vma->vm_flags, in
      order to free up a VMA flag.
      
      Link: http://lkml.kernel.org/r/20170811212829.29186-2-riel@redhat.comSigned-off-by: default avatarRik van Riel <riel@redhat.com>
      Acked-by: default avatarDave Hansen <dave.hansen@intel.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Florian Weimer <fweimer@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Colm MacCártaigh <colm@allcosts.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      df3735c5
    • Daniel Colascione's avatar
      mm: add /proc/pid/smaps_rollup · 493b0e9d
      Daniel Colascione authored
      /proc/pid/smaps_rollup is a new proc file that improves the performance
      of user programs that determine aggregate memory statistics (e.g., total
      PSS) of a process.
      
      Android regularly "samples" the memory usage of various processes in
      order to balance its memory pool sizes.  This sampling process involves
      opening /proc/pid/smaps and summing certain fields.  For very large
      processes, sampling memory use this way can take several hundred
      milliseconds, due mostly to the overhead of the seq_printf calls in
      task_mmu.c.
      
      smaps_rollup improves the situation.  It contains most of the fields of
      /proc/pid/smaps, but instead of a set of fields for each VMA,
      smaps_rollup instead contains one synthetic smaps-format entry
      representing the whole process.  In the single smaps_rollup synthetic
      entry, each field is the summation of the corresponding field in all of
      the real-smaps VMAs.  Using a common format for smaps_rollup and smaps
      allows userspace parsers to repurpose parsers meant for use with
      non-rollup smaps for smaps_rollup, and it allows userspace to switch
      between smaps_rollup and smaps at runtime (say, based on the
      availability of smaps_rollup in a given kernel) with minimal fuss.
      
      By using smaps_rollup instead of smaps, a caller can avoid the
      significant overhead of formatting, reading, and parsing each of a large
      process's potentially very numerous memory mappings.  For sampling
      system_server's PSS in Android, we measured a 12x speedup, representing
      a savings of several hundred milliseconds.
      
      One alternative to a new per-process proc file would have been including
      PSS information in /proc/pid/status.  We considered this option but
      thought that PSS would be too expensive (by a few orders of magnitude)
      to collect relative to what's already emitted as part of
      /proc/pid/status, and slowing every user of /proc/pid/status for the
      sake of readers that happen to want PSS feels wrong.
      
      The code itself works by reusing the existing VMA-walking framework we
      use for regular smaps generation and keeping the mem_size_stats
      structure around between VMA walks instead of using a fresh one for each
      VMA.  In this way, summation happens automatically.  We let seq_file
      walk over the VMAs just as it does for regular smaps and just emit
      nothing to the seq_file until we hit the last VMA.
      
      Benchmarks:
      
          using smaps:
          iterations:1000 pid:1163 pss:220023808
          0m29.46s real 0m08.28s user 0m20.98s system
      
          using smaps_rollup:
          iterations:1000 pid:1163 pss:220702720
          0m04.39s real 0m00.03s user 0m04.31s system
      
      We're using the PSS samples we collect asynchronously for
      system-management tasks like fine-tuning oom_adj_score, memory use
      tracking for debugging, application-level memory-use attribution, and
      deciding whether we want to kill large processes during system idle
      maintenance windows.  Android has been using PSS for these purposes for
      a long time; as the average process VMA count has increased and and
      devices become more efficiency-conscious, PSS-collection inefficiency
      has started to matter more.  IMHO, it'd be a lot safer to optimize the
      existing PSS-collection model, which has been fine-tuned over the years,
      instead of changing the memory tracking approach entirely to work around
      smaps-generation inefficiency.
      
      Tim said:
      
      : There are two main reasons why Android gathers PSS information:
      :
      : 1. Android devices can show the user the amount of memory used per
      :    application via the settings app.  This is a less important use case.
      :
      : 2. We log PSS to help identify leaks in applications.  We have found
      :    an enormous number of bugs (in the Android platform, in Google's own
      :    apps, and in third-party applications) using this data.
      :
      : To do this, system_server (the main process in Android userspace) will
      : sample the PSS of a process three seconds after it changes state (for
      : example, app is launched and becomes the foreground application) and about
      : every ten minutes after that.  The net result is that PSS collection is
      : regularly running on at least one process in the system (usually a few
      : times a minute while the screen is on, less when screen is off due to
      : suspend).  PSS of a process is an incredibly useful stat to track, and we
      : aren't going to get rid of it.  We've looked at some very hacky approaches
      : using RSS ("take the RSS of the target process, subtract the RSS of the
      : zygote process that is the parent of all Android apps") to reduce the
      : accounting time, but it regularly overestimated the memory used by 20+
      : percent.  Accordingly, I don't think that there's a good alternative to
      : using PSS.
      :
      : We started looking into PSS collection performance after we noticed random
      : frequency spikes while a phone's screen was off; occasionally, one of the
      : CPU clusters would ramp to a high frequency because there was 200-300ms of
      : constant CPU work from a single thread in the main Android userspace
      : process.  The work causing the spike (which is reasonable governor
      : behavior given the amount of CPU time needed) was always PSS collection.
      : As a result, Android is burning more power than we should be on PSS
      : collection.
      :
      : The other issue (and why I'm less sure about improving smaps as a
      : long-term solution) is that the number of VMAs per process has increased
      : significantly from release to release.  After trying to figure out why we
      : were seeing these 200-300ms PSS collection times on Android O but had not
      : noticed it in previous versions, we found that the number of VMAs in the
      : main system process increased by 50% from Android N to Android O (from
      : ~1800 to ~2700) and varying increases in every userspace process.  Android
      : M to N also had an increase in the number of VMAs, although not as much.
      : I'm not sure why this is increasing so much over time, but thinking about
      : ASLR and ways to make ASLR better, I expect that this will continue to
      : increase going forward.  I would not be surprised if we hit 5000 VMAs on
      : the main Android process (system_server) by 2020.
      :
      : If we assume that the number of VMAs is going to increase over time, then
      : doing anything we can do to reduce the overhead of each VMA during PSS
      : collection seems like the right way to go, and that means outputting an
      : aggregate statistic (to avoid whatever overhead there is per line in
      : writing smaps and in reading each line from userspace).
      
      Link: http://lkml.kernel.org/r/20170812022148.178293-1-dancol@google.comSigned-off-by: default avatarDaniel Colascione <dancol@google.com>
      Cc: Tim Murray <timmurray@google.com>
      Cc: Joel Fernandes <joelaf@google.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Sonny Rao <sonnyrao@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      493b0e9d
    • Huang Ying's avatar
      mm: hugetlb: clear target sub-page last when clearing huge page · c79b57e4
      Huang Ying authored
      Huge page helps to reduce TLB miss rate, but it has higher cache
      footprint, sometimes this may cause some issue.  For example, when
      clearing huge page on x86_64 platform, the cache footprint is 2M.  But
      on a Xeon E5 v3 2699 CPU, there are 18 cores, 36 threads, and only 45M
      LLC (last level cache).  That is, in average, there are 2.5M LLC for
      each core and 1.25M LLC for each thread.
      
      If the cache pressure is heavy when clearing the huge page, and we clear
      the huge page from the begin to the end, it is possible that the begin
      of huge page is evicted from the cache after we finishing clearing the
      end of the huge page.  And it is possible for the application to access
      the begin of the huge page after clearing the huge page.
      
      To help the above situation, in this patch, when we clear a huge page,
      the order to clear sub-pages is changed.  In quite some situation, we
      can get the address that the application will access after we clear the
      huge page, for example, in a page fault handler.  Instead of clearing
      the huge page from begin to end, we will clear the sub-pages farthest
      from the the sub-page to access firstly, and clear the sub-page to
      access last.  This will make the sub-page to access most cache-hot and
      sub-pages around it more cache-hot too.  If we cannot know the address
      the application will access, the begin of the huge page is assumed to be
      the the address the application will access.
      
      With this patch, the throughput increases ~28.3% in vm-scalability
      anon-w-seq test case with 72 processes on a 2 socket Xeon E5 v3 2699
      system (36 cores, 72 threads).  The test case creates 72 processes, each
      process mmap a big anonymous memory area and writes to it from the begin
      to the end.  For each process, other processes could be seen as other
      workload which generates heavy cache pressure.  At the same time, the
      cache miss rate reduced from ~33.4% to ~31.7%, the IPC (instruction per
      cycle) increased from 0.56 to 0.74, and the time spent in user space is
      reduced ~7.9%
      
      Christopher Lameter suggests to clear bytes inside a sub-page from end
      to begin too.  But tests show no visible performance difference in the
      tests.  May because the size of page is small compared with the cache
      size.
      
      Thanks Andi Kleen to propose to use address to access to determine the
      order of sub-pages to clear.
      
      The hugetlbfs access address could be improved, will do that in another
      patch.
      
      [ying.huang@intel.com: improve readability of clear_huge_page()]
        Link: http://lkml.kernel.org/r/20170830051842.1397-1-ying.huang@intel.com
      Link: http://lkml.kernel.org/r/20170815014618.15842-1-ying.huang@intel.comSuggested-by: default avatarAndi Kleen <andi.kleen@intel.com>
      Signed-off-by: default avatar"Huang, Ying" <ying.huang@intel.com>
      Acked-by: default avatarJan Kara <jack@suse.cz>
      Reviewed-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Nadia Yvette Chambers <nyc@holomorphy.com>
      Cc: Matthew Wilcox <mawilcox@microsoft.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shaohua Li <shli@fb.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c79b57e4
    • Andrea Arcangeli's avatar
      mm: oom: let oom_reap_task and exit_mmap run concurrently · 21292580
      Andrea Arcangeli authored
      This is purely required because exit_aio() may block and exit_mmap() may
      never start, if the oom_reap_task cannot start running on a mm with
      mm_users == 0.
      
      At the same time if the OOM reaper doesn't wait at all for the memory of
      the current OOM candidate to be freed by exit_mmap->unmap_vmas, it would
      generate a spurious OOM kill.
      
      If it wasn't because of the exit_aio or similar blocking functions in
      the last mmput, it would be enough to change the oom_reap_task() in the
      case it finds mm_users == 0, to wait for a timeout or to wait for
      __mmput to set MMF_OOM_SKIP itself, but it's not just exit_mmap the
      problem here so the concurrency of exit_mmap and oom_reap_task is
      apparently warranted.
      
      It's a non standard runtime, exit_mmap() runs without mmap_sem, and
      oom_reap_task runs with the mmap_sem for reading as usual (kind of
      MADV_DONTNEED).
      
      The race between the two is solved with a combination of
      tsk_is_oom_victim() (serialized by task_lock) and MMF_OOM_SKIP
      (serialized by a dummy down_write/up_write cycle on the same lines of
      the ksm_exit method).
      
      If the oom_reap_task() may be running concurrently during exit_mmap,
      exit_mmap will wait it to finish in down_write (before taking down mm
      structures that would make the oom_reap_task fail with use after free).
      
      If exit_mmap comes first, oom_reap_task() will skip the mm if
      MMF_OOM_SKIP is already set and in turn all memory is already freed and
      furthermore the mm data structures may already have been taken down by
      free_pgtables.
      
      [aarcange@redhat.com: incremental one liner]
        Link: http://lkml.kernel.org/r/20170726164319.GC29716@redhat.com
      [rientjes@google.com: remove unused mmput_async]
        Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1708141733130.50317@chino.kir.corp.google.com
      [aarcange@redhat.com: microoptimization]
        Link: http://lkml.kernel.org/r/20170817171240.GB5066@redhat.com
      Link: http://lkml.kernel.org/r/20170726162912.GA29716@redhat.com
      Fixes: 26db62f1 ("oom: keep mm of the killed task available")
      Signed-off-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
      Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
      Reported-by: default avatarDavid Rientjes <rientjes@google.com>
      Tested-by: default avatarDavid Rientjes <rientjes@google.com>
      Reviewed-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      21292580
    • Aaron Lu's avatar
      swap: choose swap device according to numa node · a2468cc9
      Aaron Lu authored
      If the system has more than one swap device and swap device has the node
      information, we can make use of this information to decide which swap
      device to use in get_swap_pages() to get better performance.
      
      The current code uses a priority based list, swap_avail_list, to decide
      which swap device to use and if multiple swap devices share the same
      priority, they are used round robin.  This patch changes the previous
      single global swap_avail_list into a per-numa-node list, i.e.  for each
      numa node, it sees its own priority based list of available swap
      devices.  Swap device's priority can be promoted on its matching node's
      swap_avail_list.
      
      The current swap device's priority is set as: user can set a >=0 value,
      or the system will pick one starting from -1 then downwards.  The
      priority value in the swap_avail_list is the negated value of the swap
      device's due to plist being sorted from low to high.  The new policy
      doesn't change the semantics for priority >=0 cases, the previous
      starting from -1 then downwards now becomes starting from -2 then
      downwards and -1 is reserved as the promoted value.
      
      Take 4-node EX machine as an example, suppose 4 swap devices are
      available, each sit on a different node:
      swapA on node 0
      swapB on node 1
      swapC on node 2
      swapD on node 3
      
      After they are all swapped on in the sequence of ABCD.
      
      Current behaviour:
      their priorities will be:
      swapA: -1
      swapB: -2
      swapC: -3
      swapD: -4
      And their position in the global swap_avail_list will be:
      swapA   -> swapB   -> swapC   -> swapD
      prio:1     prio:2     prio:3     prio:4
      
      New behaviour:
      their priorities will be(note that -1 is skipped):
      swapA: -2
      swapB: -3
      swapC: -4
      swapD: -5
      And their positions in the 4 swap_avail_lists[nid] will be:
      swap_avail_lists[0]: /* node 0's available swap device list */
      swapA   -> swapB   -> swapC   -> swapD
      prio:1     prio:3     prio:4     prio:5
      swap_avali_lists[1]: /* node 1's available swap device list */
      swapB   -> swapA   -> swapC   -> swapD
      prio:1     prio:2     prio:4     prio:5
      swap_avail_lists[2]: /* node 2's available swap device list */
      swapC   -> swapA   -> swapB   -> swapD
      prio:1     prio:2     prio:3     prio:5
      swap_avail_lists[3]: /* node 3's available swap device list */
      swapD   -> swapA   -> swapB   -> swapC
      prio:1     prio:2     prio:3     prio:4
      
      To see the effect of the patch, a test that starts N process, each mmap
      a region of anonymous memory and then continually write to it at random
      position to trigger both swap in and out is used.
      
      On a 2 node Skylake EP machine with 64GiB memory, two 170GB SSD drives
      are used as swap devices with each attached to a different node, the
      result is:
      
      runtime=30m/processes=32/total test size=128G/each process mmap region=4G
      kernel         throughput
      vanilla        13306
      auto-binding   15169 +14%
      
      runtime=30m/processes=64/total test size=128G/each process mmap region=2G
      kernel         throughput
      vanilla        11885
      auto-binding   14879 +25%
      
      [aaron.lu@intel.com: v2]
        Link: http://lkml.kernel.org/r/20170814053130.GD2369@aaronlu.sh.intel.com
        Link: http://lkml.kernel.org/r/20170816024439.GA10925@aaronlu.sh.intel.com
      [akpm@linux-foundation.org: use kmalloc_array()]
      Link: http://lkml.kernel.org/r/20170814053130.GD2369@aaronlu.sh.intel.com
      Link: http://lkml.kernel.org/r/20170816024439.GA10925@aaronlu.sh.intel.comSigned-off-by: default avatarAaron Lu <aaron.lu@intel.com>
      Cc: "Chen, Tim C" <tim.c.chen@intel.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Hugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a2468cc9
    • Michal Hocko's avatar
      mm: replace TIF_MEMDIE checks by tsk_is_oom_victim · da99ecf1
      Michal Hocko authored
      TIF_MEMDIE is set only to the tasks whick were either directly selected
      by the OOM killer or passed through mark_oom_victim from the allocator
      path.  tsk_is_oom_victim is more generic and allows to identify all
      tasks (threads) which share the mm with the oom victim.
      
      Please note that the freezer still needs to check TIF_MEMDIE because we
      cannot thaw tasks which do not participage in oom_victims counting
      otherwise a !TIF_MEMDIE task could interfere after oom_disbale returns.
      
      Link: http://lkml.kernel.org/r/20170810075019.28998-3-mhocko@kernel.orgSigned-off-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Roman Gushchin <guro@fb.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      da99ecf1
    • Michal Hocko's avatar
      mm, oom: do not rely on TIF_MEMDIE for memory reserves access · cd04ae1e
      Michal Hocko authored
      For ages we have been relying on TIF_MEMDIE thread flag to mark OOM
      victims and then, among other things, to give these threads full access
      to memory reserves.  There are few shortcomings of this implementation,
      though.
      
      First of all and the most serious one is that the full access to memory
      reserves is quite dangerous because we leave no safety room for the
      system to operate and potentially do last emergency steps to move on.
      
      Secondly this flag is per task_struct while the OOM killer operates on
      mm_struct granularity so all processes sharing the given mm are killed.
      Giving the full access to all these task_structs could lead to a quick
      memory reserves depletion.  We have tried to reduce this risk by giving
      TIF_MEMDIE only to the main thread and the currently allocating task but
      that doesn't really solve this problem while it surely opens up a room
      for corner cases - e.g.  GFP_NO{FS,IO} requests might loop inside the
      allocator without access to memory reserves because a particular thread
      was not the group leader.
      
      Now that we have the oom reaper and that all oom victims are reapable
      after 1b51e65e ("oom, oom_reaper: allow to reap mm shared by the
      kthreads") we can be more conservative and grant only partial access to
      memory reserves because there are reasonable chances of the parallel
      memory freeing.  We still want some access to reserves because we do not
      want other consumers to eat up the victim's freed memory.  oom victims
      will still contend with __GFP_HIGH users but those shouldn't be so
      aggressive to starve oom victims completely.
      
      Introduce ALLOC_OOM flag and give all tsk_is_oom_victim tasks access to
      the half of the reserves.  This makes the access to reserves independent
      on which task has passed through mark_oom_victim.  Also drop any usage
      of TIF_MEMDIE from the page allocator proper and replace it by
      tsk_is_oom_victim as well which will make page_alloc.c completely
      TIF_MEMDIE free finally.
      
      CONFIG_MMU=n doesn't have oom reaper so let's stick to the original
      ALLOC_NO_WATERMARKS approach.
      
      There is a demand to make the oom killer memcg aware which will imply
      many tasks killed at once.  This change will allow such a usecase
      without worrying about complete memory reserves depletion.
      
      Link: http://lkml.kernel.org/r/20170810075019.28998-2-mhocko@kernel.orgSigned-off-by: default avatarMichal Hocko <mhocko@suse.com>
      Acked-by: default avatarMel Gorman <mgorman@techsingularity.net>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Roman Gushchin <guro@fb.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cd04ae1e
    • Vitaly Wool's avatar
      z3fold: use per-cpu unbuddied lists · d30561c5
      Vitaly Wool authored
      It's been noted that z3fold doesn't scale well when it's run in a large
      number of threads on many cores, which can be easily reproduced with fio
      'randrw' test with --numjobs=32.  E.g.  the result for 1 cluster (4 cores)
      is:
      
      Run status group 0 (all jobs):
         READ: io=244785MB, aggrb=496883KB/s, minb=15527KB/s, ...
        WRITE: io=246735MB, aggrb=500841KB/s, minb=15651KB/s, ...
      
      While for 8 cores (2 clusters) the result is:
      
      Run status group 0 (all jobs):
         READ: io=244785MB, aggrb=265942KB/s, minb=8310KB/s, ...
        WRITE: io=246735MB, aggrb=268060KB/s, minb=8376KB/s, ...
      
      The bottleneck here is the pool lock which many threads become waiting
      upon.  To reduce that spin lock contention, z3fold can operate only on
      the lists local to the current CPU whenever possible.  Due to the nature
      of z3fold unbuddied list handling (it only takes the first entry off the
      list on a hot path), if the z3fold pool is big enough and balanced well
      enough, limiting search to only local unbuddied list doesn't lead to a
      significant compression ratio degrade (2.57x vs 2.65x in our
      measurements).
      
      This patch also introduces two worker threads: one for async in-page
      object layout optimization and one for releasing freed pages.  This is
      done to speed up z3fold_free() which is often on a hot path.
      
      The fio results for 8-core case are now the following:
      
      Run status group 0 (all jobs):
         READ: io=244785MB, aggrb=1568.3MB/s, minb=50182KB/s, ...
        WRITE: io=246735MB, aggrb=1580.8MB/s, minb=50582KB/s, ...
      
      So we're in for almost 6x performance increase.
      
      Link: http://lkml.kernel.org/r/20170806181443.f9b65018f8bde25ef990f9e8@gmail.comSigned-off-by: default avatarVitaly Wool <vitalywool@gmail.com>
      Cc: Dan Streetman <ddstreet@ieee.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d30561c5
    • Huang Ying's avatar
      mm, swap: don't use VMA based swap readahead if HDD is used as swap · 81a0298b
      Huang Ying authored
      VMA based swap readahead will readahead the virtual pages that is
      continuous in the virtual address space.  While the original swap
      readahead will readahead the swap slots that is continuous in the swap
      device.  Although VMA based swap readahead is more correct for the swap
      slots to be readahead, it will trigger more small random readings, which
      may cause the performance of HDD (hard disk) to degrade heavily, and may
      finally exceed the benefit.
      
      To avoid the issue, in this patch, if the HDD is used as swap, the VMA
      based swap readahead will be disabled, and the original swap readahead
      will be used instead.
      
      Link: http://lkml.kernel.org/r/20170807054038.1843-6-ying.huang@intel.comSigned-off-by: default avatar"Huang, Ying" <ying.huang@intel.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Shaohua Li <shli@kernel.org>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Tim Chen <tim.c.chen@intel.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      81a0298b
    • Huang Ying's avatar
      mm, swap: add sysfs interface for VMA based swap readahead · d9bfcfdc
      Huang Ying authored
      The sysfs interface to control the VMA based swap readahead is added as
      follow,
      
      /sys/kernel/mm/swap/vma_ra_enabled
      
      Enable the VMA based swap readahead algorithm, or use the original
      global swap readahead algorithm.
      
      /sys/kernel/mm/swap/vma_ra_max_order
      
      Set the max order of the readahead window size for the VMA based swap
      readahead algorithm.
      
      The corresponding ABI documentation is added too.
      
      Link: http://lkml.kernel.org/r/20170807054038.1843-5-ying.huang@intel.comSigned-off-by: default avatar"Huang, Ying" <ying.huang@intel.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Shaohua Li <shli@kernel.org>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Tim Chen <tim.c.chen@intel.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d9bfcfdc