OnionUI / Onion

OS overhaul for Miyoo Mini and Mini+
https://onionui.github.io
GNU General Public License v3.0
3.48k stars 218 forks source link

Create and enable swap partition on boot. #1428

Closed tGecko closed 9 months ago

tGecko commented 9 months ago

Normally, this is done by MainUI, but when we auto-resume a game, MainUI doesn't get a chance to do it. MainUI checks if the swap exists already, so no double swapon happens.

Fixes #1398 and maybe some other problems that went under the radar..

Negative impact:

If the cachefile exists (which is the norm) only swapon runs, which is near instant. If the cachefile doesn't exist, it takes a while to generate the file on SD.

(runtime) 1970-01-01 00:00:03: Creating swap file
128+0 records in
128+0 records out
134217728 bytes (128.0MB) copied, 8.452890 seconds, 15.1MB/s
Setting up swapspace version 1, size = 134213632 bytes
UUID=82b7a1fc-188b-4b8c-ba6d-115c440827d1
(runtime) 1970-01-01 00:00:12: Enabling swap

But since MainUI then doesn't have to do this, it's not a real negative impact.

from MainUI:

  local_10 = get_swap_file_size();
  printf("swap size is %d take %dms\n",local_10,local_c);
  if (local_10 < 1) {
    create_swap_if_sd_mounted(0);
  }
  return;