On Fri, Mar 08, 2019 at 03:14:18PM +1100, Tobin C. Harding wrote: > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -3642,6 +3642,7 @@ static int kmem_cache_open(struct kmem_cache *s, slab_flags_t flags) > > set_cpu_partial(s); > > + s->defrag_used_ratio = 30; > #ifdef CONFIG_NUMA > s->remote_node_defrag_ratio = 1000; > #endif > @@ -5261,6 +5262,28 @@ static ssize_t destroy_by_rcu_show(struct kmem_cache *s, char *buf) > } > SLAB_ATTR_RO(destroy_by_rcu); > > +static ssize_t defrag_used_ratio_show(struct kmem_cache *s, char *buf) > +{ > + return sprintf(buf, "%d\n", s->defrag_used_ratio); > +} > + > +static ssize_t defrag_used_ratio_store(struct kmem_cache *s, > + const char *buf, size_t length) > +{ > + unsigned long ratio; > + int err; > + > + err = kstrtoul(buf, 10, &ratio); > + if (err) > + return err; > + > + if (ratio <= 100) > + s->defrag_used_ratio = ratio; else return -EINVAL; maybe? Tycho