From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753567AbdBDDeM (ORCPT ); Fri, 3 Feb 2017 22:34:12 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:55328 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753350AbdBDDeJ (ORCPT ); Fri, 3 Feb 2017 22:34:09 -0500 Subject: Re: [PATCH] mm: extend zero pages to same element pages for zram To: Matthew Wilcox References: <1483692145-75357-1-git-send-email-zhouxianrong@huawei.com> <1486111347-112972-1-git-send-email-zhouxianrong@huawei.com> <20170203153350.GC2267@bombadil.infradead.org> CC: , , , , , , , , , , , From: zhouxianrong Message-ID: <2f856730-512e-7b0b-c0da-8c41305a3ce8@huawei.com> Date: Sat, 4 Feb 2017 11:33:04 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <20170203153350.GC2267@bombadil.infradead.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.145.228] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.58954B81.003F,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d70944f3cba73dc7aaa598e5993e8e15 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org right, thanks. On 2017/2/3 23:33, Matthew Wilcox wrote: > On Fri, Feb 03, 2017 at 04:42:27PM +0800, zhouxianrong@huawei.com wrote: >> +static inline void zram_fill_page_partial(char *ptr, unsigned int size, >> + unsigned long value) >> +{ >> + int i; >> + unsigned long *page; >> + >> + if (likely(value == 0)) { >> + memset(ptr, 0, size); >> + return; >> + } >> + >> + i = ((unsigned long)ptr) % sizeof(*page); >> + if (i) { >> + while (i < sizeof(*page)) { >> + *ptr++ = (value >> (i * 8)) & 0xff; >> + --size; >> + ++i; >> + } >> + } >> + >> + for (i = size / sizeof(*page); i > 0; --i) { >> + page = (unsigned long *)ptr; >> + *page = value; >> + ptr += sizeof(*page); >> + size -= sizeof(*page); >> + } >> + >> + for (i = 0; i < size; ++i) >> + *ptr++ = (value >> (i * 8)) & 0xff; >> +} > > You're assuming little-endian here. I think you need to do a > cpu_to_le() here, but I don't think we have a cpu_to_leul, only > cpu_to_le64/cpu_to_le32. So you may have some work to do ... > > > . >