Re: [RFC 02/15] slub: Add isolate() and migrate() methods

From: Roman Gushchin
Date: Tue Mar 12 2019 - 14:48:25 EST


On Tue, Mar 12, 2019 at 04:35:15AM +0000, Christopher Lameter wrote:
> On Mon, 11 Mar 2019, Roman Gushchin wrote:
>
> > > --- a/mm/slub.c
> > > +++ b/mm/slub.c
> > > @@ -4325,6 +4325,34 @@ int __kmem_cache_create(struct kmem_cache *s, slab_flags_t flags)
> > > return err;
> > > }
> > >
> > > +void kmem_cache_setup_mobility(struct kmem_cache *s,
> > > + kmem_cache_isolate_func isolate,
> > > + kmem_cache_migrate_func migrate)
> > > +{
> >
> > I wonder if it's better to adapt kmem_cache_create() to take two additional
> > argument? I suspect mobility is not a dynamic option, so it can be
> > set on kmem_cache creation.
>
> One other idea that prior versions of this patchset used was to change
> kmem_cache_create() so that the ctor parameter becomes an ops vector.
>
> However, in order to reduce the size of the patchset I dropped that. It
> could be easily moved back to the way it was before.

Understood. I like the idea of an ops vector, but it can be done later,
agree.

>
> > > + /*
> > > + * Sadly serialization requirements currently mean that we have
> > > + * to disable fast cmpxchg based processing.
> > > + */
> >
> > Can you, please, elaborate a bit more here?
>
> cmpxchg based processing does not lock the struct page. SMO requires to
> ensure that all changes on a slab page can be stopped. The page->lock will
> accomplish that. I think we could avoid dealing with actually locking the
> page with some more work.

Thank you for the explanation!