Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

od: rs90: Set page size to 4k #91

Open
wants to merge 1 commit into
base: opendingux
Choose a base branch
from

Conversation

glebm
Copy link

@glebm glebm commented Nov 11, 2022

This makes the OS and applications a lot more RAM efficient:

  1. Reduces OS overhead by 3.5 MiB.
  2. Reduces RAM usage of applications (amount varies).

This comes at small performance cost,
<1 FPS in the emulators and ports that I've tested.

Measuring MemAvailable and Slab with just "Terminal" running:

Before:

MemAvailable:       9760 kB
Slab:               6816 kB

After:

MemAvailable:      13812 kB
Slab:               5904 kB

Makes more games playable:

  1. DevilutionX now loads the dungeon (without audio) and the FPS is unchanged 🎉
  2. Discword on ScummVM now runs well (previously: ~0.1 FPS)

Performance on ReGBA is identical (no frameskip, measured from particular stable-FPS scenes):

            4 KiB    16 KiB
Golden Sun: 55 FPS   55 FPS
      FFVI: 26 FPS   26 FPS

/proc/meminfo with 4k page size: https://gist.github.com/glebm/5aa5ad09ebfa62feb7b695d298f95ed7

@pcercuei
Copy link
Member

I want to do more tests before deciding whether or not it's a good idea to revert back to 4 KiB pages.

@glebm
Copy link
Author

glebm commented Nov 21, 2022

Makes sense. I've rebased the PR and added some details to the commit message and PR description.

@pcercuei
Copy link
Member

If #81 compensates for the performance loss of switching back to 4 KiB then I think it is OK. I just need to find some time to test things.

@pcercuei
Copy link
Member

I see differences as big as a 4 FPS difference in ReGBA though (48 vs. 44 FPS), that's about a 8% performance drop...
IMG_20221128_133309

This makes the OS and applications a lot more RAM efficient:

1. Reduces OS overhead by 3.5 MiB.
2. Reduces RAM usage of applications (amount varies).

This comes at small performance cost,
<1 FPS in the emulators and ports that I've tested.

Measuring `MemAvailable` and `Slab` with just "Terminal" running:

Before:

    MemAvailable:       9760 kB
    Slab:               6816 kB

After:

    MemAvailable:      13812 kB
    Slab:               5904 kB

DevilutionX now loads the dungeon (without audio)
and the FPS is unchanged.

Signed-off-by: Gleb Mazovetskiy <[email protected]>
@glebm
Copy link
Author

glebm commented Nov 29, 2022

  1. Which build of ReGBA did you use? Both at 360 MHz?
  2. How do you get to the screen you're testing at? I'm trying the Final Fantasy V Advance USA version and the starting screen looks different.

@pcercuei
Copy link
Member

@glebm latest (pcercuei/ReGBA.git), both at 360 MHz yes.

Just leave the title screen run, you will eventually arrive to this point.

Note that FPS won't be very different when there are not many memory accesses or these memory accesses are contained into a small memory area (that fits in 128 KiB, aka. 32 pages).

When the emulator or app needs to access a broader area of memory, for instance when a dynarec is recompiling code, or when accessing various parts of the ROM, then you can see the real difference.

@glebm
Copy link
Author

glebm commented Nov 29, 2022

I'm going to measure various versions but the latest release of pcercuei/ReGBA doesn't launch on RG99 at all (https://github.com/pcercuei/ReGBA/releases/tag/regba-2021.03.24)

@glebm
Copy link
Author

glebm commented Nov 30, 2022

I wonder if it'd work better with 1 hugepage anyway? If that's the case, perhaps we can have both better performance and more memory

@pcercuei
Copy link
Member

pcercuei commented Dec 2, 2022

@glebm reserving one huge page means having 2 MiB reserved at all times, I'm not sure that helps you much.

@SnDream
Copy link

SnDream commented Feb 12, 2023

I have tested this on RetroMini some time ago.

  • Advantages
    • more free memory
    • f2fs available (why add f2fs in 16k?)
  • Disadvantages
    • feels lower performance in ReGBA
    • creating and mounting f2fs is annoying and seems unnecessary

@pcercuei
Copy link
Member

@SnDream F2FS doesn't work with 16 KiB pages?

@SnDream
Copy link

SnDream commented Feb 25, 2023

@SnDream F2FS doesn't work with 16 KiB pages?

yes, see: torvalds/linux@5c9b469295fb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants