From: Jiri Slaby <jirislaby@gmail.com>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
linux-mm@kvack.org, akpm@linux-foundation.org
Subject: Re: [PATCH] generic debug pagealloc
Date: Tue, 03 Mar 2009 17:12:35 +0100 [thread overview]
Message-ID: <49AD56F3.6020305@gmail.com> (raw)
In-Reply-To: <20090303160103.GB5812@localhost.localdomain>
On 3.3.2009 17:01, Akinobu Mita wrote:
...
> +static void dump_broken_mem(unsigned char *mem)
> +{
> + int i;
> + int start = 0;
> + int end = PAGE_SIZE - 1;
> +
> + for (i = 0; i< PAGE_SIZE; i++) {
> + if (mem[i] != PAGE_POISON) {
> + start = i;
> + break;
> + }
> + }
> + for (i = PAGE_SIZE - 1; i>= start; i--) {
> + if (mem[i] != PAGE_POISON) {
> + end = i;
> + break;
> + }
> + }
> + printk(KERN_ERR "Page corruption: %p-%p\n", mem + start, mem + end);
> + print_hex_dump(KERN_ERR, "", DUMP_PREFIX_ADDRESS, 16, 1, mem + start,
> + end - start + 1, 1);
> +}
> +
> +static void unpoison_page(struct page *page)
> +{
> + unsigned char *mem;
> + int i;
> +
> + if (!page->poison)
> + return;
> +
> + mem = kmap_atomic(page, KM_USER0);
> + for (i = 0; i< PAGE_SIZE; i++) {
> + if (mem[i] != PAGE_POISON) {
> + dump_broken_mem(mem);
Just an optimisation: pass the i to the dump_broken_mem as a start index.
> + break;
> + }
> + }
> + kunmap_atomic(mem, KM_USER0);
> + page->poison = false;
> +}
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Jiri Slaby <jirislaby@gmail.com>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
linux-mm@kvack.org, akpm@linux-foundation.org
Subject: Re: [PATCH] generic debug pagealloc
Date: Tue, 03 Mar 2009 17:12:35 +0100 [thread overview]
Message-ID: <49AD56F3.6020305@gmail.com> (raw)
Message-ID: <20090303161235.88M6ZMwpa6tdTG3vBkQgqYFHfZ3rT-_0xh4xT7ONflw@z> (raw)
In-Reply-To: <20090303160103.GB5812@localhost.localdomain>
On 3.3.2009 17:01, Akinobu Mita wrote:
...
> +static void dump_broken_mem(unsigned char *mem)
> +{
> + int i;
> + int start = 0;
> + int end = PAGE_SIZE - 1;
> +
> + for (i = 0; i< PAGE_SIZE; i++) {
> + if (mem[i] != PAGE_POISON) {
> + start = i;
> + break;
> + }
> + }
> + for (i = PAGE_SIZE - 1; i>= start; i--) {
> + if (mem[i] != PAGE_POISON) {
> + end = i;
> + break;
> + }
> + }
> + printk(KERN_ERR "Page corruption: %p-%p\n", mem + start, mem + end);
> + print_hex_dump(KERN_ERR, "", DUMP_PREFIX_ADDRESS, 16, 1, mem + start,
> + end - start + 1, 1);
> +}
> +
> +static void unpoison_page(struct page *page)
> +{
> + unsigned char *mem;
> + int i;
> +
> + if (!page->poison)
> + return;
> +
> + mem = kmap_atomic(page, KM_USER0);
> + for (i = 0; i< PAGE_SIZE; i++) {
> + if (mem[i] != PAGE_POISON) {
> + dump_broken_mem(mem);
Just an optimisation: pass the i to the dump_broken_mem as a start index.
> + break;
> + }
> + }
> + kunmap_atomic(mem, KM_USER0);
> + page->poison = false;
> +}
next prev parent reply other threads:[~2009-03-03 16:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-03 16:01 [PATCH] generic debug pagealloc Akinobu Mita
2009-03-03 16:01 ` Akinobu Mita
2009-03-03 16:05 ` Ingo Molnar
2009-03-03 16:05 ` Ingo Molnar
2009-03-04 14:12 ` Akinobu Mita
2009-03-04 14:12 ` Akinobu Mita
2009-03-03 16:12 ` Jiri Slaby [this message]
2009-03-03 16:12 ` Jiri Slaby
2009-03-04 14:13 ` Akinobu Mita
2009-03-04 14:13 ` Akinobu Mita
2009-03-03 21:36 ` Andrew Morton
2009-03-03 21:36 ` Andrew Morton
2009-03-03 22:07 ` Russell King
2009-03-03 22:07 ` Russell King
2009-03-04 14:17 ` Akinobu Mita
2009-03-04 14:17 ` Akinobu Mita
2009-03-06 9:14 ` Benjamin Herrenschmidt
2009-03-06 9:14 ` Benjamin Herrenschmidt
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=49AD56F3.6020305@gmail.com \
--to=jirislaby@gmail.com \
--cc=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.