[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202210221729.zoXTFhHD-lkp@intel.com>
Date: Sat, 22 Oct 2022 18:00:00 +0800
From: kernel test robot <lkp@...el.com>
To: Jiri Kosina <jikos@...nel.org>,
Christoph Lameter <cl@...ux-foundation.org>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Hyeonggon Yoo <42.hyeyoo@...il.com>
Cc: kbuild-all@...ts.01.org,
Linux Memory Management List <linux-mm@...ck.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mm/slab: Annotate kmem_cache_node->list_lock as raw
Hi Jiri,
I love your patch! Yet something to improve:
[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on v6.1-rc1 next-20221021]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/UPDATE-20221022-031645/Jiri-Kosina/mm-slab-Annotate-kmem_cache_node-list_lock-as-raw/20221021-225037
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/nycvar.YFH.7.76.2210212114480.29912%40cbobk.fhfr.pm
patch subject: [PATCH v2] mm/slab: Annotate kmem_cache_node->list_lock as raw
config: x86_64-rhel-8.3-func
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/87acd941576d0867488b675c1fe0d35ffd4d4541
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review UPDATE-20221022-031645/Jiri-Kosina/mm-slab-Annotate-kmem_cache_node-list_lock-as-raw/20221021-225037
git checkout 87acd941576d0867488b675c1fe0d35ffd4d4541
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
mm/slub.c: In function 'alloc_single_from_new_slab':
>> mm/slub.c:2124:27: error: passing argument 1 of 'spinlock_check' from incompatible pointer type [-Werror=incompatible-pointer-types]
2124 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
include/linux/spinlock.h:243:48: note: in definition of macro 'raw_spin_lock_irqsave'
243 | flags = _raw_spin_lock_irqsave(lock); \
| ^~~~
mm/slub.c:2124:9: note: in expansion of macro 'spin_lock_irqsave'
2124 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:323:67: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
323 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
>> mm/slub.c:2132:32: error: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type [-Werror=incompatible-pointer-types]
2132 | spin_unlock_irqrestore(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:403:64: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
403 | static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
| ~~~~~~~~~~~~^~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
mm/slub.c: In function 'get_partial_node':
mm/slub.c:2210:27: error: passing argument 1 of 'spinlock_check' from incompatible pointer type [-Werror=incompatible-pointer-types]
2210 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
include/linux/spinlock.h:243:48: note: in definition of macro 'raw_spin_lock_irqsave'
243 | flags = _raw_spin_lock_irqsave(lock); \
| ^~~~
mm/slub.c:2210:9: note: in expansion of macro 'spin_lock_irqsave'
2210 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:323:67: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
323 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
mm/slub.c:2247:32: error: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type [-Werror=incompatible-pointer-types]
2247 | spin_unlock_irqrestore(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:403:64: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
403 | static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
| ~~~~~~~~~~~~^~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
mm/slub.c: In function 'deactivate_slab':
mm/slub.c:2489:35: error: passing argument 1 of 'spinlock_check' from incompatible pointer type [-Werror=incompatible-pointer-types]
2489 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
include/linux/spinlock.h:243:48: note: in definition of macro 'raw_spin_lock_irqsave'
243 | flags = _raw_spin_lock_irqsave(lock); \
| ^~~~
mm/slub.c:2489:17: note: in expansion of macro 'spin_lock_irqsave'
2489 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:323:67: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
323 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
mm/slub.c:2497:35: error: passing argument 1 of 'spinlock_check' from incompatible pointer type [-Werror=incompatible-pointer-types]
2497 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
include/linux/spinlock.h:243:48: note: in definition of macro 'raw_spin_lock_irqsave'
243 | flags = _raw_spin_lock_irqsave(lock); \
| ^~~~
mm/slub.c:2497:17: note: in expansion of macro 'spin_lock_irqsave'
2497 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:323:67: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
323 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
mm/slub.c:2508:48: error: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type [-Werror=incompatible-pointer-types]
2508 | spin_unlock_irqrestore(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
--
243 | flags = _raw_spin_lock_irqsave(lock); \
| ^~~~
mm/slub.c:2946:9: note: in expansion of macro 'spin_lock_irqsave'
2946 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:323:67: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
323 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
mm/slub.c:2949:32: error: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type [-Werror=incompatible-pointer-types]
2949 | spin_unlock_irqrestore(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:403:64: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
403 | static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
| ~~~~~~~~~~~~^~~~
mm/slub.c: In function '__slab_free':
mm/slub.c:3483:48: error: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type [-Werror=incompatible-pointer-types]
3483 | spin_unlock_irqrestore(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:403:64: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
403 | static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
| ~~~~~~~~~~~~^~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
mm/slub.c:3515:51: error: passing argument 1 of 'spinlock_check' from incompatible pointer type [-Werror=incompatible-pointer-types]
3515 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
include/linux/spinlock.h:243:48: note: in definition of macro 'raw_spin_lock_irqsave'
243 | flags = _raw_spin_lock_irqsave(lock); \
| ^~~~
mm/slub.c:3515:33: note: in expansion of macro 'spin_lock_irqsave'
3515 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:323:67: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
323 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
mm/slub.c:3557:32: error: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type [-Werror=incompatible-pointer-types]
3557 | spin_unlock_irqrestore(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:403:64: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
403 | static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
| ~~~~~~~~~~~~^~~~
mm/slub.c:3572:32: error: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type [-Werror=incompatible-pointer-types]
3572 | spin_unlock_irqrestore(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:403:64: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
403 | static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
| ~~~~~~~~~~~~^~~~
mm/slub.c: In function 'init_kmem_cache_node':
mm/slub.c:4008:24: error: passing argument 1 of 'spinlock_check' from incompatible pointer type [-Werror=incompatible-pointer-types]
4008 | spin_lock_init(&n->list_lock);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
include/linux/spinlock.h:342:24: note: in definition of macro 'spin_lock_init'
342 | spinlock_check(_lock); \
| ^~~~~
include/linux/spinlock.h:323:67: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
323 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
In file included from include/linux/spinlock.h:88,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
>> include/linux/spinlock_types.h:41:9: error: incompatible types when assigning to type 'raw_spinlock_t' {aka 'struct raw_spinlock'} from type 'spinlock_t' {aka 'struct spinlock'}
41 | (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname)
| ^
include/linux/spinlock.h:343:20: note: in expansion of macro '__SPIN_LOCK_UNLOCKED'
343 | *(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \
| ^~~~~~~~~~~~~~~~~~~~
mm/slub.c:4008:9: note: in expansion of macro 'spin_lock_init'
4008 | spin_lock_init(&n->list_lock);
| ^~~~~~~~~~~~~~
mm/slub.c: In function 'free_partial':
>> mm/slub.c:4393:23: error: passing argument 1 of 'spin_lock_irq' from incompatible pointer type [-Werror=incompatible-pointer-types]
4393 | spin_lock_irq(&n->list_lock);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:373:55: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
373 | static __always_inline void spin_lock_irq(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
>> mm/slub.c:4403:25: error: passing argument 1 of 'spin_unlock_irq' from incompatible pointer type [-Werror=incompatible-pointer-types]
4403 | spin_unlock_irq(&n->list_lock);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:398:57: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
398 | static __always_inline void spin_unlock_irq(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
mm/slub.c: In function '__kmem_cache_do_shrink':
mm/slub.c:4607:35: error: passing argument 1 of 'spinlock_check' from incompatible pointer type [-Werror=incompatible-pointer-types]
4607 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
include/linux/spinlock.h:243:48: note: in definition of macro 'raw_spin_lock_irqsave'
243 | flags = _raw_spin_lock_irqsave(lock); \
| ^~~~
mm/slub.c:4607:17: note: in expansion of macro 'spin_lock_irqsave'
4607 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:323:67: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
323 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
mm/slub.c:4639:40: error: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type [-Werror=incompatible-pointer-types]
4639 | spin_unlock_irqrestore(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:403:64: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
403 | static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
| ~~~~~~~~~~~~^~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
mm/slub.c: In function 'validate_slab_node':
mm/slub.c:4962:27: error: passing argument 1 of 'spinlock_check' from incompatible pointer type [-Werror=incompatible-pointer-types]
4962 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
include/linux/spinlock.h:243:48: note: in definition of macro 'raw_spin_lock_irqsave'
243 | flags = _raw_spin_lock_irqsave(lock); \
| ^~~~
mm/slub.c:4962:9: note: in expansion of macro 'spin_lock_irqsave'
4962 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:323:67: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
323 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
| ~~~~~~~~~~~~^~~~
mm/slub.c:4988:32: error: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type [-Werror=incompatible-pointer-types]
4988 | spin_unlock_irqrestore(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
include/linux/spinlock.h:403:64: note: expected 'spinlock_t *' {aka 'struct spinlock *'} but argument is of type 'raw_spinlock_t *' {aka 'struct raw_spinlock *'}
403 | static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
| ~~~~~~~~~~~~^~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/slub.c:13:
mm/slub.c: In function 'slab_debug_trace_open':
mm/slub.c:6202:35: error: passing argument 1 of 'spinlock_check' from incompatible pointer type [-Werror=incompatible-pointer-types]
6202 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~
| |
| raw_spinlock_t * {aka struct raw_spinlock *}
include/linux/spinlock.h:243:48: note: in definition of macro 'raw_spin_lock_irqsave'
243 | flags = _raw_spin_lock_irqsave(lock); \
| ^~~~
mm/slub.c:6202:17: note: in expansion of macro 'spin_lock_irqsave'
6202 | spin_lock_irqsave(&n->list_lock, flags);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
vim +/spin_unlock_irqrestore +2132 mm/slub.c
c7323a5ad07863 Vlastimil Babka 2022-08-23 2097
c7323a5ad07863 Vlastimil Babka 2022-08-23 2098 /*
c7323a5ad07863 Vlastimil Babka 2022-08-23 2099 * Called only for kmem_cache_debug() caches to allocate from a freshly
c7323a5ad07863 Vlastimil Babka 2022-08-23 2100 * allocated slab. Allocate a single object instead of whole freelist
c7323a5ad07863 Vlastimil Babka 2022-08-23 2101 * and put the slab to the partial (or full) list.
c7323a5ad07863 Vlastimil Babka 2022-08-23 2102 */
c7323a5ad07863 Vlastimil Babka 2022-08-23 2103 static void *alloc_single_from_new_slab(struct kmem_cache *s,
6edf2576a6cc46 Feng Tang 2022-09-13 2104 struct slab *slab, int orig_size)
c7323a5ad07863 Vlastimil Babka 2022-08-23 2105 {
c7323a5ad07863 Vlastimil Babka 2022-08-23 2106 int nid = slab_nid(slab);
c7323a5ad07863 Vlastimil Babka 2022-08-23 2107 struct kmem_cache_node *n = get_node(s, nid);
c7323a5ad07863 Vlastimil Babka 2022-08-23 2108 unsigned long flags;
c7323a5ad07863 Vlastimil Babka 2022-08-23 2109 void *object;
c7323a5ad07863 Vlastimil Babka 2022-08-23 2110
c7323a5ad07863 Vlastimil Babka 2022-08-23 2111
c7323a5ad07863 Vlastimil Babka 2022-08-23 2112 object = slab->freelist;
c7323a5ad07863 Vlastimil Babka 2022-08-23 2113 slab->freelist = get_freepointer(s, object);
c7323a5ad07863 Vlastimil Babka 2022-08-23 2114 slab->inuse = 1;
c7323a5ad07863 Vlastimil Babka 2022-08-23 2115
6edf2576a6cc46 Feng Tang 2022-09-13 2116 if (!alloc_debug_processing(s, slab, object, orig_size))
c7323a5ad07863 Vlastimil Babka 2022-08-23 2117 /*
c7323a5ad07863 Vlastimil Babka 2022-08-23 2118 * It's not really expected that this would fail on a
c7323a5ad07863 Vlastimil Babka 2022-08-23 2119 * freshly allocated slab, but a concurrent memory
c7323a5ad07863 Vlastimil Babka 2022-08-23 2120 * corruption in theory could cause that.
c7323a5ad07863 Vlastimil Babka 2022-08-23 2121 */
c7323a5ad07863 Vlastimil Babka 2022-08-23 2122 return NULL;
c7323a5ad07863 Vlastimil Babka 2022-08-23 2123
c7323a5ad07863 Vlastimil Babka 2022-08-23 @2124 spin_lock_irqsave(&n->list_lock, flags);
c7323a5ad07863 Vlastimil Babka 2022-08-23 2125
c7323a5ad07863 Vlastimil Babka 2022-08-23 2126 if (slab->inuse == slab->objects)
c7323a5ad07863 Vlastimil Babka 2022-08-23 2127 add_full(s, n, slab);
c7323a5ad07863 Vlastimil Babka 2022-08-23 2128 else
c7323a5ad07863 Vlastimil Babka 2022-08-23 2129 add_partial(n, slab, DEACTIVATE_TO_HEAD);
c7323a5ad07863 Vlastimil Babka 2022-08-23 2130
c7323a5ad07863 Vlastimil Babka 2022-08-23 2131 inc_slabs_node(s, nid, slab->objects);
c7323a5ad07863 Vlastimil Babka 2022-08-23 @2132 spin_unlock_irqrestore(&n->list_lock, flags);
c7323a5ad07863 Vlastimil Babka 2022-08-23 2133
c7323a5ad07863 Vlastimil Babka 2022-08-23 2134 return object;
c7323a5ad07863 Vlastimil Babka 2022-08-23 2135 }
c7323a5ad07863 Vlastimil Babka 2022-08-23 2136
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (170532 bytes)
Powered by blists - more mailing lists