1. 21 Nov, 2022 4 commits
    • Vlastimil Babka's avatar
      Merge branch 'slab/for-6.2/cleanups' into slab/for-next · 4b28ba9e
      Vlastimil Babka authored
      - Removal of dead code from deactivate_slab() by Hyeonggon Yoo.
      - Fix of BUILD_BUG_ON() for sufficient early percpu size by Baoquan He.
      - Make kmem_cache_alloc() kernel-doc less misleading, by myself.
      4b28ba9e
    • Vlastimil Babka's avatar
      mm/slab: move and adjust kernel-doc for kmem_cache_alloc · 838de63b
      Vlastimil Babka authored
      Alexander reports an issue with the kmem_cache_alloc() comment in
      mm/slab.c:
      
      > The current comment mentioned that the flags only matters if the
      > cache has no available objects. It's different for the __GFP_ZERO
      > flag which will ensure that the returned object is always zeroed
      > in any case.
      
      > I have the feeling I run into this question already two times if
      > the user need to zero the object or not, but the user does not need
      > to zero the object afterwards. However another use of __GFP_ZERO
      > and only zero the object if the cache has no available objects would
      > also make no sense.
      
      and suggests thus mentioning __GFP_ZERO as the exception. But on closer
      inspection, the part about flags being only relevant if cache has no
      available objects is misleading. The slab user has no reliable way to
      determine if there are available objects, and e.g. the might_sleep()
      debug check can be performed even if objects are available, so passing
      correct flags given the allocation context always matters.
      
      Thus remove that sentence completely, and while at it, move the comment
      to from SLAB-specific mm/slab.c to the common include/linux/slab.h
      The comment otherwise refers flags description for kmalloc(), so add
      __GFP_ZERO comment there and remove a very misleading GFP_HIGHUSER
      (not applicable to slab) description from there. Mention kzalloc() and
      kmem_cache_zalloc() shortcuts.
      Reported-by: default avatarAlexander Aring <aahringo@redhat.com>
      Link: https://lore.kernel.org/all/20221011145413.8025-1-aahringo@redhat.com/Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      838de63b
    • Baoquan He's avatar
      mm/slub, percpu: correct the calculation of early percpu allocation size · a0dc161a
      Baoquan He authored
      SLUB allocator relies on percpu allocator to initialize its ->cpu_slab
      during early boot. For that, the dynamic chunk of percpu which serves
      the early allocation need be large enough to satisfy the kmalloc
      creation.
      
      However, the current BUILD_BUG_ON() in alloc_kmem_cache_cpus() doesn't
      consider the kmalloc array with NR_KMALLOC_TYPES length. Fix that
      with correct calculation.
      Signed-off-by: default avatarBaoquan He <bhe@redhat.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: Andrew Morton <akpm@linux-foundation.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Roman Gushchin <roman.gushchin@linux.dev>
      Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
      Acked-by: default avatarHyeonggon Yoo <42.hyeyoo@gmail.com>
      Acked-by: default avatarDennis Zhou <dennis@kernel.org>
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      a0dc161a
    • Baoquan He's avatar
      percpu: adjust the value of PERCPU_DYNAMIC_EARLY_SIZE · e8753e41
      Baoquan He authored
      LKP reported a build failure as below on the following patch "mm/slub,
      percpu: correct the calculation of early percpu allocation size"
      
      ~~~~~~
      In file included from <command-line>:
      In function 'alloc_kmem_cache_cpus',
         inlined from 'kmem_cache_open' at mm/slub.c:4340:6:
      >> >> include/linux/compiler_types.h:357:45: error: call to '__compiletime_assert_474' declared with attribute error:
      BUILD_BUG_ON failed: PERCPU_DYNAMIC_EARLY_SIZE < NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu)
           357 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      ~~~~~~
      
      From the kernel config file provided by LKP, the building was made on
      arm64 with below Kconfig item enabled:
      
        CONFIG_ZONE_DMA=y
        CONFIG_SLUB_CPU_PARTIAL=y
        CONFIG_DEBUG_LOCK_ALLOC=y
        CONFIG_SLUB_STATS=y
        CONFIG_ARM64_PAGE_SHIFT=16
        CONFIG_ARM64_64K_PAGES=y
      
      Then we will have:
        NR_KMALLOC_TYPES:4
        KMALLOC_SHIFT_HIGH:17
        sizeof(struct kmem_cache_cpu):184
      
      The product of them is 12512, which is bigger than PERCPU_DYNAMIC_EARLY_SIZE,
      12K. Hence, the BUILD_BUG_ON in alloc_kmem_cache_cpus() is triggered.
      
      Earlier, in commit 099a19d9 ("percpu: allow limited allocation
      before slab is online"), PERCPU_DYNAMIC_EARLY_SIZE was introduced and
      set to 12K which is equal to the then PERPCU_DYNAMIC_RESERVE.
      Later, in commit 1a4d7607 ("percpu: implement asynchronous chunk
      population"), PERPCU_DYNAMIC_RESERVE was increased by 8K, while
      PERCPU_DYNAMIC_EARLY_SIZE was kept unchanged.
      
      So, here increase PERCPU_DYNAMIC_EARLY_SIZE by 8K too to accommodate to
      the slub's requirement.
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarBaoquan He <bhe@redhat.com>
      Acked-by: default avatarDennis Zhou <dennis@kernel.org>
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      e8753e41
  2. 07 Nov, 2022 1 commit
  3. 06 Nov, 2022 1 commit
    • Kees Cook's avatar
      mm/slab_common: Restore passing "caller" for tracing · 32868715
      Kees Cook authored
      The "caller" argument was accidentally being ignored in a few places
      that were recently refactored. Restore these "caller" arguments, instead
      of _RET_IP_.
      
      Fixes: 11e9734b ("mm/slab_common: unify NUMA and UMA version of tracepoints")
      Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      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: Andrew Morton <akpm@linux-foundation.org>
      Cc: Roman Gushchin <roman.gushchin@linux.dev>
      Cc: linux-mm@kvack.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Acked-by: default avatarHyeonggon Yoo <42.hyeyoo@gmail.com>
      Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
      32868715
  4. 04 Nov, 2022 1 commit
  5. 03 Nov, 2022 1 commit
  6. 24 Oct, 2022 1 commit
  7. 23 Oct, 2022 9 commits
  8. 22 Oct, 2022 21 commits
  9. 21 Oct, 2022 1 commit
    • Linus Torvalds's avatar
      Merge tag '6.1-rc1-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · bd8e9634
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
      
       - memory leak fixes
      
       - fixes for directory leases, including an important one which fixes a
         problem noticed by git functional tests
      
       - fixes relating to missing free_xid calls (helpful for
         tracing/debugging of entry/exit into cifs.ko)
      
       - a multichannel fix
      
       - a small cleanup fix (use of list_move instead of list_del/list_add)
      
      * tag '6.1-rc1-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: update internal module number
        cifs: fix memory leaks in session setup
        cifs: drop the lease for cached directories on rmdir or rename
        smb3: interface count displayed incorrectly
        cifs: Fix memory leak when build ntlmssp negotiate blob failed
        cifs: set rc to -ENOENT if we can not get a dentry for the cached dir
        cifs: use LIST_HEAD() and list_move() to simplify code
        cifs: Fix xid leak in cifs_get_file_info_unix()
        cifs: Fix xid leak in cifs_ses_add_channel()
        cifs: Fix xid leak in cifs_flock()
        cifs: Fix xid leak in cifs_copy_file_range()
        cifs: Fix xid leak in cifs_create()
      bd8e9634