Re: [PATCH] brd: detect zero writes for saving ram

From: Akinobu Mita
Date: Sat Feb 07 2015 - 23:03:53 EST


2015-02-08 0:18 GMT+09:00 Akinobu Mita <akinobu.mita@xxxxxxxxx>:
> 2015-02-08 0:03 GMT+09:00 Akinobu Mita <akinobu.mita@xxxxxxxxx>:
>> This introduces a module parameter to detect zero writes and not to
>> allocate memory. Read requests for unallocated (unwritten) region
>> end up by reading zero. So this can save zeroed memory consumption
>> with extra overhead for the detection.
>>
>> This feature is useful for testing filesystems and user programs to
>> huge files without huge real storage. So this change also extends
>> the upper limit on the size of the RAM disk.
>
> I have just noticed about zram and I'll check I can use it instead.

zram currently needs to allocate memory proportional to the size of
the disk ((disksize >> PAGE_SHIFT) * sizeof(struct zram_table_entry)).
If disksize is TB or PB class, it requires huge amount of memory.
But brd with this patch can create 1PB filesystem. So there is a
reason for this new brd feature to exist.

# modprobe brd zero_detect=1 rd_size=$((1024*1024*1024*1024))
# mkfs.xfs /dev/ram0
# mount /dev/ram0 /mnt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/