All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Minchan Kim <minchan@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: clear_page, copy_page address align question?
Date: Tue, 11 Apr 2017 13:12:24 +1000	[thread overview]
Message-ID: <1491880344.4166.224.camel@kernel.crashing.org> (raw)
In-Reply-To: <20170411030823.GB6545@bbox>

On Tue, 2017-04-11 at 12:08 +0900, Minchan Kim wrote:
> Hello,
> 
> When I tested zram in ppc64, I got random corruption.
> With investigation, it seems clear_page corrupted the memory.
> I passed 64K kmalloced(kmalloc(PAGE_SIZE)) address to clear_page
> and turned on slub debug so address is not aligned with PAGE_SIZE.
> Is it a valid usecase that non-PAGE_SIZE aligned address is
> used for clear_page in ppc64?
> 
> As well, copy_page have same rule, too?
> 
> Anyway, when I changed clear_page to memset, it seems the problem
> is gone.

Yes, both clear_page and copy_page assume a PAGE_SHIFT alignment and
are highly optimize according to this.

I wouldn't be surprised of other architectures implementations are the
same.

I don't think it's ever legit to call these functions for something
that isn't a naturally aligned page.

Cheers,
Ben.

  reply	other threads:[~2017-04-11  3:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11  3:08 clear_page, copy_page address align question? Minchan Kim
2017-04-11  3:12 ` Benjamin Herrenschmidt [this message]
2017-04-11  3:21   ` Minchan Kim

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=1491880344.4166.224.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=minchan@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.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.