lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190311060418.GA22772@eros.localdomain>
Date:   Mon, 11 Mar 2019 17:04:18 +1100
From:   "Tobin C. Harding" <me@...in.cc>
To:     Tycho Andersen <tycho@...ho.ws>
Cc:     "Tobin C. Harding" <tobin@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Christopher Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...helsinki.fi>,
        Matthew Wilcox <willy@...radead.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC 07/15] slub: Add defrag_used_ratio field and sysfs support

On Fri, Mar 08, 2019 at 09:01:51AM -0700, Tycho Andersen wrote:
> 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;

Nice, thanks.  I moulded your suggestion into

	if (ratio > 100)
		return -EINVAL;

	s->defrag_used_ratio = ratio;
	return length;


thanks,
Tobin.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ