• Home
  • Raw
  • Download

Lines Matching refs:s

64 unsigned int kmem_cache_size(struct kmem_cache *s)  in kmem_cache_size()  argument
66 return s->object_size; in kmem_cache_size()
73 struct kmem_cache *s = NULL; in kmem_cache_sanity_check() local
81 list_for_each_entry(s, &slab_caches, list) { in kmem_cache_sanity_check()
90 res = probe_kernel_address(s->name, tmp); in kmem_cache_sanity_check()
93 s->object_size); in kmem_cache_sanity_check()
110 struct kmem_cache *s, struct kmem_cache *root_cache) in memcg_alloc_cache_params() argument
123 s->memcg_params = kzalloc(size, GFP_KERNEL); in memcg_alloc_cache_params()
124 if (!s->memcg_params) in memcg_alloc_cache_params()
128 s->memcg_params->memcg = memcg; in memcg_alloc_cache_params()
129 s->memcg_params->root_cache = root_cache; in memcg_alloc_cache_params()
131 s->memcg_params->is_root_cache = true; in memcg_alloc_cache_params()
136 static void memcg_free_cache_params(struct kmem_cache *s) in memcg_free_cache_params() argument
138 kfree(s->memcg_params); in memcg_free_cache_params()
141 static int memcg_update_cache_params(struct kmem_cache *s, int num_memcgs) in memcg_update_cache_params() argument
146 BUG_ON(!is_root_cache(s)); in memcg_update_cache_params()
155 cur_params = s->memcg_params; in memcg_update_cache_params()
161 rcu_assign_pointer(s->memcg_params, new_params); in memcg_update_cache_params()
170 struct kmem_cache *s; in memcg_update_all_caches() local
174 list_for_each_entry(s, &slab_caches, list) { in memcg_update_all_caches()
175 if (!is_root_cache(s)) in memcg_update_all_caches()
178 ret = memcg_update_cache_params(s, num_memcgs); in memcg_update_all_caches()
194 struct kmem_cache *s, struct kmem_cache *root_cache) in memcg_alloc_cache_params() argument
199 static inline void memcg_free_cache_params(struct kmem_cache *s) in memcg_free_cache_params() argument
207 int slab_unmergeable(struct kmem_cache *s) in slab_unmergeable() argument
209 if (slab_nomerge || (s->flags & SLAB_NEVER_MERGE)) in slab_unmergeable()
212 if (!is_root_cache(s)) in slab_unmergeable()
215 if (s->ctor) in slab_unmergeable()
221 if (s->refcount < 0) in slab_unmergeable()
230 struct kmem_cache *s; in find_mergeable() local
243 list_for_each_entry(s, &slab_caches, list) { in find_mergeable()
244 if (slab_unmergeable(s)) in find_mergeable()
247 if (size > s->size) in find_mergeable()
250 if ((flags & SLAB_MERGE_SAME) != (s->flags & SLAB_MERGE_SAME)) in find_mergeable()
256 if ((s->size & ~(align - 1)) != s->size) in find_mergeable()
259 if (s->size - size >= sizeof(void *)) in find_mergeable()
263 (align > s->align || s->align % align)) in find_mergeable()
266 return s; in find_mergeable()
303 struct kmem_cache *s; in do_kmem_cache_create() local
307 s = kmem_cache_zalloc(kmem_cache, GFP_KERNEL); in do_kmem_cache_create()
308 if (!s) in do_kmem_cache_create()
311 s->name = name; in do_kmem_cache_create()
312 s->object_size = object_size; in do_kmem_cache_create()
313 s->size = size; in do_kmem_cache_create()
314 s->align = align; in do_kmem_cache_create()
315 s->ctor = ctor; in do_kmem_cache_create()
317 err = memcg_alloc_cache_params(memcg, s, root_cache); in do_kmem_cache_create()
321 err = __kmem_cache_create(s, flags); in do_kmem_cache_create()
325 s->refcount = 1; in do_kmem_cache_create()
326 list_add(&s->list, &slab_caches); in do_kmem_cache_create()
330 return s; in do_kmem_cache_create()
333 memcg_free_cache_params(s); in do_kmem_cache_create()
334 kfree(s); in do_kmem_cache_create()
366 struct kmem_cache *s; in kmem_cache_create() local
377 s = NULL; /* suppress uninit var warning */ in kmem_cache_create()
389 s = __kmem_cache_alias(name, size, align, flags, ctor); in kmem_cache_create()
390 if (s) in kmem_cache_create()
399 s = do_kmem_cache_create(cache_name, size, size, in kmem_cache_create()
402 if (IS_ERR(s)) { in kmem_cache_create()
403 err = PTR_ERR(s); in kmem_cache_create()
424 return s; in kmem_cache_create()
443 struct kmem_cache *s = NULL; in memcg_create_kmem_cache() local
456 s = do_kmem_cache_create(cache_name, root_cache->object_size, in memcg_create_kmem_cache()
460 if (IS_ERR(s)) { in memcg_create_kmem_cache()
462 s = NULL; in memcg_create_kmem_cache()
471 return s; in memcg_create_kmem_cache()
474 static int memcg_cleanup_cache_params(struct kmem_cache *s) in memcg_cleanup_cache_params() argument
478 if (!s->memcg_params || in memcg_cleanup_cache_params()
479 !s->memcg_params->is_root_cache) in memcg_cleanup_cache_params()
483 rc = __memcg_cleanup_cache_params(s); in memcg_cleanup_cache_params()
489 static int memcg_cleanup_cache_params(struct kmem_cache *s) in memcg_cleanup_cache_params() argument
495 void slab_kmem_cache_release(struct kmem_cache *s) in slab_kmem_cache_release() argument
497 kfree(s->name); in slab_kmem_cache_release()
498 kmem_cache_free(kmem_cache, s); in slab_kmem_cache_release()
501 void kmem_cache_destroy(struct kmem_cache *s) in kmem_cache_destroy() argument
508 s->refcount--; in kmem_cache_destroy()
509 if (s->refcount) in kmem_cache_destroy()
512 if (memcg_cleanup_cache_params(s) != 0) in kmem_cache_destroy()
515 if (__kmem_cache_shutdown(s) != 0) { in kmem_cache_destroy()
517 "Slab cache still has objects\n", s->name); in kmem_cache_destroy()
522 list_del(&s->list); in kmem_cache_destroy()
525 if (s->flags & SLAB_DESTROY_BY_RCU) in kmem_cache_destroy()
528 memcg_free_cache_params(s); in kmem_cache_destroy()
530 sysfs_slab_remove(s); in kmem_cache_destroy()
532 slab_kmem_cache_release(s); in kmem_cache_destroy()
571 void __init create_boot_cache(struct kmem_cache *s, const char *name, size_t size, in create_boot_cache() argument
576 s->name = name; in create_boot_cache()
577 s->size = s->object_size = size; in create_boot_cache()
578 s->align = calculate_alignment(flags, ARCH_KMALLOC_MINALIGN, size); in create_boot_cache()
579 err = __kmem_cache_create(s, flags); in create_boot_cache()
585 s->refcount = -1; /* Exempt from merging for now */ in create_boot_cache()
591 struct kmem_cache *s = kmem_cache_zalloc(kmem_cache, GFP_NOWAIT); in create_kmalloc_cache() local
593 if (!s) in create_kmalloc_cache()
596 create_boot_cache(s, name, size, flags); in create_kmalloc_cache()
597 list_add(&s->list, &slab_caches); in create_kmalloc_cache()
598 s->refcount = 1; in create_kmalloc_cache()
599 return s; in create_kmalloc_cache()
749 struct kmem_cache *s = kmalloc_caches[i]; in create_kmalloc_caches() local
752 if (s) { in create_kmalloc_caches()
756 s->name = n; in create_kmalloc_caches()
762 struct kmem_cache *s = kmalloc_caches[i]; in create_kmalloc_caches() local
764 if (s) { in create_kmalloc_caches()
859 memcg_accumulate_slabinfo(struct kmem_cache *s, struct slabinfo *info) in memcg_accumulate_slabinfo() argument
865 if (!is_root_cache(s)) in memcg_accumulate_slabinfo()
869 c = cache_from_memcg_idx(s, i); in memcg_accumulate_slabinfo()
884 int cache_show(struct kmem_cache *s, struct seq_file *m) in cache_show() argument
889 get_slabinfo(s, &sinfo); in cache_show()
891 memcg_accumulate_slabinfo(s, &sinfo); in cache_show()
894 cache_name(s), sinfo.active_objs, sinfo.num_objs, s->size, in cache_show()
901 slabinfo_show_stats(m, s); in cache_show()
908 struct kmem_cache *s = list_entry(p, struct kmem_cache, list); in s_show() local
910 if (!is_root_cache(s)) in s_show()
912 return cache_show(s, m); in s_show()