[PATCH 3/4] zswap: Zero-filled pages handling

From: Srividya Desireddy
Date: Fri Aug 19 2016 - 02:03:16 EST


On 17 August 2016 at 17:55, Pekka Enberg <penberg@xxxxxxxxxx> wrote:
> On Wed, Aug 17, 2016 at 1:18 PM, Srividya Desireddy
> <srividya.dr@xxxxxxxxxxx> wrote:
>> @@ -1314,6 +1347,13 @@ static int zswap_frontswap_load(unsigned type, pgoff_t offset,
>> }
>> spin_unlock(&tree->lock);
>>
>> + if (entry->zeroflag) {
>> + dst = kmap_atomic(page);
>> + memset(dst, 0, PAGE_SIZE);
>> + kunmap_atomic(dst);
>> + goto freeentry;
>> + }
>
> Don't we need the same thing in zswap_writeback_entry() for the
> ZSWAP_SWAPCACHE_NEW case?

Zero-filled pages are not compressed and stored in the zpool memory.
Zpool handle will not be created for zero-filled pages, hence they
can not be picked for eviction/writeback to the swap device.

- Srividya
>
>> +
>> /* decompress */
>> dlen = PAGE_SIZE;
>> src = (u8 *)zpool_map_handle(entry->pool->zpool, entry->zhandle->handle,
>> @@ -1327,6 +1367,7 @@ static int zswap_frontswap_load(unsigned type, pgoff_t offset,
>> zpool_unmap_handle(entry->pool->zpool, entry->zhandle->handle);
>> BUG_ON(ret);
>
> - Pekka