Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1368170
| From | Nikolay Borisov <kernel@kyup.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 01/11] mm/slab: hold a slab_mutex when calling __kmem_cache_shrink() |
| Date | 2016-03-31 13:00 +0200 |
| Message-ID | <riIuu-3Hf-1@gated-at.bofh.it> (permalink) |
| References | <rhxUt-2rs-3@gated-at.bofh.it> <rhxUt-2rs-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 03/28/2016 08:26 AM, js1304@gmail.com wrote: > From: Joonsoo Kim <iamjoonsoo.kim@lge.com> > > Major kmem_cache metadata in slab subsystem is synchronized with > the slab_mutex. In SLAB, if some of them is changed, node's shared > array cache would be freed and re-populated. If __kmem_cache_shrink() > is called at the same time, it will call drain_array() with n->shared > without holding node lock so problem can happen. > > We can fix this small theoretical race condition by holding node lock > in drain_array(), but, holding a slab_mutex in kmem_cache_shrink() > looks more appropriate solution because stable state would make things > less error-prone and this is not performance critical path. > > In addtion, annotate on SLAB functions. Just a nit but would it not be better instead of doing comment-style annotation to use lockdep_assert_held/_once. In both cases for someone to understand what locks have to be held will go and read the source. In my mind it's easier to miss a comment line, rather than the lockdep_assert. Furthermore in case lockdep is enabled a locking violation would spew useful info to dmesg.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 01/11] mm/slab: hold a slab_mutex when calling __kmem_cache_shrink() js1304@gmail.com - 2016-03-28 07:30 +0200
Re: [PATCH 01/11] mm/slab: hold a slab_mutex when calling __kmem_cache_shrink() Christoph Lameter <cl@linux.com> - 2016-03-29 03:00 +0200
Re: [PATCH 01/11] mm/slab: hold a slab_mutex when calling __kmem_cache_shrink() Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-03-30 10:20 +0200
Re: [PATCH 01/11] mm/slab: hold a slab_mutex when calling __kmem_cache_shrink() Nikolay Borisov <kernel@kyup.com> - 2016-03-31 13:00 +0200
Re: [PATCH 01/11] mm/slab: hold a slab_mutex when calling __kmem_cache_shrink() Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-04-01 04:20 +0200
csiph-web