From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752761AbdDKDWE (ORCPT ); Mon, 10 Apr 2017 23:22:04 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:35097 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752290AbdDKDWC (ORCPT ); Mon, 10 Apr 2017 23:22:02 -0400 Date: Tue, 11 Apr 2017 12:21:47 +0900 From: Minchan Kim To: Benjamin Herrenschmidt Cc: Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: clear_page, copy_page address align question? Message-ID: <20170411032147.GA2283@bgram> References: <20170411030823.GB6545@bbox> <1491880344.4166.224.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1491880344.4166.224.camel@kernel.crashing.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 11, 2017 at 01:12:24PM +1000, Benjamin Herrenschmidt wrote: > 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. If it's the common for every architecture, it would have better to have description about that in somewhere or WARN_ON. :( Thanks for the confirm!