Skip to content
  1. Jan 16, 2016
    • Kirill A. Shutemov's avatar
      thp, mlock: do not allow huge pages in mlocked area · 7479df6d
      Kirill A. Shutemov authored
      
      
      With new refcounting THP can belong to several VMAs.  This makes tricky
      to track THP pages, when they partially mlocked.  It can lead to leaking
      mlocked pages to non-VM_LOCKED vmas and other problems.
      
      With this patch we will split all pages on mlock and avoid
      fault-in/collapse new THP in VM_LOCKED vmas.
      
      I've tried alternative approach: do not mark THP pages mlocked and keep
      them on normal LRUs.  This way vmscan could try to split huge pages on
      memory pressure and free up subpages which doesn't belong to VM_LOCKED
      vmas.  But this is user-visible change: we screw up Mlocked accouting
      reported in meminfo, so I had to leave this approach aside.
      
      We can bring something better later, but this should be good enough for
      now.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Tested-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7479df6d
    • Kirill A. Shutemov's avatar
      mm: handle PTE-mapped tail pages in gerneric fast gup implementaiton · 7aef4172
      Kirill A. Shutemov authored
      
      
      With new refcounting we are going to see THP tail pages mapped with PTE.
      Generic fast GUP rely on page_cache_get_speculative() to obtain
      reference on page.  page_cache_get_speculative() always fails on tail
      pages, because ->_count on tail pages is always zero.
      
      Let's handle tail pages in gup_pte_range().
      
      New split_huge_page() will rely on migration entries to freeze page's
      counts.  Recheck PTE value after page_cache_get_speculative() on head
      page should be enough to serialize against split.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Tested-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7aef4172
    • Kirill A. Shutemov's avatar
      mm: adjust FOLL_SPLIT for new refcounting · 6742d293
      Kirill A. Shutemov authored
      
      
      We need to prepare kernel to allow transhuge pages to be mapped with
      ptes too.  We need to handle FOLL_SPLIT in follow_page_pte().
      
      Also we use split_huge_page() directly instead of split_huge_page_pmd().
      split_huge_page_pmd() will gone.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Tested-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6742d293
    • Kirill A. Shutemov's avatar
      mm, thp: adjust conditions when we can reuse the page on WP fault · 1f25fe20
      Kirill A. Shutemov authored
      
      
      With new refcounting we will be able map the same compound page with
      PTEs and PMDs.  It requires adjustment to conditions when we can reuse
      the page on write-protection fault.
      
      For PTE fault we can't reuse the page if it's part of huge page.
      
      For PMD we can only reuse the page if nobody else maps the huge page or
      it's part.  We can do it by checking page_mapcount() on each sub-page,
      but it's expensive.
      
      The cheaper way is to check page_count() to be equal 1: every mapcount
      takes page reference, so this way we can guarantee, that the PMD is the
      only mapping.
      
      This approach can give false negative if somebody pinned the page, but
      that doesn't affect correctness.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Tested-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1f25fe20
    • Kirill A. Shutemov's avatar
      memcg: adjust to support new THP refcounting · f627c2f5
      Kirill A. Shutemov authored
      
      
      As with rmap, with new refcounting we cannot rely on PageTransHuge() to
      check if we need to charge size of huge page form the cgroup.  We need
      to get information from caller to know whether it was mapped with PMD or
      PTE.
      
      We do uncharge when last reference on the page gone.  At that point if
      we see PageTransHuge() it means we need to unchange whole huge page.
      
      The tricky part is partial unmap -- when we try to unmap part of huge
      page.  We don't do a special handing of this situation, meaning we don't
      uncharge the part of huge page unless last user is gone or
      split_huge_page() is triggered.  In case of cgroup memory pressure
      happens the partial unmapped page will be split through shrinker.  This
      should be good enough.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Tested-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f627c2f5
    • Kirill A. Shutemov's avatar
      rmap: add argument to charge compound page · d281ee61
      Kirill A. Shutemov authored
      
      
      We're going to allow mapping of individual 4k pages of THP compound
      page.  It means we cannot rely on PageTransHuge() check to decide if
      map/unmap small page or THP.
      
      The patch adds new argument to rmap functions to indicate whether we
      want to operate on whole compound page or only the small page.
      
      [n-horiguchi@ah.jp.nec.com: fix mapcount mismatch in hugepage migration]
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Tested-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d281ee61
    • Kirill A. Shutemov's avatar
      mm, proc: adjust PSS calculation · afd9883f
      Kirill A. Shutemov authored
      
      
      The goal of this patchset is to make refcounting on THP pages cheaper
      with simpler semantics and allow the same THP compound page to be mapped
      with PMD and PTEs.  This is required to get reasonable THP-pagecache
      implementation.
      
      With the new refcounting design it's much easier to protect against
      split_huge_page(): simple reference on a page will make you the deal.
      It makes gup_fast() implementation simpler and doesn't require
      special-case in futex code to handle tail THP pages.
      
      It should improve THP utilization over the system since splitting THP in
      one process doesn't necessary lead to splitting the page in all other
      processes have the page mapped.
      
      The patchset drastically lower complexity of get_page()/put_page()
      codepaths.  I encourage people look on this code before-and-after to
      justify time budget on reviewing this patchset.
      
      This patch (of 37):
      
      With new refcounting all subpages of the compound page are not necessary
      have the same mapcount.  We need to take into account mapcount of every
      sub-page.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Tested-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      afd9883f
    • Kirill A. Shutemov's avatar
    • Kirill A. Shutemov's avatar
      mm: sanitize page->mapping for tail pages · 1c290f64
      Kirill A. Shutemov authored
      
      
      We don't define meaning of page->mapping for tail pages.  Currently it's
      always NULL, which can be inconsistent with head page and potentially
      lead to problems.
      
      Let's poison the pointer to catch all illigal uses.
      
      page_rmapping(), page_mapping() and page_anon_vma() are changed to look
      on head page.
      
      The only illegal use I've caught so far is __GPF_COMP pages from sound
      subsystem, mapped with PTEs.  do_shared_fault() is changed to use
      page_rmapping() instead of direct access to fault_page->mapping.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Reviewed-by: default avatarJérôme Glisse <jglisse@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1c290f64
    • Kirill A. Shutemov's avatar
      page-flags: look at head page if the flag is encoded in page->mapping · 822cdd11
      Kirill A. Shutemov authored
      
      
      PageAnon() and PageKsm() look at lower bits of page->mapping to check if
      the page is Anon or KSM.  page->mapping can be overloaded in tail pages.
      
      Let's always look at head page to avoid false-positives.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      822cdd11
    • Kirill A. Shutemov's avatar
      page-flags: define PG_uptodate behavior on compound pages · d2998c4d
      Kirill A. Shutemov authored
      
      
      We use PG_uptodate on head pages on transparent huge page.  Let's use
      PF_NO_TAIL.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d2998c4d
    • Kirill A. Shutemov's avatar
      page-flags: define PG_uncached behavior on compound pages · b9d41817
      Kirill A. Shutemov authored
      
      
      So far, only IA64 uses PG_uncached and only on non-compound pages.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b9d41817
    • Kirill A. Shutemov's avatar
      page-flags: define PG_mlocked behavior on compound pages · e4f87d5d
      Kirill A. Shutemov authored
      
      
      Transparent huge pages can be mlocked -- whole compund page at once.
      Something went wrong if we're trying to mlock() tail page.  Let's use
      PF_NO_TAIL.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e4f87d5d
    • Kirill A. Shutemov's avatar
      page-flags: define PG_swapcache behavior on compound pages · 50ea78d6
      Kirill A. Shutemov authored
      
      
      Swap cannot handle compound pages so far.  Transparent huge pages are
      split on the way to swap.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      50ea78d6
    • Kirill A. Shutemov's avatar
      page-flags: define PG_swapbacked behavior on compound pages · da5efc40
      Kirill A. Shutemov authored
      
      
      PG_swapbacked is used for transparent huge pages.  For head pages only.
      Let's use PF_NO_TAIL policy.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      da5efc40
    • Kirill A. Shutemov's avatar
      page-flags: define PG_reserved behavior on compound pages · de09d31d
      Kirill A. Shutemov authored
      
      
      As far as I can see there's no users of PG_reserved on compound pages.
      Let's use PF_NO_COMPOUND here.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      de09d31d
    • Kirill A. Shutemov's avatar
      page-flags: define behavior of Xen-related flags on compound pages · c13985fa
      Kirill A. Shutemov authored
      
      
      PG_pinned and PG_savepinned are about page table's pages which are never
      compound.
      
      I'm not so sure about PG_foreign, but it seems we shouldn't see compound
      pages there too.
      
      Let's use PF_NO_COMPOUND for all of them.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c13985fa
    • Kirill A. Shutemov's avatar
      page-flags: define behavior SL*B-related flags on compound pages · dcb351cd
      Kirill A. Shutemov authored
      
      
      SL*B uses compound pages and marks head pages with PG_slab.
      __SetPageSlab() and __ClearPageSlab() are never called for tail pages.
      
      The same situation with PG_slob_free in SLOB allocator.
      
      PF_NO_TAIL is appropriate for these flags.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dcb351cd
    • Kirill A. Shutemov's avatar
      page-flags: define behavior of LRU-related flags on compound pages · 8cb38fab
      Kirill A. Shutemov authored
      
      
      Only head pages are ever on LRU.  Let's use PF_HEAD policy to avoid any
      confusion for all LRU-related flags.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8cb38fab
    • Kirill A. Shutemov's avatar
      page-flags: define behavior of FS/IO-related flags on compound pages · df8c94d1
      Kirill A. Shutemov authored
      
      
      It seems we don't have compound page on FS/IO path currently.  Use
      PF_NO_COMPOUND to catch if we have.
      
      The odd exception is PG_dirty: sound uses compound pages and maps them
      with PTEs.  PF_NO_COMPOUND triggers VM_BUG_ON() in set_page_dirty() on
      handling shared fault.  Let's use PF_HEAD for PG_dirty.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      df8c94d1
    • Kirill A. Shutemov's avatar
      page-flags: define PG_locked behavior on compound pages · 48c935ad
      Kirill A. Shutemov authored
      
      
      lock_page() must operate on the whole compound page.  It doesn't make
      much sense to lock part of compound page.  Change code to use head
      page's PG_locked, if tail page is passed.
      
      This patch also gets rid of custom helper functions --
      __set_page_locked() and __clear_page_locked().  They are replaced with
      helpers generated by __SETPAGEFLAG/__CLEARPAGEFLAG.  Tail pages to these
      helper would trigger VM_BUG_ON().
      
      SLUB uses PG_locked as a bit spin locked.  IIUC, tail pages should never
      appear there.  VM_BUG_ON() is added to make sure that this assumption is
      correct.
      
      [akpm@linux-foundation.org: fix fs/cifs/file.c]
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      48c935ad
    • Kirill A. Shutemov's avatar
      page-flags: introduce page flags policies wrt compound pages · 95ad9755
      Kirill A. Shutemov authored
      
      
      This patch adds a third argument to macros which create function
      definitions for page flags.  This argument defines how page-flags
      helpers behave on compound functions.
      
      For now we define four policies:
      
       - PF_ANY: the helper function operates on the page it gets, regardless
         if it's non-compound, head or tail.
      
       - PF_HEAD: the helper function operates on the head page of the
         compound page if it gets tail page.
      
       - PF_NO_TAIL: only head and non-compond pages are acceptable for this
         helper function.
      
       - PF_NO_COMPOUND: only non-compound pages are acceptable for this
         helper function.
      
      For now we use policy PF_ANY for all helpers, which matches current
      behaviour.
      
      We do not enforce the policy for TESTPAGEFLAG, because we have flags
      checked for random pages all over the kernel.  Noticeable exception to
      this is PageTransHuge() which triggers VM_BUG_ON() for tail page.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      95ad9755
    • Kirill A. Shutemov's avatar
      page-flags: move code around · 0e6d31a7
      Kirill A. Shutemov authored
      
      
      The preparation patch: we are going to use compound_head(), PageTail()
      and PageCompound() to define page-flags helpers.
      
      Let's define them before macros.
      
      We cannot user PageHead() helper in PageCompound() as it's not yet
      defined -- use test_bit(PG_head, &page->flags) instead.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0e6d31a7
    • Kirill A. Shutemov's avatar
      page-flags: trivial cleanup for PageTrans* helpers · d8c1bdeb
      Kirill A. Shutemov authored
      
      
      Use TESTPAGEFLAG_FALSE() to get it a bit cleaner.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Steve Capper <steve.capper@linaro.org>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d8c1bdeb
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 4e5448a3
      Linus Torvalds authored
      Pull networking fixes from David Miller:
       "A quick set of bug fixes after there initial networking merge:
      
        1) Netlink multicast group storage allocator only was tested with
           nr_groups equal to 1, make it work for other values too.  From
           Matti Vaittinen.
      
        2) Check build_skb() return value in macb and hip04_eth drivers, from
           Weidong Wang.
      
        3) Don't leak x25_asy on x25_asy_open() failure.
      
        4) More DMA map/unmap fixes in 3c59x from Neil Horman.
      
        5) Don't clobber IP skb control block during GSO segmentation, from
           Konstantin Khlebnikov.
      
        6) ECN helpers for ipv6 don't fixup the checksum, from Eric Dumazet.
      
        7) Fix SKB segment utilization estimation in xen-netback, from David
           Vrabel.
      
        8) Fix lockdep splat in bridge addrlist handling, from Nikolay
           Aleksandrov"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (26 commits)
        bgmac: Fix reversed test of build_skb() return value.
        bridge: fix lockdep addr_list_lock false positive splat
        net: smsc: Add support h8300
        xen-netback: free queues after freeing the net device
        xen-netback: delete NAPI instance when queue fails to initialize
        xen-netback: use skb to determine number of required guest Rx requests
        net: sctp: Move sequence start handling into sctp_transport_get_idx()
        ipv6: update skb->csum when CE mark is propagated
        net: phy: turn carrier off on phy attach
        net: macb: clear interrupts when disabling them
        sctp: support to lookup with ep+paddr in transport rhashtable
        net: hns: fixes no syscon error when init mdio
        dts: hisi: fixes no syscon fault when init mdio
        net: preserve IP control block during GSO segmentation
        fsl/fman: Delete one function call "put_device" in dtsec_config()
        hip04_eth: fix missing error handle for build_skb failed
        3c59x: fix another page map/single unmap imbalance
        3c59x: balance page maps and unmaps
        x25_asy: Free x25_asy on x25_asy_open() failure.
        mlxsw: fix SWITCHDEV_OBJ_ID_PORT_MDB
        ...
      4e5448a3
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc · 5a18d263
      Linus Torvalds authored
      Pull sparc fixes from David Miller:
       "Two sparc bug fixes"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
        sparc64: Fix numa node distance initialization
        sparc64: fix incorrect sign extension in sys_sparc64_personality
      5a18d263
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · f689b742
      Linus Torvalds authored
      Pull powerpc updates from Michael Ellerman:
       "Core:
         - Ground work for the new Power9 MMU from Aneesh Kumar K.V
         - Optimise FP/VMX/VSX context switching from Anton Blanchard
      
        Misc:
         - Various cleanups from Krzysztof Kozlowski, John Ogness, Rashmica
           Gupta, Russell Currey, Gavin Shan, Daniel Axtens, Michael Neuling,
           Andrew Donnellan
         - Allow wrapper to work on non-english system from Laurent Vivier
         - Add rN aliases to the pt_regs_offset table from Rashmica Gupta
         - Fix module autoload for rackmeter & axonram drivers from Luis de
           Bethencourt
         - Include KVM guest test in all interrupt vectors from Paul Mackerras
         - Fix DSCR inheritance over fork() from Anton Blanchard
         - Make value-returning atomics & {cmp}xchg* & their atomic_ versions
           fully ordered from Boqun Feng
         - Print MSR TM bits in oops messages from Michael Neuling
         - Add TM signal return & invalid stack selftests from Michael Neuling
         - Limit EPOW reset event warnings from Vipin K Parashar
         - Remove the Cell QPACE code from Rashmica Gupta
         - Append linux_banner to exception information in xmon from Rashmica
           Gupta
         - Add selftest to check if VSRs are corrupted from Rashmica Gupta
         - Remove broken GregorianDay() from Daniel Axtens
         - Import Anton's context_switch2 benchmark into selftests from
           Michael Ellerman
         - Add selftest script to test HMI functionality from Daniel Axtens
         - Remove obsolete OPAL v2 support from Stewart Smith
         - Make enter_rtas() private from Michael Ellerman
         - PPR exception cleanups from Michael Ellerman
         - Add page soft dirty tracking from Laurent Dufour
         - Add support for Nvlink NPUs from Alistair Popple
         - Add support for kexec on 476fpe from Alistair Popple
         - Enable kernel CPU dlpar from sysfs from Nathan Fontenot
         - Copy only required pieces of the mm_context_t to the paca from
           Michael Neuling
         - Add a kmsg_dumper that flushes OPAL console output on panic from
           Russell Currey
         - Implement save_stack_trace_regs() to enable kprobe stack tracing
           from Steven Rostedt
         - Add HWCAP bits for Power9 from Michael Ellerman
         - Fix _PAGE_PTE breaking swapoff from Aneesh Kumar K.V
         - Fix _PAGE_SWP_SOFT_DIRTY breaking swapoff from Hugh Dickins
         - scripts/recordmcount.pl: support data in text section on powerpc
           from Ulrich Weigand
         - Handle R_PPC64_ENTRY relocations in modules from Ulrich Weigand
      
        cxl:
         - cxl: Fix possible idr warning when contexts are released from
           Vaibhav Jain
         - cxl: use correct operator when writing pcie config space values
           from Andrew Donnellan
         - cxl: Fix DSI misses when the context owning task exits from Vaibhav
           Jain
         - cxl: fix build for GCC 4.6.x from Brian Norris
         - cxl: use -Werror only with CONFIG_PPC_WERROR from Brian Norris
         - cxl: Enable PCI device ID for future IBM CXL adapter from Uma
           Krishnan
      
        Freescale:
         - Freescale updates from Scott: Highlights include moving QE code out
           of arch/powerpc (to be shared with arm), device tree updates, and
           minor fixes"
      
      * tag 'powerpc-4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (149 commits)
        powerpc/module: Handle R_PPC64_ENTRY relocations
        scripts/recordmcount.pl: support data in text section on powerpc
        powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages
        powerpc/mm: fix _PAGE_SWP_SOFT_DIRTY breaking swapoff
        powerpc/mm: Fix _PAGE_PTE breaking swapoff
        cxl: Enable PCI device ID for future IBM CXL adapter
        cxl: use -Werror only with CONFIG_PPC_WERROR
        cxl: fix build for GCC 4.6.x
        powerpc: Add HWCAP bits for Power9
        powerpc/powernv: Reserve PE#0 on NPU
        powerpc/powernv: Change NPU PE# assignment
        powerpc/powernv: Fix update of NVLink DMA mask
        powerpc/powernv: Remove misleading comment in pci.c
        powerpc: Implement save_stack_trace_regs() to enable kprobe stack tracing
        powerpc: Fix build break due to paca mm_context_t changes
        cxl: Fix DSI misses when the context owning task exits
        MAINTAINERS: Update Scott Wood's e-mail address
        powerpc/powernv: Fix minor off-by-one error in opal_mce_check_early_recovery()
        powerpc: Fix style of self-test config prompts
        powerpc/powernv: Only delay opal_rtc_read() retry when necessary
        ...
      f689b742
    • David S. Miller's avatar
      bgmac: Fix reversed test of build_skb() return value. · 750afbf8
      David S. Miller authored
      Fixes: f1640c3d
      
       ("bgmac: fix a missing check for build_skb")
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      750afbf8
    • Linus Torvalds's avatar
      Merge tag 'vfio-v4.5-rc1' of git://github.com/awilliam/linux-vfio · 37cea93b
      Linus Torvalds authored
      Pull VFIO updates from Alex Williamson:
      
       - Fixes in AMD xgbe reset, spapr structure padding, type 1 flags (Dan
         Carpenter, Alexey Kardashevskiy, Pierre Morel)
      
       - Re-introduce no-iommu mode, with a user this time (Alex Williamson)
      
      * tag 'vfio-v4.5-rc1' of git://github.com/awilliam/linux-vfio:
        vfio/iommu_type1: make use of info.flags
        vfio: Include No-IOMMU mode
        vfio: Add explicit alignments in vfio_iommu_spapr_tce_create
        VFIO: platform: reset: fix a warning message condition
      37cea93b
    • Linus Torvalds's avatar
      Merge tag 'nfsd-4.5' of git://linux-nfs.org/~bfields/linux · cc80fe0e
      Linus Torvalds authored
      Pull nfsd updates from Bruce Fields:
       "Smaller bugfixes and cleanup, including a fix for a failures of
        kerberized NFSv4.1 mounts, and Scott Mayhew's work addressing ACK
        storms that can affect some high-availability NFS setups"
      
      * tag 'nfsd-4.5' of git://linux-nfs.org/~bfields/linux:
        nfsd: add new io class tracepoint
        nfsd: give up on CB_LAYOUTRECALLs after two lease periods
        nfsd: Fix nfsd leaks sunrpc module references
        lockd: constify nlmsvc_binding structure
        lockd: use to_delayed_work
        nfsd: use to_delayed_work
        Revert "svcrdma: Do not send XDR roundup bytes for a write chunk"
        lockd: Register callbacks on the inetaddr_chain and inet6addr_chain
        nfsd: Register callbacks on the inetaddr_chain and inet6addr_chain
        sunrpc: Add a function to close temporary transports immediately
        nfsd: don't base cl_cb_status on stale information
        nfsd4: fix gss-proxy 4.1 mounts for some AD principals
        nfsd: fix unlikely NULL deref in mach_creds_match
        nfsd: minor consolidation of mach_cred handling code
        nfsd: helper for dup of possibly NULL string
        svcrpc: move some initialization to common code
        nfsd: fix a warning message
        nfsd: constify nfsd4_callback_ops structure
        nfsd: recover: constify nfsd4_client_tracking_ops structures
        svcrdma: Do not send XDR roundup bytes for a write chunk
      cc80fe0e
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · c7b6c5fe
      Linus Torvalds authored
      Pull vfs regression fix from Al Viro:
       "Fix for braino introduced in vfs.git#work.misc"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        amdkfd: Copy from the proper user command pointer
      c7b6c5fe
    • Nikolay Aleksandrov's avatar
      bridge: fix lockdep addr_list_lock false positive splat · c6894dec
      Nikolay Aleksandrov authored
      After promisc mode management was introduced a bridge device could do
      dev_set_promiscuity from its ndo_change_rx_flags() callback which in
      turn can be called after the bridge's addr_list_lock has been taken
      (e.g. by dev_uc_add). This causes a false positive lockdep splat because
      the port interfaces' addr_list_lock is taken when br_manage_promisc()
      runs after the bridge's addr list lock was already taken.
      To remove the false positive introduce a custom bridge addr_list_lock
      class and set it on bridge init.
      A simple way to reproduce this is with the following:
      $ brctl addbr br0
      $ ip l add l br0 br0.100 type vlan id 100
      $ ip l set br0 up
      $ ip l set br0.100 up
      $ echo 1 > /sys/class/net/br0/bridge/vlan_filtering
      $ brctl addif br0 eth0
      Splat:
      [   43.684325] =============================================
      [   43.684485] [ INFO: possible recursive locking detected ]
      [   43.684636] 4.4.0-rc8+ #54 Not tainted
      [   43.684755] ---------------------------------------------
      [   43.684906] brctl/1187 is trying to acquire lock:
      [   43.685047]  (_xmit_ETHER){+.....}, at: [<ffffffff8150169e>] dev_set_rx_mode+0x1e/0x40
      [   43.685460]  but task is already holding lock:
      [   43.685618]  (_xmit_ETHER){+.....}, at: [<ffffffff815072a7>] dev_uc_add+0x27/0x80
      [   43.686015]  other info that might help us debug this:
      [   43.686316]  Possible unsafe locking scenario:
      
      [   43.686743]        CPU0
      [   43.686967]        ----
      [   43.687197]   lock(_xmit_ETHER);
      [   43.687544]   lock(_xmit_ETHER);
      [   43.687886] *** DEADLOCK ***
      
      [   43.688438]  May be due to missing lock nesting notation
      
      [   43.688882] 2 locks held by brctl/1187:
      [   43.689134]  #0:  (rtnl_mutex){+.+.+.}, at: [<ffffffff81510317>] rtnl_lock+0x17/0x20
      [   43.689852]  #1:  (_xmit_ETHER){+.....}, at: [<ffffffff815072a7>] dev_uc_add+0x27/0x80
      [   43.690575] stack backtrace:
      [   43.690970] CPU: 0 PID: 1187 Comm: brctl Not tainted 4.4.0-rc8+ #54
      [   43.691270] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.8.1-20150318_183358- 04/01/2014
      [   43.691770]  ffffffff826a25c0 ffff8800369fb8e0 ffffffff81360ceb ffffffff826a25c0
      [   43.692425]  ffff8800369fb9b8 ffffffff810d0466 ffff8800369fb968 ffffffff81537139
      [   43.693071]  ffff88003a08c880 0000000000000000 00000000ffffffff 0000000002080020
      [   43.693709] Call Trace:
      [   43.693931]  [<ffffffff81360ceb>] dump_stack+0x4b/0x70
      [   43.694199]  [<ffffffff810d0466>] __lock_acquire+0x1e46/0x1e90
      [   43.694483]  [<ffffffff81537139>] ? netlink_broadcast_filtered+0x139/0x3e0
      [   43.694789]  [<ffffffff8153b5da>] ? nlmsg_notify+0x5a/0xc0
      [   43.695064]  [<ffffffff810d10f5>] lock_acquire+0xe5/0x1f0
      [   43.695340]  [<ffffffff8150169e>] ? dev_set_rx_mode+0x1e/0x40
      [   43.695623]  [<ffffffff815edea5>] _raw_spin_lock_bh+0x45/0x80
      [   43.695901]  [<ffffffff8150169e>] ? dev_set_rx_mode+0x1e/0x40
      [   43.696180]  [<ffffffff8150169e>] dev_set_rx_mode+0x1e/0x40
      [   43.696460]  [<ffffffff8150189c>] dev_set_promiscuity+0x3c/0x50
      [   43.696750]  [<ffffffffa0586845>] br_port_set_promisc+0x25/0x50 [bridge]
      [   43.697052]  [<ffffffffa05869aa>] br_manage_promisc+0x8a/0xe0 [bridge]
      [   43.697348]  [<ffffffffa05826ee>] br_dev_change_rx_flags+0x1e/0x20 [bridge]
      [   43.697655]  [<ffffffff81501532>] __dev_set_promiscuity+0x132/0x1f0
      [   43.697943]  [<ffffffff81501672>] __dev_set_rx_mode+0x82/0x90
      [   43.698223]  [<ffffffff815072de>] dev_uc_add+0x5e/0x80
      [   43.698498]  [<ffffffffa05b3c62>] vlan_device_event+0x542/0x650 [8021q]
      [   43.698798]  [<ffffffff8109886d>] notifier_call_chain+0x5d/0x80
      [   43.699083]  [<ffffffff810988b6>] raw_notifier_call_chain+0x16/0x20
      [   43.699374]  [<ffffffff814f456e>] call_netdevice_notifiers_info+0x6e/0x80
      [   43.699678]  [<ffffffff814f4596>] call_netdevice_notifiers+0x16/0x20
      [   43.699973]  [<ffffffffa05872be>] br_add_if+0x47e/0x4c0 [bridge]
      [   43.700259]  [<ffffffffa058801e>] add_del_if+0x6e/0x80 [bridge]
      [   43.700548]  [<ffffffffa0588b5f>] br_dev_ioctl+0xaf/0xc0 [bridge]
      [   43.700836]  [<ffffffff8151a7ac>] dev_ifsioc+0x30c/0x3c0
      [   43.701106]  [<ffffffff8151aac9>] dev_ioctl+0xf9/0x6f0
      [   43.701379]  [<ffffffff81254345>] ? mntput_no_expire+0x5/0x450
      [   43.701665]  [<ffffffff812543ee>] ? mntput_no_expire+0xae/0x450
      [   43.701947]  [<ffffffff814d7b02>] sock_do_ioctl+0x42/0x50
      [   43.702219]  [<ffffffff814d8175>] sock_ioctl+0x1e5/0x290
      [   43.702500]  [<ffffffff81242d0b>] do_vfs_ioctl+0x2cb/0x5c0
      [   43.702771]  [<ffffffff81243079>] SyS_ioctl+0x79/0x90
      [   43.703033]  [<ffffffff815eebb6>] entry_SYSCALL_64_fastpath+0x16/0x7a
      
      CC: Vlad Yasevich <vyasevic@redhat.com>
      CC: Stephen Hemminger <stephen@networkplumber.org>
      CC: Bridge list <bridge@lists.linux-foundation.org>
      CC: Andy Gospodarek <gospo@cumulusnetworks.com>
      CC: Roopa Prabhu <roopa@cumulusnetworks.com>
      Fixes: 2796d0c6
      
       ("bridge: Automatically manage port promiscuous mode.")
      Reported-by: default avatarAndy Gospodarek <gospo@cumulusnetworks.com>
      Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c6894dec
    • Linus Torvalds's avatar
      Merge tag 'md/4.5' of git://neil.brown.name/md · 3c28c9cc
      Linus Torvalds authored
      Pull md updates from Neil Brown:
       "Mostly clustered-raid1 and raid5 journal updates.  one Y2038 fix and
        other minor stuff.
      
        One patch removes me from the MAINTAINERS file and adds a record of my
        md maintainership to Credits"
      
      Many thanks to Neil, who has been around for a _looong_ time.
      
      * tag 'md/4.5' of git://neil.brown.name/md: (26 commits)
        md/raid: only permit hot-add of compatible integrity profiles
        Remove myself as MD Maintainer, and add to Credits.
        raid5-cache: handle journal hotadd in quiesce
        MD: add journal with array suspended
        md: set MD_HAS_JOURNAL in correct places
        md: Remove 'ready' field from mddev.
        md: remove unnecesary md_new_event_inintr
        raid5: allow r5l_io_unit allocations to fail
        raid5-cache: use a mempool for the metadata block
        raid5-cache: use a bio_set
        raid5-cache: add journal hot add/remove support
        drivers: md: use ktime_get_real_seconds()
        md: avoid warning for 32-bit sector_t
        raid5-cache: free meta_page earlier
        raid5-cache: simplify r5l_move_io_unit_list
        md: update comment for md_allow_write
        md-cluster: update comments for MD_CLUSTER_SEND_LOCKED_ALREADY
        md-cluster: Protect communication with mutexes
        md-cluster: Defer MD reloading to mddev->thread
        md-cluster: update the documentation
        ...
      3c28c9cc
    • Linus Torvalds's avatar
      Merge tag 'regulator-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator · 4b43ea2a
      Linus Torvalds authored
      Pull regulator updates from Mark Brown:
       "Aside from a fix for a spurious warning (which caused more problems
        than it fixed in the fixing really) this is all driver updates,
        including new drivers for Dialog PV88060/90 and TI LM363x and TPS65086
        devices.  The qcom_smd driver has had PM8916 and PMA8084 support
        added"
      
      * tag 'regulator-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (36 commits)
        regulator: core: remove some dead code
        regulator: core: use dev_to_rdev
        regulator: lp872x: Get rid of duplicate reference to DVS GPIO
        regulator: lp872x: Add missing of_match in regulators descriptions
        regulator: axp20x: Fix GPIO LDO enable value for AXP22x
        regulator: lp8788: constify regulator_ops structures
        regulator: wm8*: constify regulator_ops structures
        regulator: da9*: constify regulator_ops structures
        regulator: mt6311: Use REGCACHE_RBTREE
        regulator: tps65917/palmas: Add bypass ops for LDOs with bypass capability
        regulator: qcom-smd: Add support for PMA8084
        regulator: qcom-smd: Add PM8916 support
        soc: qcom: documentation: Update SMD/RPM Docs
        regulator: pv88090: logical vs bitwise AND typo
        regulator: pv88090: Fix irq leak
        regulator: pv88090: new regulator driver
        regulator: wm831x-ldo: Use platform_register/unregister_drivers()
        regulator: wm831x-dcdc: Use platform_register/unregister_drivers()
        regulator: lp8788-ldo: Use platform_register/unregister_drivers()
        regulator: core: Fix nested locking of supplies
        ...
      4b43ea2a
    • Yoshinori Sato's avatar
      net: smsc: Add support h8300 · f147d0b3
      Yoshinori Sato authored
      
      
      Add H8/300 platform support for smc91x
      
      Signed-off-by: default avatarYoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f147d0b3
    • Borislav Petkov's avatar
      amdkfd: Copy from the proper user command pointer · 39c01bf9
      Borislav Petkov authored
      8f1d57c1
      
       ("amdkfd: don't open-code memdup_user()") mistakenly uses
      an uninitialized local pointer, gcc complains:
      
        drivers/gpu/drm/amd/amdkfd/kfd_chardev.c: In function ‘kfd_ioctl_dbg_address_watch’:
        drivers/gpu/drm/amd/amdkfd/kfd_chardev.c:562:12: warning: ‘args_buff’ may be used uninitialized in this function [-Wmaybe-uninitialized]
          args_buff = memdup_user(args_buff,
                      ^
      
      Fix it.
      
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      39c01bf9
    • Linus Torvalds's avatar
      Merge branch 'mailbox-for-next' of git://git.linaro.org/landing-teams/working/fujitsu/integration · 7aca74e7
      Linus Torvalds authored
      Pull mailbox fixlet from Jussi Brar.
      
      * 'mailbox-for-next' of git://git.linaro.org/landing-teams/working/fujitsu/integration:
        mailbox: constify mbox_chan_ops structure
      7aca74e7
    • David S. Miller's avatar
      Merge branch 'xen-netback-fixes' · 973365dc
      David S. Miller authored
      
      
      David Vrabel says:
      
      ====================
      xen-netback: use skb to determine number of required (etc.)
      
      "xen-netback: use skb to determine number of required" plus two other
      minor fixes I found down the back of the sofa.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      973365dc
    • David Vrabel's avatar
      xen-netback: free queues after freeing the net device · 9c6f3ffe
      David Vrabel authored
      
      
      If a queue still has a NAPI instance added to the net device, freeing
      the queues early results in a use-after-free.
      
      The shouldn't ever happen because we disconnect and tear down all queues
      before freeing the net device, but doing this makes it obviously safe.
      
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9c6f3ffe
    • David Vrabel's avatar
      xen-netback: delete NAPI instance when queue fails to initialize · 4a658527
      David Vrabel authored
      
      
      When xenvif_connect() fails it may leave a stale NAPI instance added to
      the device.  Make sure we delete it in the error path.
      
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4a658527