zram: use crc32c instead of jhash in dedup

crc32c is accelerated in arm64 and is faster than jhash.

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Change-Id: Ic4040e5ee941dca61fbfa6ac3b0f8d9a5f22a3dc
Signed-off-by: Forenche <prahul2003@gmail.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
This commit is contained in:
Park Ju Hyung 2021-07-16 16:58:24 +02:00 committed by azrim
parent 9a640a495a
commit 3a36008952
No known key found for this signature in database
GPG Key ID: 497F8FB059B45D1C
2 changed files with 3 additions and 3 deletions

View File

@ -42,7 +42,7 @@ config ZRAM_DEF_COMP
config ZRAM_DEDUP
bool "Deduplication support for ZRAM data"
depends on ZRAM
depends on ZRAM && LIBCRC32C
default n
help
Deduplicate ZRAM data to reduce amount of memory consumption.

View File

@ -8,7 +8,7 @@
*/
#include <linux/vmalloc.h>
#include <linux/jhash.h>
#include <linux/crc32c.h>
#include <linux/highmem.h>
#include "zram_drv.h"
@ -30,7 +30,7 @@ u64 zram_dedup_meta_size(struct zram *zram)
static u32 zram_dedup_checksum(unsigned char *mem)
{
return jhash(mem, PAGE_SIZE, 0);
return crc32c(0, mem, PAGE_SIZE);
}
void zram_dedup_insert(struct zram *zram, struct zram_entry *new,