A swap file can degrade a SD card very quickly because of the many read/writes. Is the same true for the lifespan of the 32GB UFS Flash Storage of the HiKey960?
Yes, and even worse, you can’t replace it out when it wears out. Keep your swap on the sdcard.
And FYI: Good sdcards won’t degrade fast. Pick one that is intended for huge amounts of writes. Typically ones for security cameras will be good in this regard. Also, ones with larger storage capacity gives you more space for the writes to be spread across, and thus last longer.
Or even better, don’t use swap!
Thanks for reply! I hope, when USB is working well that it is possible to attach an external USB harddisk to the board. Then I configure the swap file on the external harddisk. Currently I am waiting on the UART device, so I can’t do much with my just received HiKey960 board. I hope the new Debian image Build #28- (20-feb-2019 1:46:58) has solved the USB issue so I can attach my
WD Elements Portable 4 TB USB drive to the board and configure the swapfile to use the USB harddisk.
Maybe there are some people who have done this already. Anyway. Thanks for your answer!
If you never meet the OOM killer then this can be a good approach.
This is also a compromise possible which is to set the swappiness to zero. This does not prohibit swapping but makes the kernel strongly prefer to dump the page cache when under memory pressure. Among other things the page cache will contain a lot of read only pages mapped from shared libraries so this tends to be better for flash wear (and latency) compared to writing out anonymous pages to the swap partition.