Re: [PATCH] mm: extend zero pages to same element pages for zram

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux