1. 03 Aug, 2019 6 commits
    • Mel Gorman's avatar
      mm: compaction: avoid 100% CPU usage during compaction when a task is killed · 670105a2
      Mel Gorman authored
      "howaboutsynergy" reported via kernel buzilla number 204165 that
      compact_zone_order was consuming 100% CPU during a stress test for
      prolonged periods of time.  Specifically the following command, which
      should exit in 10 seconds, was taking an excessive time to finish while
      the CPU was pegged at 100%.
      
        stress -m 220 --vm-bytes 1000000000 --timeout 10
      
      Tracing indicated a pattern as follows
      
                stress-3923  [007]   519.106208: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
                stress-3923  [007]   519.106212: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
                stress-3923  [007]   519.106216: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
                stress-3923  [007]   519.106219: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
                stress-3923  [007]   519.106223: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
                stress-3923  [007]   519.106227: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
                stress-3923  [007]   519.106231: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
                stress-3923  [007]   519.106235: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
                stress-3923  [007]   519.106238: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
                stress-3923  [007]   519.106242: mm_compaction_isolate_migratepages: range=(0x70bb80 ~ 0x70bb80) nr_scanned=0 nr_taken=0
      
      Note that compaction is entered in rapid succession while scanning and
      isolating nothing.  The problem is that when a task that is compacting
      receives a fatal signal, it retries indefinitely instead of exiting
      while making no progress as a fatal signal is pending.
      
      It's not easy to trigger this condition although enabling zswap helps on
      the basis that the timing is altered.  A very small window has to be hit
      for the problem to occur (signal delivered while compacting and
      isolating a PFN for migration that is not aligned to SWAP_CLUSTER_MAX).
      
      This was reproduced locally -- 16G single socket system, 8G swap, 30%
      zswap configured, vm-bytes 22000000000 using Colin Kings stress-ng
      implementation from github running in a loop until the problem hits).
      Tracing recorded the problem occurring almost 200K times in a short
      window.  With this patch, the problem hit 4 times but the task existed
      normally instead of consuming CPU.
      
      This problem has existed for some time but it was made worse by commit
      cf66f070 ("mm, compaction: do not consider a need to reschedule as
      contention").  Before that commit, if the same condition was hit then
      locks would be quickly contended and compaction would exit that way.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204165
      Link: http://lkml.kernel.org/r/20190718085708.GE24383@techsingularity.net
      Fixes: cf66f070 ("mm, compaction: do not consider a need to reschedule as contention")
      Signed-off-by: default avatarMel Gorman <mgorman@techsingularity.net>
      Reviewed-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: <stable@vger.kernel.org>	[5.1+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      670105a2
    • Jan Kara's avatar
      mm: migrate: fix reference check race between __find_get_block() and migration · ebdf4de5
      Jan Kara authored
      buffer_migrate_page_norefs() can race with bh users in the following
      way:
      
      CPU1                                    CPU2
      buffer_migrate_page_norefs()
        buffer_migrate_lock_buffers()
        checks bh refs
        spin_unlock(&mapping->private_lock)
                                              __find_get_block()
                                                spin_lock(&mapping->private_lock)
                                                grab bh ref
                                                spin_unlock(&mapping->private_lock)
        move page                               do bh work
      
      This can result in various issues like lost updates to buffers (i.e.
      metadata corruption) or use after free issues for the old page.
      
      This patch closes the race by holding mapping->private_lock while the
      mapping is being moved to a new page.  Ordinarily, a reference can be
      taken outside of the private_lock using the per-cpu BH LRU but the
      references are checked and the LRU invalidated if necessary.  The
      private_lock is held once the references are known so the buffer lookup
      slow path will spin on the private_lock.  Between the page lock and
      private_lock, it should be impossible for other references to be
      acquired and updates to happen during the migration.
      
      A user had reported data corruption issues on a distribution kernel with
      a similar page migration implementation as mainline.  The data
      corruption could not be reproduced with this patch applied.  A small
      number of migration-intensive tests were run and no performance problems
      were noted.
      
      [mgorman@techsingularity.net: Changelog, removed tracing]
      Link: http://lkml.kernel.org/r/20190718090238.GF24383@techsingularity.net
      Fixes: 89cb0888 "mm: migrate: provide buffer_migrate_page_norefs()"
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarMel Gorman <mgorman@techsingularity.net>
      Cc: <stable@vger.kernel.org>	[5.0+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ebdf4de5
    • Yang Shi's avatar
      mm: vmscan: check if mem cgroup is disabled or not before calling memcg slab shrinker · fa1e512f
      Yang Shi authored
      Shakeel Butt reported premature oom on kernel with
      "cgroup_disable=memory" since mem_cgroup_is_root() returns false even
      though memcg is actually NULL.  The drop_caches is also broken.
      
      It is because commit aeed1d32 ("mm/vmscan.c: generalize
      shrink_slab() calls in shrink_node()") removed the !memcg check before
      !mem_cgroup_is_root().  And, surprisingly root memcg is allocated even
      though memory cgroup is disabled by kernel boot parameter.
      
      Add mem_cgroup_disabled() check to make reclaimer work as expected.
      
      Link: http://lkml.kernel.org/r/1563385526-20805-1-git-send-email-yang.shi@linux.alibaba.com
      Fixes: aeed1d32 ("mm/vmscan.c: generalize shrink_slab() calls in shrink_node()")
      Signed-off-by: default avatarYang Shi <yang.shi@linux.alibaba.com>
      Reported-by: default avatarShakeel Butt <shakeelb@google.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Reviewed-by: default avatarKirill Tkhai <ktkhai@virtuozzo.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Jan Hadrava <had@kam.mff.cuni.cz>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: <stable@vger.kernel.org>	[4.19+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fa1e512f
    • YueHaibing's avatar
      ocfs2: remove set but not used variable 'last_hash' · 7bc36e3c
      YueHaibing authored
      Fixes gcc '-Wunused-but-set-variable' warning:
      
        fs/ocfs2/xattr.c: In function ocfs2_xattr_bucket_find:
        fs/ocfs2/xattr.c:3828:6: warning: variable last_hash set but not used [-Wunused-but-set-variable]
      
      It's never used and can be removed.
      
      Link: http://lkml.kernel.org/r/20190716132110.34836-1-yuehaibing@huawei.comSigned-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Acked-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7bc36e3c
    • Yang Shi's avatar
      Revert "kmemleak: allow to coexist with fault injection" · df9576de
      Yang Shi authored
      When running ltp's oom test with kmemleak enabled, the below warning was
      triggerred since kernel detects __GFP_NOFAIL & ~__GFP_DIRECT_RECLAIM is
      passed in:
      
        WARNING: CPU: 105 PID: 2138 at mm/page_alloc.c:4608 __alloc_pages_nodemask+0x1c31/0x1d50
        Modules linked in: loop dax_pmem dax_pmem_core ip_tables x_tables xfs virtio_net net_failover virtio_blk failover ata_generic virtio_pci virtio_ring virtio libata
        CPU: 105 PID: 2138 Comm: oom01 Not tainted 5.2.0-next-20190710+ #7
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.2-0-g5f4c7b1-prebuilt.qemu-project.org 04/01/2014
        RIP: 0010:__alloc_pages_nodemask+0x1c31/0x1d50
        ...
         kmemleak_alloc+0x4e/0xb0
         kmem_cache_alloc+0x2a7/0x3e0
         mempool_alloc_slab+0x2d/0x40
         mempool_alloc+0x118/0x2b0
         bio_alloc_bioset+0x19d/0x350
         get_swap_bio+0x80/0x230
         __swap_writepage+0x5ff/0xb20
      
      The mempool_alloc_slab() clears __GFP_DIRECT_RECLAIM, however kmemleak
      has __GFP_NOFAIL set all the time due to d9570ee3 ("kmemleak:
      allow to coexist with fault injection").  But, it doesn't make any sense
      to have __GFP_NOFAIL and ~__GFP_DIRECT_RECLAIM specified at the same
      time.
      
      According to the discussion on the mailing list, the commit should be
      reverted for short term solution.  Catalin Marinas would follow up with
      a better solution for longer term.
      
      The failure rate of kmemleak metadata allocation may increase in some
      circumstances, but this should be expected side effect.
      
      Link: http://lkml.kernel.org/r/1563299431-111710-1-git-send-email-yang.shi@linux.alibaba.com
      Fixes: d9570ee3 ("kmemleak: allow to coexist with fault injection")
      Signed-off-by: default avatarYang Shi <yang.shi@linux.alibaba.com>
      Suggested-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Qian Cai <cai@lca.pw>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      df9576de
    • Mauro Carvalho Chehab's avatar
      kernel/signal.c: fix a kernel-doc markup · 68d8681e
      Mauro Carvalho Chehab authored
      The kernel-doc parser doesn't handle expressions with %foo*.  Instead,
      when an asterisk should be part of a constant, it uses an alternative
      notation: `foo*`.
      
      Link: http://lkml.kernel.org/r/7f18c2e0b5e39e6b7eb55ddeb043b8b260b49f2d.1563361575.git.mchehab+samsung@kernel.orgSigned-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Cc: Deepa Dinamani <deepa.kernel@gmail.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      68d8681e
  2. 02 Aug, 2019 8 commits
    • Linus Torvalds's avatar
      Merge tag 'gfs2-v5.3-rc2.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2 · 97b00aff
      Linus Torvalds authored
      Pull gfs2 fix from Andreas Gruenbacher:
       "Fix gfs2 cluster coherency bug"
      
      * tag 'gfs2-v5.3-rc2.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
        gfs2: Inode dirtying fix
      97b00aff
    • Linus Torvalds's avatar
      Merge tag 'pm-5.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 755f1fed
      Linus Torvalds authored
      Pull power management fix from Rafael Wysocki:
       "Fix recent regression affecting ACPI device power management"
      
      * tag 'pm-5.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: PM: Fix regression in acpi_device_set_power()
      755f1fed
    • Linus Torvalds's avatar
      Merge tag 'sound-5.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 75cdf416
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
      
       - A further fix for syzcaller issues with USB-audio, addressing NULL
         dereference that was introduced by the recent fix
      
       - Avoid a long delay at boot with HD-audio when i915 module was built
         but not installed, found on some Debian systems
      
       - A fix of small race window at PCM draining
      
      * tag 'sound-5.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: usb-audio: Fix gpf in snd_usb_pipe_sanity_check
        ALSA: pcm: fix lost wakeup event scenarios in snd_pcm_drain
        ALSA: hda: Fix 1-minute detection delay when i915 module is not available
      75cdf416
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2019-08-02' of git://anongit.freedesktop.org/drm/drm · f26dbb23
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Thanks to Daniel for handling the email the last couple of weeks, flus
        and break-ins combined to derail me. Surprised nothing materialised
        today to take me out again.
      
        Just more amdgpu navi fixes, msm fixes and a single nouveau regression
        fix:
      
        amdgpu:
         - navi10 temperature and pstate fixes
         - vcn dynamic power management fix
         - CS ioctl error handling fix
         - debugfs info leak fix
         - amdkfd VegaM fix
      
        msm:
         - dma sync call fix
         - mdp5 dsi command mode fix
         - fall-through fixes
         - disabled GPU fix
      
        nouveau:
         - regression fix for displayport MST support"
      
      * tag 'drm-fixes-2019-08-02' of git://anongit.freedesktop.org/drm/drm:
        drm/nouveau: Only release VCPI slots on mode changes
        drm: msm: Fix add_gpu_components
        drm/msm: Annotate intentional switch statement fall throughs
        drm/msm: add support for per-CRTC max_vblank_count on mdp5
        drm/msm: Use the correct dma_sync calls in msm_gem
        drm/amd/powerplay: correct UVD/VCE/VCN power status retrieval
        drm/amd/powerplay: correct Navi10 VCN powergate control (v2)
        drm/amd/powerplay: support VCN powergate status retrieval for SW SMU
        drm/amd/powerplay: support VCN powergate status retrieval on Raven
        drm/amd/powerplay: add new sensor type for VCN powergate status
        drm/amdgpu: fix a potential information leaking bug
        drm/amdgpu: fix error handling in amdgpu_cs_process_fence_dep
        drm/amd/powerplay: enable SW SMU reset functionality
        drm/amd/powerplay: fix null pointer dereference around dpm state relates
        drm/amdgpu/powerplay: use proper revision id for navi
        drm/amd/powerplay: fix temperature granularity error in smu11
        drm/amd/powerplay: add callback function of get_thermal_temperature_range
        drm/amdkfd: Fix byte align on VegaM
      f26dbb23
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 42d21900
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "A few fixes for code that came in during the merge window or that
        started getting exercised differently this time around:
      
         - Select regmap MMIO kconfig in spreadtrum driver to avoid compile
           errors
      
         - Complete kerneldoc on devm_clk_bulk_get_optional()
      
         - Register an essential clk earlier on mediatek mt8183 SoCs so the
           clocksource driver can use it
      
         - Fix divisor math in the at91 driver
      
         - Plug a race in Renesas reset control logic"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: renesas: cpg-mssr: Fix reset control race condition
        clk: sprd: Select REGMAP_MMIO to avoid compile errors
        clk: mediatek: mt8183: Register 13MHz clock earlier for clocksource
        clk: Add missing documentation of devm_clk_bulk_get_optional() argument
        clk: at91: generated: Truncate divisor to GENERATED_MAX_DIV + 1
      42d21900
    • Linus Torvalds's avatar
      Merge tag 'arm-swiotlb-5.3' of git://git.infradead.org/users/hch/dma-mapping · 234172f6
      Linus Torvalds authored
      Pull arm swiotlb support from Christoph Hellwig:
       "This fixes a cascade of regressions that originally started with the
        addition of the ia64 port, but only got fatal once we removed most
        uses of block layer bounce buffering in Linux 4.18.
      
        The reason is that while the original i386/PAE code that was the first
        architecture that supported > 4GB of memory without an iommu decided
        to leave bounce buffering to the subsystems, which in those days just
        mean block and networking as no one else consumed arbitrary userspace
        memory.
      
        Later with ia64, x86_64 and other ports we assumed that either an
        iommu or something that fakes it up ("software IOTLB" in beautiful
        Intel speak) is present and that subsystems can rely on that for
        dealing with addressing limitations in devices. Except that the ARM
        LPAE scheme that added larger physical address to 32-bit ARM did not
        follow that scheme and thus only worked by chance and only for block
        and networking I/O directly to highmem.
      
        Long story, short fix - add swiotlb support to arm when build for LPAE
        platforms, which actuallys turns out to be pretty trivial with the
        modern dma-direct / swiotlb code to fix the Linux 4.18-ish regression"
      
      * tag 'arm-swiotlb-5.3' of git://git.infradead.org/users/hch/dma-mapping:
        arm: use swiotlb for bounce buffering on LPAE configs
        dma-mapping: check pfn validity in dma_common_{mmap,get_sgtable}
      234172f6
    • Linus Torvalds's avatar
      Merge tag 'dma-mapping-5.3-3' of git://git.infradead.org/users/hch/dma-mapping · 35fca9f8
      Linus Torvalds authored
      Pull dma-mapping regression fixes from Christoph Hellwig:
       "Two related regression fixes for changes from this merge window to fix
        alignment issues introduced in the CMA allocation rework (Nicolin
        Chen)"
      
      * tag 'dma-mapping-5.3-3' of git://git.infradead.org/users/hch/dma-mapping:
        dma-contiguous: page-align the size in dma_free_contiguous()
        dma-contiguous: do not overwrite align in dma_alloc_contiguous()
      35fca9f8
    • Dave Airlie's avatar
      Merge tag 'msm-fixes-2019_08_01' of https://gitlab.freedesktop.org/drm/msm into drm-fixes · f8981e03
      Dave Airlie authored
      - Fix the dma_sync calls applied last week (Rob)
      - Fix mdp5 dsi command mode (Brian)
      - Squash fall through warnings (Jordan)
      - Don't add disabled gpu nodes to the of device list (Jeffrey)
      
      Cc: Jeffrey Hugo <jeffrey.l.hugo@gmail.com>
      Cc: Jordan Crouse <jcrouse@codeaurora.org>
      Cc: Brian Masney <masneyb@onstation.org>
      Cc: Rob Clark <robdclark@chromium.org>
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      # gpg: Signature made Fri 02 Aug 2019 05:54:27 AM AEST
      # gpg:                using RSA key 96F70DFDA84A070A
      # gpg: Can't check signature: public key not found
      From: Sean Paul <sean@poorly.run>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190801200439.GV104440@art_vandelay
      f8981e03
  3. 01 Aug, 2019 8 commits
  4. 31 Jul, 2019 18 commits