linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: George Spelvin <linux@horizon.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
	herbert@gondor.hengli.com.au, mpm@selenic.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/8] mm/slub: Factor out some common code.
Date: Wed, 16 Mar 2011 13:28:30 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1103161308410.11002@chino.kir.corp.google.com> (raw)
In-Reply-To: <20110316022805.27713.qmail@science.horizon.com>

On Mon, 14 Mar 2011, George Spelvin wrote:

> For sysfs files that map a boolean to a flags bit.

Where's your signed-off-by?

> ---
>  mm/slub.c |   93 ++++++++++++++++++++++++++++--------------------------------
>  1 files changed, 43 insertions(+), 50 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index e15aa7f..856246f 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3982,38 +3982,61 @@ static ssize_t objects_partial_show(struct kmem_cache *s, char *buf)
>  }
>  SLAB_ATTR_RO(objects_partial);
>  
> +static ssize_t flag_show(struct kmem_cache *s, char *buf, unsigned flag)
> +{
> +	return sprintf(buf, "%d\n", !!(s->flags & flag));
> +}
> +
> +static ssize_t flag_store(struct kmem_cache *s,
> +				const char *buf, size_t length, unsigned flag)
> +{
> +	s->flags &= ~flag;
> +	if (buf[0] == '1')
> +		s->flags |= flag;
> +	return length;
> +}
> +
> +/* Like above, but changes allocation size; so only allowed on empty slab */
> +static ssize_t flag_store_sizechange(struct kmem_cache *s,
> +				const char *buf, size_t length, unsigned flag)
> +{
> +	if (any_slab_objects(s))
> +		return -EBUSY;
> +
> +	flag_store(s, buf, length, flag);
> +	calculate_sizes(s, -1);
> +	return length;
> +}
> +

Nice cleanup.

"flag" should be unsigned long in all of these functions: the constants 
are declared with UL suffixes in slab.h.

After that's fixed,

	Acked-by: David Rientjes <rientjes@google.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2011-03-16 20:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-15  1:58 George Spelvin
2011-03-16  3:12 ` Matt Mackall
2011-03-16  6:32 ` Pekka Enberg
2011-03-16 20:28 ` David Rientjes [this message]
2011-03-16 20:51   ` George Spelvin
2011-03-16 21:51     ` David Rientjes
2011-03-16 22:36       ` George Spelvin
2011-03-17  6:23         ` Pekka Enberg
2011-03-17  7:07           ` George Spelvin
2011-03-17  8:01             ` Pekka Enberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1103161308410.11002@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=herbert@gondor.hengli.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@horizon.com \
    --cc=mpm@selenic.com \
    --cc=penberg@cs.helsinki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox