1. 28 Mar, 2018 4 commits
    • Steven J. Hill's avatar
      mm/vmstat.c: fix vmstat_update() preemption BUG · c7f26ccf
      Steven J. Hill authored
      Attempting to hotplug CPUs with CONFIG_VM_EVENT_COUNTERS enabled can
      cause vmstat_update() to report a BUG due to preemption not being
      disabled around smp_processor_id().
      
      Discovered on Ubiquiti EdgeRouter Pro with Cavium Octeon II processor.
      
        BUG: using smp_processor_id() in preemptible [00000000] code:
        kworker/1:1/269
        caller is vmstat_update+0x50/0xa0
        CPU: 0 PID: 269 Comm: kworker/1:1 Not tainted
        4.16.0-rc4-Cavium-Octeon-00009-gf83bbd5-dirty #1
        Workqueue: mm_percpu_wq vmstat_update
        Call Trace:
          show_stack+0x94/0x128
          dump_stack+0xa4/0xe0
          check_preemption_disabled+0x118/0x120
          vmstat_update+0x50/0xa0
          process_one_work+0x144/0x348
          worker_thread+0x150/0x4b8
          kthread+0x110/0x140
          ret_from_kernel_thread+0x14/0x1c
      
      Link: http://lkml.kernel.org/r/1520881552-25659-1-git-send-email-steven.hill@cavium.comSigned-off-by: default avatarSteven J. Hill <steven.hill@cavium.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Tejun Heo <htejun@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c7f26ccf
    • Maninder Singh's avatar
      mm/page_owner: fix recursion bug after changing skip entries · 299815a4
      Maninder Singh authored
      This patch fixes commit 5f48f0bd ("mm, page_owner: skip unnecessary
      stack_trace entries").
      
      Because if we skip first two entries then logic of checking count value
      as 2 for recursion is broken and code will go in one depth recursion.
      
      so we need to check only one call of _RET_IP(__set_page_owner) while
      checking for recursion.
      
      Current Backtrace while checking for recursion:-
      
        (save_stack)             from (__set_page_owner)  // (But recursion returns true here)
        (__set_page_owner)       from (get_page_from_freelist)
        (get_page_from_freelist) from (__alloc_pages_nodemask)
        (__alloc_pages_nodemask) from (depot_save_stack)
        (depot_save_stack)       from (save_stack)       // recursion should return true here
        (save_stack)             from (__set_page_owner)
        (__set_page_owner)       from (get_page_from_freelist)
        (get_page_from_freelist) from (__alloc_pages_nodemask+)
        (__alloc_pages_nodemask) from (depot_save_stack)
        (depot_save_stack)       from (save_stack)
        (save_stack)             from (__set_page_owner)
        (__set_page_owner)       from (get_page_from_freelist)
      
      Correct Backtrace with fix:
      
        (save_stack)             from (__set_page_owner) // recursion returned true here
        (__set_page_owner)       from (get_page_from_freelist)
        (get_page_from_freelist) from (__alloc_pages_nodemask+)
        (__alloc_pages_nodemask) from (depot_save_stack)
        (depot_save_stack)       from (save_stack)
        (save_stack)             from (__set_page_owner)
        (__set_page_owner)       from (get_page_from_freelist)
      
      Link: http://lkml.kernel.org/r/1521607043-34670-1-git-send-email-maninder1.s@samsung.com
      Fixes: 5f48f0bd ("mm, page_owner: skip unnecessary stack_trace entries")
      Signed-off-by: default avatarManinder Singh <maninder1.s@samsung.com>
      Signed-off-by: default avatarVaneet Narang <v.narang@samsung.com>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Oscar Salvador <osalvador@techadventures.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ayush Mittal <ayush.m@samsung.com>
      Cc: Prakash Gupta <guptap@codeaurora.org>
      Cc: Vinayak Menon <vinmenon@codeaurora.org>
      Cc: Vasyl Gomonovych <gomonovych@gmail.com>
      Cc: Amit Sahrawat <a.sahrawat@samsung.com>
      Cc: <pankaj.m@samsung.com>
      Cc: Vaneet Narang <v.narang@samsung.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      299815a4
    • Mike Kravetz's avatar
      ipc/shm.c: add split function to shm_vm_ops · 3d942ee0
      Mike Kravetz authored
      If System V shmget/shmat operations are used to create a hugetlbfs
      backed mapping, it is possible to munmap part of the mapping and split
      the underlying vma such that it is not huge page aligned.  This will
      untimately result in the following BUG:
      
        kernel BUG at /build/linux-jWa1Fv/linux-4.15.0/mm/hugetlb.c:3310!
        Oops: Exception in kernel mode, sig: 5 [#1]
        LE SMP NR_CPUS=2048 NUMA PowerNV
        Modules linked in: kcm nfc af_alg caif_socket caif phonet fcrypt
        CPU: 18 PID: 43243 Comm: trinity-subchil Tainted: G         C  E 4.15.0-10-generic #11-Ubuntu
        NIP:  c00000000036e764 LR: c00000000036ee48 CTR: 0000000000000009
        REGS: c000003fbcdcf810 TRAP: 0700   Tainted: G         C  E (4.15.0-10-generic)
        MSR:  9000000000029033 <SF,HV,EE,ME,IR,DR,RI,LE>  CR: 24002222  XER: 20040000
        CFAR: c00000000036ee44 SOFTE: 1
        NIP __unmap_hugepage_range+0xa4/0x760
        LR __unmap_hugepage_range_final+0x28/0x50
        Call Trace:
          0x7115e4e00000 (unreliable)
          __unmap_hugepage_range_final+0x28/0x50
          unmap_single_vma+0x11c/0x190
          unmap_vmas+0x94/0x140
          exit_mmap+0x9c/0x1d0
          mmput+0xa8/0x1d0
          do_exit+0x360/0xc80
          do_group_exit+0x60/0x100
          SyS_exit_group+0x24/0x30
          system_call+0x58/0x6c
        ---[ end trace ee88f958a1c62605 ]---
      
      This bug was introduced by commit 31383c68 ("mm, hugetlbfs:
      introduce ->split() to vm_operations_struct").  A split function was
      added to vm_operations_struct to determine if a mapping can be split.
      This was mostly for device-dax and hugetlbfs mappings which have
      specific alignment constraints.
      
      Mappings initiated via shmget/shmat have their original vm_ops
      overwritten with shm_vm_ops.  shm_vm_ops functions will call back to the
      original vm_ops if needed.  Add such a split function to shm_vm_ops.
      
      Link: http://lkml.kernel.org/r/20180321161314.7711-1-mike.kravetz@oracle.com
      Fixes: 31383c68 ("mm, hugetlbfs: introduce ->split() to vm_operations_struct")
      Signed-off-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Reported-by: default avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
      Reviewed-by: default avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
      Tested-by: default avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
      Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3d942ee0
    • Shakeel Butt's avatar
      mm, slab: memcg_link the SLAB's kmem_cache · 880cd276
      Shakeel Butt authored
      All the root caches are linked into slab_root_caches which was
      introduced by the commit 510ded33 ("slab: implement slab_root_caches
      list") but it missed to add the SLAB's kmem_cache.
      
      While experimenting with opt-in/opt-out kmem accounting, I noticed
      system crashes due to NULL dereference inside cache_from_memcg_idx()
      while deferencing kmem_cache.memcg_params.memcg_caches.  The upstream
      clean kernel will not see these crashes but SLAB should be consistent
      with SLUB which does linked its boot caches (kmem_cache_node and
      kmem_cache) into slab_root_caches.
      
      Link: http://lkml.kernel.org/r/20180319210020.60289-1-shakeelb@google.com
      Fixes: 510ded33 ("slab: implement slab_root_caches list")
      Signed-off-by: default avatarShakeel Butt <shakeelb@google.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
      Cc: Greg Thelen <gthelen@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: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      880cd276
  2. 25 Mar, 2018 10 commits
  3. 24 Mar, 2018 1 commit
  4. 23 Mar, 2018 25 commits