[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170206141448.GF2267@bombadil.infradead.org>
Date: Mon, 6 Feb 2017 06:14:48 -0800
From: Matthew Wilcox <willy@...radead.org>
To: zhouxianrong <zhouxianrong@...wei.com>
Cc: Minchan Kim <minchan@...nel.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
sergey.senozhatsky@...il.com, iamjoonsoo.kim@....com,
ngupta@...are.org, Mi.Sophia.Wang@...wei.com, zhouxiyu@...wei.com,
weidu.du@...wei.com, zhangshiming5@...wei.com,
won.ho.park@...wei.com
Subject: Re: [PATCH] mm: extend zero pages to same element pages for zram
On Mon, Feb 06, 2017 at 09:28:18AM +0800, zhouxianrong 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;
> > > + }
> > > + }
> > > +
> >
> > I don't think we need this part because block layer works with sector
> > size or multiple times of it so it must be aligned unsigned long.
>
> Minchan and Matthew Wilcox:
>
> 1. right, but users could open /dev/block/zram0 file and do any read operations.
But any such read operation would go through the page cache, so will
be page aligned. Unless they do an O_DIRECT operation, in which case
it must be aligned to block size. Please, try it. I/Os which are not
aligned should be failed long before they reach your driver.
Powered by blists - more mailing lists