> What's your use-case, what apps you run and what data is stored > on zram disk? The steps to reproduce are as follows: 1. force slow path,then re-build kernel diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 0ca6d55c9917..29ac52a4f2e7 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1683,12 +1683,14 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index) * if we have a 'non-null' handle here then we are coming * from the slow path and handle has already been allocated. */ + /* if (IS_ERR_VALUE(handle)) handle = zs_malloc(zram->mem_pool, comp_len, __GFP_KSWAPD_RECLAIM | __GFP_NOWARN | __GFP_HIGHMEM | __GFP_MOVABLE); + */ if (IS_ERR_VALUE(handle)) { zcomp_stream_put(zram->comps[ZRAM_PRIMARY_COMP]); atomic64_inc(&zram->stats.writestall); 2. create an arm64 virtual machine qemu-system-aarch64 -M virt -cpu cortex-a57 -smp 4 -m 1024 -kernel kernel-build/arch/arm64/boot/Image \ -nographic -append "console=ttyAMA0,115200 root=/dev/vda rw" \ -drive file=$(IMGFILE),format=raw -nic user,hostfwd=tcp::60022-:22 3. after the virtual machine is started, create zram cat /sys/class/zram-control/hot_add echo 524288000 > /sys/devices/virtual/block/zram0/disksize echo 524288000 > /sys/devices/virtual/block/zram1/disksize mkfs.ext4 -O ^has_journal -b 4096 -F -L TEMP -m 0 /dev/zram0 mkdir /tmp/zram mount -t ext4 -o errors=continue,nosuid,nodev,noatime /dev/zram0 /tmp/zram mkswap /dev/zram1 swapon /dev/zram1 echo 100 > /proc/sys/vm/swappiness mkdir -p /tmp/zram/stressTest 4. build demo app and run again and again demo app : #include <stdio.h> #include <sys/mman.h> #define _GNU_SOURCE #include <unistd.h> #include <sys/types.h> #include <stdlib.h> #include <pthread.h> #include <errno.h> #include <string.h> #include <syscall.h> #define THREAD_NUM 400 #define BUFF_SIZE 128*1024 const static char * basePath = "/tmp/zram/stressTest"; static unsigned char buf[BUFF_SIZE]; void * cb(void * arg){ char path[256]; unsigned int tid = (unsigned int)(syscall(SYS_gettid)); unsigned int start = ((unsigned int)random())%(BUFF_SIZE - 1); unsigned int msleep = (((unsigned int)random())%10) * 1000; void * p; int i; snprintf(path,sizeof(path) - 1,"%s/%u",basePath,tid); FILE * fp = fopen(path,"a"); if (NULL == fp) { fprintf(stderr,"%u open file '%s' failure '%s'...\n",tid,path,strerror(errno)); return NULL; } start = ((unsigned int)random())%(BUFF_SIZE - 1); fwrite(&buf[start],1,BUFF_SIZE - start,fp); fflush(fp); fclose(fp); sync(); usleep(msleep); return NULL; } int main(int argc, char *argv[]) { pthread_t pid[THREAD_NUM]; int i; fprintf(stderr,"build @ %s\n",__TIME__); FILE * fp = fopen("/dev/urandom","ro"); fread(buf,BUFF_SIZE,1,fp); fclose(fp); fprintf(stderr,"read urandom size '%d'\n",BUFF_SIZE); srandom((unsigned)time(NULL)); for (i = 0;i < THREAD_NUM;i++) { pthread_create(&pid[i],NULL,cb,NULL); } fprintf(stderr,"create over\n"); for (i = 0;i < THREAD_NUM;i++) { pthread_join(pid[i],NULL); } return 0; } run it while true;do rm /tmp/zram_vsd/stressTest/* &> /dev/null;./a.out &> /dev/null ;echo again...;done