1. 15 Dec, 2020 40 commits
    • Linus Torvalds's avatar
      Merge tag 'irq-core-2020-12-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 2cffa11e
      Linus Torvalds authored
      Pull irq updates from Thomas Gleixner:
       "Generic interrupt and irqchips subsystem updates. Unusually, there is
        not a single completely new irq chip driver, just new DT bindings and
        extensions of existing drivers to accomodate new variants!
      
        Core:
      
         - Consolidation and robustness changes for irq time accounting
      
         - Cleanup and consolidation of irq stats
      
         - Remove the fasteoi IPI flow which has been proved useless
      
         - Provide an interface for converting legacy interrupt mechanism into
           irqdomains
      
        Drivers:
      
         - Preliminary support for managed interrupts on platform devices
      
         - Correctly identify allocation of MSIs proxyied by another device
      
         - Generalise the Ocelot support to new SoCs
      
         - Improve GICv4.1 vcpu entry, matching the corresponding KVM
           optimisation
      
         - Work around spurious interrupts on Qualcomm PDC
      
         - Random fixes and cleanups"
      
      * tag 'irq-core-2020-12-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (54 commits)
        irqchip/qcom-pdc: Fix phantom irq when changing between rising/falling
        driver core: platform: Add devm_platform_get_irqs_affinity()
        ACPI: Drop acpi_dev_irqresource_disabled()
        resource: Add irqresource_disabled()
        genirq/affinity: Add irq_update_affinity_desc()
        irqchip/gic-v3-its: Flag device allocation as proxied if behind a PCI bridge
        irqchip/gic-v3-its: Tag ITS device as shared if allocating for a proxy device
        platform-msi: Track shared domain allocation
        irqchip/ti-sci-intr: Fix freeing of irqs
        irqchip/ti-sci-inta: Fix printing of inta id on probe success
        drivers/irqchip: Remove EZChip NPS interrupt controller
        Revert "genirq: Add fasteoi IPI flow"
        irqchip/hip04: Make IPIs use handle_percpu_devid_irq()
        irqchip/bcm2836: Make IPIs use handle_percpu_devid_irq()
        irqchip/armada-370-xp: Make IPIs use handle_percpu_devid_irq()
        irqchip/gic, gic-v3: Make SGIs use handle_percpu_devid_irq()
        irqchip/ocelot: Add support for Jaguar2 platforms
        irqchip/ocelot: Add support for Serval platforms
        irqchip/ocelot: Add support for Luton platforms
        irqchip/ocelot: prepare to support more SoC
        ...
      2cffa11e
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 5b200f57
      Linus Torvalds authored
      Merge more updates from Andrew Morton:
       "More MM work: a memcg scalability improvememt"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        mm/lru: revise the comments of lru_lock
        mm/lru: introduce relock_page_lruvec()
        mm/lru: replace pgdat lru_lock with lruvec lock
        mm/swap.c: serialize memcg changes in pagevec_lru_move_fn
        mm/compaction: do page isolation first in compaction
        mm/lru: introduce TestClearPageLRU()
        mm/mlock: remove __munlock_isolate_lru_page()
        mm/mlock: remove lru_lock on TestClearPageMlocked
        mm/vmscan: remove lruvec reget in move_pages_to_lru
        mm/lru: move lock into lru_note_cost
        mm/swap.c: fold vm event PGROTATED into pagevec_move_tail_fn
        mm/memcg: add debug checking in lock_page_memcg
        mm: page_idle_get_page() does not need lru_lock
        mm/rmap: stop store reordering issue on page->mapping
        mm/vmscan: remove unnecessary lruvec adding
        mm/thp: narrow lru locking
        mm/thp: simplify lru_add_page_tail()
        mm/thp: use head for head page in lru_add_page_tail()
        mm/thp: move lru_add_page_tail() to huge_memory.c
      5b200f57
    • Hugh Dickins's avatar
      mm/lru: revise the comments of lru_lock · 15b44736
      Hugh Dickins authored
      Since we changed the pgdat->lru_lock to lruvec->lru_lock, it's time to fix
      the incorrect comments in code.  Also fixed some zone->lru_lock comment
      error from ancient time.  etc.
      
      I struggled to understand the comment above move_pages_to_lru() (surely
      it never calls page_referenced()), and eventually realized that most of
      it had got separated from shrink_active_list(): move that comment back.
      
      Link: https://lkml.kernel.org/r/1604566549-62481-20-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      15b44736
    • Alexander Duyck's avatar
      mm/lru: introduce relock_page_lruvec() · 2a5e4e34
      Alexander Duyck authored
      Add relock_page_lruvec() to replace repeated same code, no functional
      change.
      
      When testing for relock we can avoid the need for RCU locking if we simply
      compare the page pgdat and memcg pointers versus those that the lruvec is
      holding.  By doing this we can avoid the extra pointer walks and accesses
      of the memory cgroup.
      
      In addition we can avoid the checks entirely if lruvec is currently NULL.
      
      [alex.shi@linux.alibaba.com: use page_memcg()]
        Link: https://lkml.kernel.org/r/66d8e79d-7ec6-bfbc-1c82-bf32db3ae5b7@linux.alibaba.com
      
      Link: https://lkml.kernel.org/r/1604566549-62481-19-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlexander Duyck <alexander.h.duyck@linux.intel.com>
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2a5e4e34
    • Alex Shi's avatar
      mm/lru: replace pgdat lru_lock with lruvec lock · 6168d0da
      Alex Shi authored
      This patch moves per node lru_lock into lruvec, thus bring a lru_lock for
      each of memcg per node.  So on a large machine, each of memcg don't have
      to suffer from per node pgdat->lru_lock competition.  They could go fast
      with their self lru_lock.
      
      After move memcg charge before lru inserting, page isolation could
      serialize page's memcg, then per memcg lruvec lock is stable and could
      replace per node lru lock.
      
      In isolate_migratepages_block(), compact_unlock_should_abort and
      lock_page_lruvec_irqsave are open coded to work with compact_control.
      Also add a debug func in locking which may give some clues if there are
      sth out of hands.
      
      Daniel Jordan's testing show 62% improvement on modified readtwice case on
      his 2P * 10 core * 2 HT broadwell box.
      https://lore.kernel.org/lkml/20200915165807.kpp7uhiw7l3loofu@ca-dmjordan1.us.oracle.com/
      
      Hugh Dickins helped on the patch polish, thanks!
      
      [alex.shi@linux.alibaba.com: fix comment typo]
        Link: https://lkml.kernel.org/r/5b085715-292a-4b43-50b3-d73dc90d1de5@linux.alibaba.com
      [alex.shi@linux.alibaba.com: use page_memcg()]
        Link: https://lkml.kernel.org/r/5a4c2b72-7ee8-2478-fc0e-85eb83aafec4@linux.alibaba.com
      
      Link: https://lkml.kernel.org/r/1604566549-62481-18-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Rong Chen <rong.a.chen@intel.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6168d0da
    • Alex Shi's avatar
      mm/swap.c: serialize memcg changes in pagevec_lru_move_fn · fc574c23
      Alex Shi authored
      Hugh Dickins' found a memcg change bug on original version: If we want to
      change the pgdat->lru_lock to memcg's lruvec lock, we have to serialize
      mem_cgroup_move_account during pagevec_lru_move_fn.  The possible bad
      scenario would like:
      
      	cpu 0					cpu 1
      lruvec = mem_cgroup_page_lruvec()
      					if (!isolate_lru_page())
      						mem_cgroup_move_account
      
      spin_lock_irqsave(&lruvec->lru_lock <== wrong lock.
      
      So we need TestClearPageLRU to block isolate_lru_page(), that serializes
      the memcg change.  and then removing the PageLRU check in move_fn callee
      as the consequence.
      
      __pagevec_lru_add_fn() is different from the others, because the pages it
      deals with are, by definition, not yet on the lru.  TestClearPageLRU is
      not needed and would not work, so __pagevec_lru_add() goes its own way.
      
      Link: https://lkml.kernel.org/r/1604566549-62481-17-git-send-email-alex.shi@linux.alibaba.comReported-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fc574c23
    • Alex Shi's avatar
      mm/compaction: do page isolation first in compaction · 9df41314
      Alex Shi authored
      Currently, compaction would get the lru_lock and then do page isolation
      which works fine with pgdat->lru_lock, since any page isoltion would
      compete for the lru_lock.  If we want to change to memcg lru_lock, we have
      to isolate the page before getting lru_lock, thus isoltion would block
      page's memcg change which relay on page isoltion too.  Then we could
      safely use per memcg lru_lock later.
      
      The new page isolation use previous introduced TestClearPageLRU() + pgdat
      lru locking which will be changed to memcg lru lock later.
      
      Hugh Dickins <hughd@google.com> fixed following bugs in this patch's early
      version:
      
      Fix lots of crashes under compaction load: isolate_migratepages_block()
      must clean up appropriately when rejecting a page, setting PageLRU again
      if it had been cleared; and a put_page() after get_page_unless_zero()
      cannot safely be done while holding locked_lruvec - it may turn out to be
      the final put_page(), which will take an lruvec lock when PageLRU.
      
      And move __isolate_lru_page_prepare back after get_page_unless_zero to
      make trylock_page() safe: trylock_page() is not safe to use at this time:
      its setting PG_locked can race with the page being freed or allocated
      ("Bad page"), and can also erase flags being set by one of those "sole
      owners" of a freshly allocated page who use non-atomic __SetPageFlag().
      
      Link: https://lkml.kernel.org/r/1604566549-62481-16-git-send-email-alex.shi@linux.alibaba.comSuggested-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9df41314
    • Alex Shi's avatar
      mm/lru: introduce TestClearPageLRU() · d25b5bd8
      Alex Shi authored
      Currently lru_lock still guards both lru list and page's lru bit, that's
      ok.  but if we want to use specific lruvec lock on the page, we need to
      pin down the page's lruvec/memcg during locking.  Just taking lruvec lock
      first may be undermined by the page's memcg charge/migration.  To fix this
      problem, we will clear the lru bit out of locking and use it as pin down
      action to block the page isolation in memcg changing.
      
      So now a standard steps of page isolation is following:
      	1, get_page(); 	       #pin the page avoid to be free
      	2, TestClearPageLRU(); #block other isolation like memcg change
      	3, spin_lock on lru_lock; #serialize lru list access
      	4, delete page from lru list;
      
      This patch start with the first part: TestClearPageLRU, which combines
      PageLRU check and ClearPageLRU into a macro func TestClearPageLRU.  This
      function will be used as page isolation precondition to prevent other
      isolations some where else.  Then there are may !PageLRU page on lru list,
      need to remove BUG() checking accordingly.
      
      There 2 rules for lru bit now:
      1, the lru bit still indicate if a page on lru list, just in some
         temporary moment(isolating), the page may have no lru bit when
         it's on lru list.  but the page still must be on lru list when the
         lru bit set.
      2, have to remove lru bit before delete it from lru list.
      
      As Andrew Morton mentioned this change would dirty cacheline for a page
      which isn't on the LRU.  But the loss would be acceptable in Rong Chen
      <rong.a.chen@intel.com> report:
      https://lore.kernel.org/lkml/20200304090301.GB5972@shao2-debian/
      
      Link: https://lkml.kernel.org/r/1604566549-62481-15-git-send-email-alex.shi@linux.alibaba.comSuggested-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d25b5bd8
    • Alex Shi's avatar
      mm/mlock: remove __munlock_isolate_lru_page() · 13805a88
      Alex Shi authored
      __munlock_isolate_lru_page() only has one caller, remove it to clean up
      and simplify code.
      
      Link: https://lkml.kernel.org/r/1604566549-62481-14-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      13805a88
    • Alex Shi's avatar
      mm/mlock: remove lru_lock on TestClearPageMlocked · 3db19aa3
      Alex Shi authored
      In the func munlock_vma_page, comments mentained lru_lock needed for
      serialization with split_huge_pages.  But the page must be PageLocked as
      well as pages in split_huge_page series funcs.  Thus the PageLocked is
      enough to serialize both funcs.
      
      Further more, Hugh Dickins pointed: before splitting in
      split_huge_page_to_list, the page was unmap_page() to remove pmd/ptes
      which protect the page from munlock.  Thus, no needs to guard
      __split_huge_page_tail for mlock clean, just keep the lru_lock there for
      isolation purpose.
      
      LKP found a preempt issue on __mod_zone_page_state which need change to
      mod_zone_page_state.  Thanks!
      
      Link: https://lkml.kernel.org/r/1604566549-62481-13-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3db19aa3
    • Alex Shi's avatar
      mm/vmscan: remove lruvec reget in move_pages_to_lru · afca9157
      Alex Shi authored
      Isolated page shouldn't be recharged by memcg since the memcg migration
      isn't possible at the time.  All pages were isolated from the same lruvec
      (and isolation inhibits memcg migration).  So remove unnecessary
      regetting.
      
      Thanks to Alexander Duyck for pointing this out.
      
      Link: https://lkml.kernel.org/r/1604566549-62481-12-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      afca9157
    • Alex Shi's avatar
      mm/lru: move lock into lru_note_cost · 75cc3c91
      Alex Shi authored
      We have to move lru_lock into lru_note_cost, since it cycle up on memcg
      tree, for future per lruvec lru_lock replace.  It's a bit ugly and may
      cost a bit more locking, but benefit from multiple memcg locking could
      cover the lost.
      
      Link: https://lkml.kernel.org/r/1604566549-62481-11-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      75cc3c91
    • Alex Shi's avatar
      mm/swap.c: fold vm event PGROTATED into pagevec_move_tail_fn · c7c7b80c
      Alex Shi authored
      Fold the PGROTATED event collection into pagevec_move_tail_fn call back
      func like other funcs does in pagevec_lru_move_fn.  Thus we could save
      func call pagevec_move_tail().  Now all usage of pagevec_lru_move_fn are
      same and no needs of its 3rd parameter.
      
      It's just simply the calling. No functional change.
      
      [lkp@intel.com: found a build issue in the original patch, thanks]
      
      Link: https://lkml.kernel.org/r/1604566549-62481-10-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c7c7b80c
    • Alex Shi's avatar
      mm/memcg: add debug checking in lock_page_memcg · 20ad50d6
      Alex Shi authored
      Add a debug checking in lock_page_memcg, then we could get alarm if
      anything wrong here.
      
      Link: https://lkml.kernel.org/r/1604566549-62481-9-git-send-email-alex.shi@linux.alibaba.comSuggested-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      20ad50d6
    • Hugh Dickins's avatar
      mm: page_idle_get_page() does not need lru_lock · 880fc6ba
      Hugh Dickins authored
      It is necessary for page_idle_get_page() to recheck PageLRU() after
      get_page_unless_zero(), but holding lru_lock around that serves no
      useful purpose, and adds to lru_lock contention: delete it.
      
      See https://lore.kernel.org/lkml/20150504031722.GA2768@blaptop for the
      discussion that led to lru_lock there; but __page_set_anon_rmap() now uses
      WRITE_ONCE(), and I see no other risk in page_idle_clear_pte_refs() using
      rmap_walk() (beyond the risk of racing PageAnon->PageKsm, mostly but not
      entirely prevented by page_count() check in ksm.c's write_protect_page():
      that risk being shared with page_referenced() and not helped by lru_lock).
      
      Link: https://lkml.kernel.org/r/1604566549-62481-8-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatar"Huang, Ying" <ying.huang@intel.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      880fc6ba
    • Alex Shi's avatar
      mm/rmap: stop store reordering issue on page->mapping · 16f5e707
      Alex Shi authored
      Hugh Dickins and Minchan Kim observed a long time issue which discussed
      here, but actully the mentioned fix in
      
        https://lore.kernel.org/lkml/20150504031722.GA2768@blaptop/
      
      was missed.
      
      The store reordering may cause problem in the scenario:
      
      	CPU 0						CPU1
         do_anonymous_page
      	page_add_new_anon_rmap()
      	  page->mapping = anon_vma + PAGE_MAPPING_ANON
      	lru_cache_add_inactive_or_unevictable()
      	  spin_lock(lruvec->lock)
      	  SetPageLRU()
      	  spin_unlock(lruvec->lock)
      						/* idletacking judged it as LRU
      						 * page so pass the page in
      						 * page_idle_clear_pte_refs
      						 */
      						page_idle_clear_pte_refs
      						  rmap_walk
      						    if PageAnon(page)
      
      Johannes give detailed examples how the store reordering could cause
      trouble: "The concern is the SetPageLRU may get reorder before
      'page->mapping' setting, That would make CPU 1 will observe at
      page->mapping after observing PageLRU set on the page.
      
      1. anon_vma + PAGE_MAPPING_ANON
      
         That's the in-order scenario and is fine.
      
      2. NULL
      
         That's possible if the page->mapping store gets reordered to occur
         after SetPageLRU. That's fine too because we check for it.
      
      3. anon_vma without the PAGE_MAPPING_ANON bit
      
         That would be a problem and could lead to all kinds of undesirable
         behavior including crashes and data corruption.
      
         Is it possible? AFAICT the compiler is allowed to tear the store to
         page->mapping and I don't see anything that would prevent it.
      
      That said, I also don't see how the reader testing PageLRU under the
      lru_lock would prevent that in the first place.  AFAICT we need that
      WRITE_ONCE() around the page->mapping assignment."
      
      [alex.shi@linux.alibaba.com: updated for comments change from Johannes]
        Link: https://lkml.kernel.org/r/e66ef2e5-c74c-6498-e8b3-56c37b9d2d15@linux.alibaba.com
      
      Link: https://lkml.kernel.org/r/1604566549-62481-7-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      16f5e707
    • Alex Shi's avatar
      mm/vmscan: remove unnecessary lruvec adding · 3d06afab
      Alex Shi authored
      We don't have to add a freeable page into lru and then remove from it.
      This change saves a couple of actions and makes the moving more clear.
      
      The SetPageLRU needs to be kept before put_page_testzero for list
      integrity, otherwise:
      
        #0 move_pages_to_lru             #1 release_pages
        if !put_page_testzero
           			           if (put_page_testzero())
           			              !PageLRU //skip lru_lock
           SetPageLRU()
           list_add(&page->lru,)
                                               list_add(&page->lru,)
      
      [akpm@linux-foundation.org: coding style fixes]
      
      Link: https://lkml.kernel.org/r/1604566549-62481-6-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3d06afab
    • Alex Shi's avatar
      mm/thp: narrow lru locking · b6769834
      Alex Shi authored
      lru_lock and page cache xa_lock have no obvious reason to be taken one
      way round or the other: until now, lru_lock has been taken before page
      cache xa_lock, when splitting a THP; but nothing else takes them
      together.  Reverse that ordering: let's narrow the lru locking - but
      leave local_irq_disable to block interrupts throughout, like before.
      
      Hugh Dickins point: split_huge_page_to_list() was already silly, to be
      using the _irqsave variant: it's just been taking sleeping locks, so
      would already be broken if entered with interrupts enabled.  So we can
      save passing flags argument down to __split_huge_page().
      
      Why change the lock ordering here? That was hard to decide.  One reason:
      when this series reaches per-memcg lru locking, it relies on the THP's
      memcg to be stable when taking the lru_lock: that is now done after the
      THP's refcount has been frozen, which ensures page memcg cannot change.
      
      Another reason: previously, lock_page_memcg()'s move_lock was presumed
      to nest inside lru_lock; but now lru_lock must nest inside (page cache
      lock inside) move_lock, so it becomes possible to use lock_page_memcg()
      to stabilize page memcg before taking its lru_lock.  That is not the
      mechanism used in this series, but it is an option we want to keep open.
      
      [hughd@google.com: rewrite commit log]
      
      Link: https://lkml.kernel.org/r/1604566549-62481-5-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Reviewed-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b6769834
    • Alex Shi's avatar
      mm/thp: simplify lru_add_page_tail() · 6dbb5741
      Alex Shi authored
      Simplify lru_add_page_tail(), there are actually only two cases
      possible: split_huge_page_to_list(), with list supplied and head
      isolated from lru by its caller; or split_huge_page(), with NULL list
      and head on lru - because when head is racily isolated from lru, the
      isolator's reference will stop the split from getting any further than
      its page_ref_freeze().
      
      So decide between the two cases by "list", but add VM_WARN_ON()s to
      verify that they match our lru expectations.
      
      [Hugh Dickins: rewrite commit log]
      
      Link: https://lkml.kernel.org/r/1604566549-62481-4-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Reviewed-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6dbb5741
    • Alex Shi's avatar
      mm/thp: use head for head page in lru_add_page_tail() · 94866635
      Alex Shi authored
      Since the first parameter is only used by head page, it's better to make
      it explicit.
      
      Link: https://lkml.kernel.org/r/1604566549-62481-3-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Reviewed-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      94866635
    • Alex Shi's avatar
      mm/thp: move lru_add_page_tail() to huge_memory.c · 88dcb9a3
      Alex Shi authored
      Patch series "per memcg lru lock", v21.
      
      This patchset includes 3 parts:
      
       1) some code cleanup and minimum optimization as preparation
      
       2) use TestCleanPageLRU as page isolation's precondition
      
       3) replace per node lru_lock with per memcg per node lru_lock
      
      Current lru_lock is one for each of node, pgdat->lru_lock, that guard
      for lru lists, but now we had moved the lru lists into memcg for long
      time.  Still using per node lru_lock is clearly unscalable, pages on
      each of memcgs have to compete each others for a whole lru_lock.  This
      patchset try to use per lruvec/memcg lru_lock to repleace per node lru
      lock to guard lru lists, make it scalable for memcgs and get performance
      gain.
      
      Currently lru_lock still guards both lru list and page's lru bit, that's
      ok.  but if we want to use specific lruvec lock on the page, we need to
      pin down the page's lruvec/memcg during locking.  Just taking lruvec
      lock first may be undermined by the page's memcg charge/migration.  To
      fix this problem, we could take out the page's lru bit clear and use it
      as pin down action to block the memcg changes.  That's the reason for
      new atomic func TestClearPageLRU.  So now isolating a page need both
      actions: TestClearPageLRU and hold the lru_lock.
      
      The typical usage of this is isolate_migratepages_block() in
      compaction.c we have to take lru bit before lru lock, that serialized
      the page isolation in memcg page charge/migration which will change
      page's lruvec and new lru_lock in it.
      
      The above solution suggested by Johannes Weiner, and based on his new
      memcg charge path, then have this patchset.  (Hugh Dickins tested and
      contributed much code from compaction fix to general code polish, thanks
      a lot!).
      
      Daniel Jordan's testing show 62% improvement on modified readtwice case
      on his 2P * 10 core * 2 HT broadwell box on v18, which has no much
      different with this v20.
      
       https://lore.kernel.org/lkml/20200915165807.kpp7uhiw7l3loofu@ca-dmjordan1.us.oracle.com/
      
      Thanks to Hugh Dickins and Konstantin Khlebnikov, they both brought this
      idea 8 years ago, and others who gave comments as well: Daniel Jordan,
      Mel Gorman, Shakeel Butt, Matthew Wilcox, Alexander Duyck etc.
      
      Thanks for Testing support from Intel 0day and Rong Chen, Fengguang Wu,
      and Yun Wang.  Hugh Dickins also shared his kbuild-swap case.
      
      This patch (of 19):
      
      lru_add_page_tail() is only used in huge_memory.c, defining it in other
      file with a CONFIG_TRANSPARENT_HUGEPAGE macro restrict just looks weird.
      
      Let's move it THP. And make it static as Hugh Dickins suggested.
      
      Link: https://lkml.kernel.org/r/1604566549-62481-1-git-send-email-alex.shi@linux.alibaba.com
      Link: https://lkml.kernel.org/r/1604566549-62481-2-git-send-email-alex.shi@linux.alibaba.comSigned-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Reviewed-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Wei Yang <richard.weiyang@gmail.com>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: "Chen, Rong A" <rong.a.chen@intel.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: "Huang, Ying" <ying.huang@intel.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Mika Penttilä <mika.penttila@nextfour.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Yang Shi <yang.shi@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      88dcb9a3
    • Linus Torvalds's avatar
      Merge tag 'staging-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 3db1a3fa
      Linus Torvalds authored
      Pull staging / IIO driver updates from Greg KH:
       "Here is the big staging and IIO driver pull request for 5.11-rc1
      
        Lots of different things in here:
      
         - loads of driver updates
      
         - so many coding style cleanups
      
         - new IIO drivers
      
         - Android ION code is finally removed from the tree
      
         - wimax drivers are moved to staging on their way out of the kernel
      
        Nothing really exciting, just the constant grind of kernel development :)
      
        All have been in linux-next for a while with no reported issues"
      
      * tag 'staging-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (341 commits)
        staging: olpc_dcon: Do not call platform_device_unregister() in dcon_probe()
        staging: most: Fix spelling mistake "tranceiver" -> "transceiver"
        staging: qlge: remove duplicate word in comment
        staging: comedi: mf6x4: Fix AI end-of-conversion detection
        staging: greybus: Add TODO item about modernizing the pwm code
        pinctrl: ralink: add a pinctrl driver for the rt2880 family
        dt-bindings: pinctrl: rt2880: add binding document
        staging: rtl8723bs: remove ELEMENT_ID enum
        staging: rtl8723bs: remove unused macros
        staging: rtl8723bs: replace EID_EXTCapability
        staging: rtl8723bs: replace EID_BSSIntolerantChlReport
        staging: rtl8723bs: replace EID_BSSCoexistence
        staging: rtl8723bs: replace _MME_IE_
        staging: rtl8723bs: replace _WAPI_IE_
        staging: rtl8723bs: replace _EXT_SUPPORTEDRATES_IE_
        staging: rtl8723bs: replace _ERPINFO_IE_
        staging: rtl8723bs: replace _CHLGETXT_IE_
        staging: rtl8723bs: replace _COUNTRY_IE_
        staging: rtl8723bs: replace _IBSS_PARA_IE_
        staging: rtl8723bs: replace _TIM_IE_
        ...
      3db1a3fa
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 2911ed9f
      Linus Torvalds authored
      Pull char / misc driver updates from Greg KH:
       "Here is the big char/misc driver update for 5.11-rc1.
      
        Continuing the tradition of previous -rc1 pulls, there seems to be
        more and more tiny driver subsystems flowing through this tree.
      
        Lots of different things, all of which have been in linux-next for a
        while with no reported issues:
      
         - extcon driver updates
      
         - habannalab driver updates
      
         - mei driver updates
      
         - uio driver updates
      
         - binder fixes and features added
      
         - soundwire driver updates
      
         - mhi bus driver updates
      
         - phy driver updates
      
         - coresight driver updates
      
         - fpga driver updates
      
         - speakup driver updates
      
         - slimbus driver updates
      
         - various small char and misc driver updates"
      
      * tag 'char-misc-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (305 commits)
        extcon: max77693: Fix modalias string
        extcon: fsa9480: Support TI TSU6111 variant
        extcon: fsa9480: Rewrite bindings in YAML and extend
        dt-bindings: extcon: add binding for TUSB320
        extcon: Add driver for TI TUSB320
        slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew()
        siox: Make remove callback return void
        siox: Use bus_type functions for probe, remove and shutdown
        spmi: Add driver shutdown support
        spmi: fix some coding style issues at the spmi core
        spmi: get rid of a warning when built with W=1
        uio: uio_hv_generic: use devm_kzalloc() for private data alloc
        uio: uio_fsl_elbc_gpcm: use device-managed allocators
        uio: uio_aec: use devm_kzalloc() for uio_info object
        uio: uio_cif: use devm_kzalloc() for uio_info object
        uio: uio_netx: use devm_kzalloc() for or uio_info object
        uio: uio_mf624: use devm_kzalloc() for uio_info object
        uio: uio_sercos3: use device-managed functions for simple allocs
        uio: uio_dmem_genirq: finalize conversion of probe to devm_ handlers
        uio: uio_dmem_genirq: convert simple allocations to device-managed
        ...
      2911ed9f
    • Linus Torvalds's avatar
      Merge tag 'driver-core-5.11-rc1' of... · 7240153a
      Linus Torvalds authored
      Merge tag 'driver-core-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
      
      Pull driver core updates from Greg KH:
       "Here is the big driver core updates for 5.11-rc1
      
        This time there was a lot of different work happening here for some
        reason:
      
         - redo of the fwnode link logic, speeding it up greatly
      
         - auxiliary bus added (this was a tag that will be pulled in from
           other trees/maintainers this merge window as well, as driver
           subsystems started to rely on it)
      
         - platform driver core cleanups on the way to fixing some long-time
           api updates in future releases
      
         - minor fixes and tweaks.
      
        All have been in linux-next with no (finally) reported issues. Testing
        there did helped in shaking issues out a lot :)"
      
      * tag 'driver-core-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (39 commits)
        driver core: platform: don't oops in platform_shutdown() on unbound devices
        ACPI: Use fwnode_init() to set up fwnode
        misc: pvpanic: Replace OF headers by mod_devicetable.h
        misc: pvpanic: Combine ACPI and platform drivers
        usb: host: sl811: Switch to use platform_get_mem_or_io()
        vfio: platform: Switch to use platform_get_mem_or_io()
        driver core: platform: Introduce platform_get_mem_or_io()
        dyndbg: fix use before null check
        soc: fix comment for freeing soc_dev_attr
        driver core: platform: use bus_type functions
        driver core: platform: change logic implementing platform_driver_probe
        driver core: platform: reorder functions
        driver core: make driver_probe_device() static
        driver core: Fix a couple of typos
        driver core: Reorder devices on successful probe
        driver core: Delete pointless parameter in fwnode_operations.add_links
        driver core: Refactor fw_devlink feature
        efi: Update implementation of add_links() to create fwnode links
        of: property: Update implementation of add_links() to create fwnode links
        driver core: Use device's fwnode to check if it is waiting for suppliers
        ...
      7240153a
    • Linus Torvalds's avatar
      Merge tag 'tty-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 157f8098
      Linus Torvalds authored
      Pull tty / serial updates from Greg KH:
       "Here is the "large" set of tty and serial patches for 5.11-rc1.
      
        Nothing major at all, some cleanups and some driver removals, always a
        nice sign:
      
         - build warning cleanups
      
         - vt locking and logic unwinding and cleanups
      
         - tiny serial driver fixes and updates
      
         - removal of the synclink serial driver as it's no longer needed
      
         - removal of dead termiox code
      
        All of this has been in linux-next for a while with no reported issues"
      
      * tag 'tty-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (89 commits)
        serial: 8250_pci: Drop bogus __refdata annotation
        tty: serial: meson: enable console as module
        serial: 8250_omap: Avoid FIFO corruption caused by MDR1 access
        serial: imx: Move imx_uart_probe_dt() content into probe()
        serial: imx: Remove unneeded of_device_get_match_data() NULL check
        tty: Fix whitespace inconsistencies in vt_io_ioctl
        serial_core: Check for port state when tty is in error state
        dt-bindings: serial: Update DT binding docs to support SiFive FU740 SoC
        tty: use const parameters in port-flag accessors
        tty: use assign_bit() in port-flag accessors
        earlycon: drop semicolon from earlycon macro
        tty: Remove dead termiox code
        tty/serial/imx: Enable TXEN bit in imx_poll_init().
        tty : serial: jsm: Fixed file by adding spacing
        tty: serial: uartlite: Support probe deferral
        earlycon: simplify earlycon-table implementation
        tty: serial: bcm63xx: lower driver dependencies
        serial: mxs-auart: Remove unneeded platform_device_id
        serial: 8250-mtk: Fix reference leak in mtk8250_probe
        serial: imx: Remove unused .id_table support
        ...
      157f8098
    • Linus Torvalds's avatar
      Merge tag 'usb-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 0cee54c8
      Linus Torvalds authored
      Pull USB / Thunderbolt updates from Greg KH:
       "Here is the big USB and thunderbolt pull request for 5.11-rc1.
      
        Nothing major in here, just the grind of constant development to
        support new hardware and fix old issues:
      
         - thunderbolt updates for new USB4 hardware
      
         - cdns3 major driver updates
      
         - lots of typec updates and additions as more hardware is available
      
         - usb serial driver updates and fixes
      
         - other tiny USB driver updates
      
        All have been in linux-next with no reported issues"
      
      * tag 'usb-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (172 commits)
        usb: phy: convert comma to semicolon
        usb: ucsi: convert comma to semicolon
        usb: typec: tcpm: convert comma to semicolon
        usb: typec: tcpm: Update vbus_vsafe0v on init
        usb: typec: tcpci: Enable bleed discharge when auto discharge is enabled
        usb: typec: Add class for plug alt mode device
        USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition
        USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP
        USB: typec: tcpm: Fix PR_SWAP error handling
        USB: typec: tcpm: Hard Reset after not receiving a Request
        USB: gadget: f_fs: remove likely/unlikely
        usb: gadget: f_fs: Re-use SS descriptors for SuperSpeedPlus
        USB: gadget: f_midi: setup SuperSpeed Plus descriptors
        USB: gadget: f_acm: add support for SuperSpeed Plus
        USB: gadget: f_rndis: fix bitrate for SuperSpeed and above
        usb: typec: intel_pmc_mux: Configure cable generation value for USB4
        MAINTAINERS: Add myself as a reviewer for CADENCE USB3 DRD IP DRIVER
        usb: chipidea: ci_hdrc_imx: Use of_device_get_match_data()
        usb: chipidea: usbmisc_imx: Use of_device_get_match_data()
        usb: cdns3: fix NULL pointer dereference on no platform data
        ...
      0cee54c8
    • Linus Torvalds's avatar
      Merge tag 'sound-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · c367caf1
      Linus Torvalds authored
      Pull sound updates from Takashi Iwai:
       "Lots of changes (slightly more code increase than usual) at this time,
        while most of code changes are ASoC driver-specific.
      
        Here are some highlights:
      
        Core:
      
         - The new auxiliary bus implementation for Intel DSP, which will be
           used by other drivers as well
      
         - Lots of ASoC core cleanups and refactoring
      
         - UBSAN and KCSAN fixes in rawmidi, sequencer and a few others
      
         - Compress-offload API enhancement for the pause during draining
      
        HD- and USB-audio:
      
         - Enhancements of the USB-audio implicit feedback support, including
           better full-duplex operations
      
         - Continued CA0132 improvements and fixes
      
         - A few new quirk entries, HDMI audio fixes
      
        ASoC:
      
         - Support for boot time selection of Intel DSP firmware, which should
           help distros/users testing new stuff more easily; the kconfig was
           moved to boot time option, too
      
         - Some basic DPCM support in audio graph card
      
         - Removal of old pre-DT Freescale drivers
      
         - Support for Allwinner H6 I2S, Analog Devices ADAU1372, Intel
           Alderlake-S, GMediatek MT8192, NXP i.MX HDMI and XCVR, Realtek
           RT715, Qualcomm SM8250 and simple GPIO based muxes"
      
      * tag 'sound-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (445 commits)
        ALSA: pcm: oss: Fix potential out-of-bounds shift
        ALSA: usb-audio: Fix potential out-of-bounds shift
        ALSA: hda/ca0132 - Add ZxR surround DAC setup.
        ALSA: hda/ca0132 - Add 8051 PLL write helper functions.
        ALSA: hda/hdmi: packet buffer index must be set before reading value
        ASoC: SOF: imx: update kernel-doc description
        ASoC: mediatek: mt8183: delete some unreachable code
        ASoC: mediatek: mt8183: add PM ops to machine drivers
        ASoC: topology: Fix wrong size check
        ASoC: topology: Add missing size check
        ASoC: SOF: Intel: hda: fix the condition passed to sof_dev_dbg_or_err
        ASoC: SOF: modify the SOF_DBG flags
        ASoC: SOF: Intel: hda: remove duplicated status dump
        ASoC: rt1015p: delay 300ms after SDB pulling high for calibration
        ASoC: rt1015p: move SDB control from trigger to DAPM
        ASoC: wm_adsp: remove "ctl" from list on error in wm_adsp_create_control()
        ALSA: usb-audio: Fix control 'access overflow' errors from chmap
        ALSA: hda/hdmi: always print pin NIDs as hexadecimal
        ALSA: hda/realtek - Add supported for more Lenovo ALC285 Headset Button
        ALSA: hda/ca0132 - Remove now unnecessary DSP setup functions.
        ...
      c367caf1
    • Linus Torvalds's avatar
      Merge tag 'net-next-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next · d635a69d
      Linus Torvalds authored
      Pull networking updates from Jakub Kicinski:
       "Core:
      
         - support "prefer busy polling" NAPI operation mode, where we defer
           softirq for some time expecting applications to periodically busy
           poll
      
         - AF_XDP: improve efficiency by more batching and hindering the
           adjacency cache prefetcher
      
         - af_packet: make packet_fanout.arr size configurable up to 64K
      
         - tcp: optimize TCP zero copy receive in presence of partial or
           unaligned reads making zero copy a performance win for much smaller
           messages
      
         - XDP: add bulk APIs for returning / freeing frames
      
         - sched: support fragmenting IP packets as they come out of conntrack
      
         - net: allow virtual netdevs to forward UDP L4 and fraglist GSO skbs
      
        BPF:
      
         - BPF switch from crude rlimit-based to memcg-based memory accounting
      
         - BPF type format information for kernel modules and related tracing
           enhancements
      
         - BPF implement task local storage for BPF LSM
      
         - allow the FENTRY/FEXIT/RAW_TP tracing programs to use
           bpf_sk_storage
      
        Protocols:
      
         - mptcp: improve multiple xmit streams support, memory accounting and
           many smaller improvements
      
         - TLS: support CHACHA20-POLY1305 cipher
      
         - seg6: add support for SRv6 End.DT4/DT6 behavior
      
         - sctp: Implement RFC 6951: UDP Encapsulation of SCTP
      
         - ppp_generic: add ability to bridge channels directly
      
         - bridge: Connectivity Fault Management (CFM) support as is defined
           in IEEE 802.1Q section 12.14.
      
        Drivers:
      
         - mlx5: make use of the new auxiliary bus to organize the driver
           internals
      
         - mlx5: more accurate port TX timestamping support
      
         - mlxsw:
            - improve the efficiency of offloaded next hop updates by using
              the new nexthop object API
            - support blackhole nexthops
            - support IEEE 802.1ad (Q-in-Q) bridging
      
         - rtw88: major bluetooth co-existance improvements
      
         - iwlwifi: support new 6 GHz frequency band
      
         - ath11k: Fast Initial Link Setup (FILS)
      
         - mt7915: dual band concurrent (DBDC) support
      
         - net: ipa: add basic support for IPA v4.5
      
        Refactor:
      
         - a few pieces of in_interrupt() cleanup work from Sebastian Andrzej
           Siewior
      
         - phy: add support for shared interrupts; get rid of multiple driver
           APIs and have the drivers write a full IRQ handler, slight growth
           of driver code should be compensated by the simpler API which also
           allows shared IRQs
      
         - add common code for handling netdev per-cpu counters
      
         - move TX packet re-allocation from Ethernet switch tag drivers to a
           central place
      
         - improve efficiency and rename nla_strlcpy
      
         - number of W=1 warning cleanups as we now catch those in a patchwork
           build bot
      
        Old code removal:
      
         - wan: delete the DLCI / SDLA drivers
      
         - wimax: move to staging
      
         - wifi: remove old WDS wifi bridging support"
      
      * tag 'net-next-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (1922 commits)
        net: hns3: fix expression that is currently always true
        net: fix proc_fs init handling in af_packet and tls
        nfc: pn533: convert comma to semicolon
        af_vsock: Assign the vsock transport considering the vsock address flags
        af_vsock: Set VMADDR_FLAG_TO_HOST flag on the receive path
        vsock_addr: Check for supported flag values
        vm_sockets: Add VMADDR_FLAG_TO_HOST vsock flag
        vm_sockets: Add flags field in the vsock address data structure
        net: Disable NETIF_F_HW_TLS_TX when HW_CSUM is disabled
        tcp: Add logic to check for SYN w/ data in tcp_simple_retransmit
        net: mscc: ocelot: install MAC addresses in .ndo_set_rx_mode from process context
        nfc: s3fwrn5: Release the nfc firmware
        net: vxget: clean up sparse warnings
        mlxsw: spectrum_router: Use eXtended mezzanine to offload IPv4 router
        mlxsw: spectrum: Set KVH XLT cache mode for Spectrum2/3
        mlxsw: spectrum_router_xm: Introduce basic XM cache flushing
        mlxsw: reg: Add Router LPM Cache Enable Register
        mlxsw: reg: Add Router LPM Cache ML Delete Register
        mlxsw: spectrum_router_xm: Implement L-value tracking for M-index
        mlxsw: reg: Add XM Router M Table Register
        ...
      d635a69d
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · ac73e3dc
      Linus Torvalds authored
      Merge misc updates from Andrew Morton:
      
       - a few random little subsystems
      
       - almost all of the MM patches which are staged ahead of linux-next
         material. I'll trickle to post-linux-next work in as the dependents
         get merged up.
      
      Subsystems affected by this patch series: kthread, kbuild, ide, ntfs,
      ocfs2, arch, and mm (slab-generic, slab, slub, dax, debug, pagecache,
      gup, swap, shmem, memcg, pagemap, mremap, hmm, vmalloc, documentation,
      kasan, pagealloc, memory-failure, hugetlb, vmscan, z3fold, compaction,
      oom-kill, migration, cma, page-poison, userfaultfd, zswap, zsmalloc,
      uaccess, zram, and cleanups).
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (200 commits)
        mm: cleanup kstrto*() usage
        mm: fix fall-through warnings for Clang
        mm: slub: convert sysfs sprintf family to sysfs_emit/sysfs_emit_at
        mm: shmem: convert shmem_enabled_show to use sysfs_emit_at
        mm:backing-dev: use sysfs_emit in macro defining functions
        mm: huge_memory: convert remaining use of sprintf to sysfs_emit and neatening
        mm: use sysfs_emit for struct kobject * uses
        mm: fix kernel-doc markups
        zram: break the strict dependency from lzo
        zram: add stat to gather incompressible pages since zram set up
        zram: support page writeback
        mm/process_vm_access: remove redundant initialization of iov_r
        mm/zsmalloc.c: rework the list_add code in insert_zspage()
        mm/zswap: move to use crypto_acomp API for hardware acceleration
        mm/zswap: fix passing zero to 'PTR_ERR' warning
        mm/zswap: make struct kernel_param_ops definitions const
        userfaultfd/selftests: hint the test runner on required privilege
        userfaultfd/selftests: fix retval check for userfaultfd_open()
        userfaultfd/selftests: always dump something in modes
        userfaultfd: selftests: make __{s,u}64 format specifiers portable
        ...
      ac73e3dc
    • Alexey Dobriyan's avatar
      mm: cleanup kstrto*() usage · dfefd226
      Alexey Dobriyan authored
      Range checks can folded into proper conversion function.  kstrto*() exist
      for all arithmetic types.
      
      Link: https://lkml.kernel.org/r/20201122123759.GC92364@localhost.localdomainSigned-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dfefd226
    • Gustavo A. R. Silva's avatar
      mm: fix fall-through warnings for Clang · 01359eb2
      Gustavo A. R. Silva authored
      In preparation to enable -Wimplicit-fallthrough for Clang, fix a couple of
      warnings by explicitly adding a break statement instead of just letting
      the code fall through to the next, and by adding a fallthrough
      pseudo-keyword in places where the code is intended to fall through.
      
      Link: https://github.com/KSPP/linux/issues/115
      Link: https://lkml.kernel.org/r/f5756988b8842a3f10008fbc5b0a654f828920a9.1605896059.git.gustavoars@kernel.orgSigned-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      01359eb2
    • Joe Perches's avatar
      mm: slub: convert sysfs sprintf family to sysfs_emit/sysfs_emit_at · bf16d19a
      Joe Perches authored
      Convert the unbounded uses of sprintf to sysfs_emit.
      
      A few conversions may now not end in a newline if the output buffer is
      overflowed.
      
      Link: https://lkml.kernel.org/r/0c90a90f466167f8c37de4b737553cf49c4a277f.1605376435.git.joe@perches.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bf16d19a
    • Joe Perches's avatar
      mm: shmem: convert shmem_enabled_show to use sysfs_emit_at · 79d4d38a
      Joe Perches authored
      Update the function to use sysfs_emit_at while neatening the uses of
      sprintf and overwriting the last space char with a newline to avoid
      possible output buffer overflow.
      
      Miscellanea:
      
       - in shmem_enabled_show, the removal of the indirected use of fmt
         allows __printf verification
      
      Link: https://lkml.kernel.org/r/b612a93825e5ea330cb68d2e8b516e9687a06cc6.1605376435.git.joe@perches.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      79d4d38a
    • Joe Perches's avatar
      mm:backing-dev: use sysfs_emit in macro defining functions · 5e4c0d86
      Joe Perches authored
      The cocci script used in commit bdacbb8d04f ("mm: Use sysfs_emit for
      struct kobject * uses") does not convert the name##_show macro because the
      macro uses concatenation via ##.
      
      Convert it by hand.
      
      Link: https://lkml.kernel.org/r/45ec6cfc177d743f9c0ebaf35e43969dce43af42.1605376435.git.joe@perches.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5e4c0d86
    • Joe Perches's avatar
      mm: huge_memory: convert remaining use of sprintf to sysfs_emit and neatening · bfb0ffeb
      Joe Perches authored
      Convert the only use of sprintf with struct kobject * that the cocci
      script could not convert.
      
      Miscellanea:
      
       - Neaten the uses of a constant string with sysfs_emit to use a const
         char * to reduce overall object size
      
      Link: https://lkml.kernel.org/r/7df6be66bbd68e1a0bca9d35aca1341dbf94d2a7.1605376435.git.joe@perches.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bfb0ffeb
    • Joe Perches's avatar
      mm: use sysfs_emit for struct kobject * uses · ae7a927d
      Joe Perches authored
      Patch series "mm: Convert sysfs sprintf family to sysfs_emit", v2.
      
      Use the new sysfs_emit family and not the sprintf family.
      
      This patch (of 5):
      
      Use the sysfs_emit function instead of the sprintf family.
      
      Done with cocci script as in commit 3c6bff3c ("RDMA: Convert sysfs
      kobject * show functions to use sysfs_emit()")
      
      Link: https://lkml.kernel.org/r/cover.1605376435.git.joe@perches.com
      Link: https://lkml.kernel.org/r/9c249215bad6df616ba0410ad980042694970c1b.1605376435.git.joe@perches.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ae7a927d
    • Mauro Carvalho Chehab's avatar
      mm: fix kernel-doc markups · a00cda3f
      Mauro Carvalho Chehab authored
      Kernel-doc markups should use this format:
              identifier - description
      
      Fix some issues on mm files:
      
      1) The definition for get_user_pages_locked() doesn't follow it.  Also,
         it expects a short descrpition at the header, followed by a long one,
         after the parameters.  Fix it.
      
      2) Kernel-doc requires that a kernel-doc markup to be immediately below
         the function prototype, as otherwise it will rename it.  So, move
         get_pfnblock_flags_mask() description to the right place.
      
      3) Make invalidate_mapping_pagevec() to also follow the expected
         kernel-doc format.
      
      While here, fix a few minor English syntax issues, as suggested
      by Matthew:
      	will used -> will be used
      	similar with -> similar to
      
      Link: https://lkml.kernel.org/r/80e85dddc92d333bc2159ee8a2294921612e8745.1605521731.git.mchehab+huawei@kernel.orgSigned-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Suggested-by: Mattew Wilcox <willy@infradead.org>	[English fixes]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a00cda3f
    • Rui Salvaterra's avatar
      zram: break the strict dependency from lzo · 3d711a38
      Rui Salvaterra authored
      From the beginning, the zram block device always enabled CRYPTO_LZO,
      since lzo-rle is hardcoded as the fallback compression algorithm.  As a
      consequence, on systems where another compression algorithm is chosen
      (e.g.  CRYPTO_ZSTD), the lzo kernel module becomes unused, while still
      having to be built/loaded.
      
      This patch removes the hardcoded lzo-rle dependency and allows the user
      to select the default compression algorithm for zram at build time.  The
      previous behaviour is kept, as the default algorithm is still lzo-rle.
      
      Link: https://lkml.kernel.org/r/20201207121245.50529-1-rsalvaterra@gmail.comSigned-off-by: default avatarRui Salvaterra <rsalvaterra@gmail.com>
      Suggested-by: default avatarSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Suggested-by: default avatarMinchan Kim <minchan@kernel.org>
      Acked-by: default avatarMinchan Kim <minchan@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3d711a38
    • Minchan Kim's avatar
      zram: add stat to gather incompressible pages since zram set up · 194e28da
      Minchan Kim authored
      Currently, zram supports the stat via /sys/block/zram/mm_stat to represent
      how many of incompressible pages are stored at the moment but it couldn't
      show how many times incompressible pages were wrote down since zram set
      up.  It's also good indication to see how zram is effective in the system.
      
      Link: https://lkml.kernel.org/r/20201130201907.1284910-1-minchan@kernel.orgSigned-off-by: default avatarMinchan Kim <minchan@kernel.org>
      Reviewed-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      194e28da
    • Minchan Kim's avatar
      zram: support page writeback · 0d835962
      Minchan Kim authored
      There is demand to writeback specific process pages to backing store
      instead of all idles pages in the system due to storage wear out concerns
      and to launching latency of apps which are most of the time idle but are
      critical for resume latency.
      
      This patch extends the writeback knob to support a specific page
      writeback.
      
      Link: https://lkml.kernel.org/r/20201020190506.3758660-1-minchan@kernel.orgSigned-off-by: default avatarMinchan Kim <minchan@kernel.org>
      Reviewed-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0d835962