From: Pekka Enberg <penberg@kernel.org>
To: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Christoph Lameter <cl@linux-foundation.org>,
Matt Mackall <mpm@selenic.com>,
LKML <linux-kernel@vger.kernel.org>,
rientjes@google.com, linux-mm@kvack.org
Subject: Re: [PATCH] slub: reduce overhead of slub_debug
Date: Thu, 7 Jul 2011 21:07:27 +0300 (EEST) [thread overview]
Message-ID: <alpine.DEB.2.00.1107072106560.6693@tiger> (raw)
In-Reply-To: <20110626193918.GA3339@joi.lan>
On Sun, 26 Jun 2011, Marcin Slusarz wrote:
> slub checks for poison one byte by one, which is highly inefficient
> and shows up frequently as a highest cpu-eater in perf top.
>
> Joining reads gives nice speedup:
>
> (Compiling some project with different options)
> make -j12 make clean
> slub_debug disabled: 1m 27s 1.2 s
> slub_debug enabled: 1m 46s 7.6 s
> slub_debug enabled + this patch: 1m 33s 3.2 s
>
> check_bytes still shows up high, but not always at the top.
>
> Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> Cc: Christoph Lameter <cl@linux-foundation.org>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: Matt Mackall <mpm@selenic.com>
> Cc: linux-mm@kvack.org
> ---
Looks good to me. Christoph, David, ?
> mm/slub.c | 36 ++++++++++++++++++++++++++++++++++--
> 1 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 35f351f..a40ef2d 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -557,10 +557,10 @@ static void init_object(struct kmem_cache *s, void *object, u8 val)
> memset(p + s->objsize, val, s->inuse - s->objsize);
> }
>
> -static u8 *check_bytes(u8 *start, unsigned int value, unsigned int bytes)
> +static u8 *check_bytes8(u8 *start, u8 value, unsigned int bytes)
> {
> while (bytes) {
> - if (*start != (u8)value)
> + if (*start != value)
> return start;
> start++;
> bytes--;
> @@ -568,6 +568,38 @@ static u8 *check_bytes(u8 *start, unsigned int value, unsigned int bytes)
> return NULL;
> }
>
> +static u8 *check_bytes(u8 *start, u8 value, unsigned int bytes)
> +{
> + u64 value64;
> + unsigned int words, prefix;
> +
> + if (bytes <= 16)
> + return check_bytes8(start, value, bytes);
> +
> + value64 = value | value << 8 | value << 16 | value << 24;
> + value64 = value64 | value64 << 32;
> + prefix = 8 - ((unsigned long)start) % 8;
> +
> + if (prefix) {
> + u8 *r = check_bytes8(start, value, prefix);
> + if (r)
> + return r;
> + start += prefix;
> + bytes -= prefix;
> + }
> +
> + words = bytes / 8;
> +
> + while (words) {
> + if (*(u64 *)start != value64)
> + return check_bytes8(start, value, 8);
> + start += 8;
> + words--;
> + }
> +
> + return check_bytes8(start, value, bytes % 8);
> +}
> +
> static void restore_bytes(struct kmem_cache *s, char *message, u8 data,
> void *from, void *to)
> {
> --
> 1.7.5.3
>
>
--
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>
next prev parent reply other threads:[~2011-07-07 18:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-26 19:39 Marcin Slusarz
2011-06-28 19:32 ` Christoph Lameter
2011-06-28 19:40 ` David Daney
2011-06-28 20:58 ` David Rientjes
2011-06-28 21:04 ` Ben Greear
2011-06-28 21:10 ` David Rientjes
2011-06-28 21:16 ` Dave Jones
2011-07-07 18:07 ` Pekka Enberg [this message]
2011-07-07 18:17 ` Christoph Lameter
2011-07-07 18:30 ` Ben Greear
2011-07-07 18:42 ` Christoph Lameter
2011-07-07 18:54 ` Ben Greear
2011-07-07 18:30 ` Matt Mackall
2011-07-07 18:52 ` Pekka Enberg
2011-07-07 18:55 ` Matt Mackall
2011-07-07 19:12 ` Christoph Lameter
2011-07-07 19:21 ` David Miller
2011-07-07 19:49 ` Pekka Enberg
2011-07-07 20:12 ` Christoph Lameter
2011-07-08 5:23 ` Andi Kleen
2011-07-08 17:41 ` Christoph Lameter
2011-07-08 5:38 ` 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.1107072106560.6693@tiger \
--to=penberg@kernel.org \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=marcin.slusarz@gmail.com \
--cc=mpm@selenic.com \
--cc=rientjes@google.com \
/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