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

Improvements for "Available RAM" #183

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

Martinski4GitHub
Copy link
Collaborator

Code improvements to obtain a better estimate for the current amount of "Available RAM" to compare with "Required RAM."

Code improvements to obtain a better estimate for the current amount of "Available RAM" to compare with "Required RAM."
Updated version string.
@Martinski4GitHub
Copy link
Collaborator Author

@ExtremeFiretop,

As mentioned yesterday, I decided to take another look at the code getting the "Available RAM" value. I was reviewing log entries of memory stats from my router & my cousin's router and have come to the conclusion that, by itself, the "Available RAM" reported by "/proc/meminfo" in ASUS routers is not always a reliable metric for available memory. I know it's an estimate based on several factors involved (active vs inactive pages, file-backed vs anonymous pages, current I/O activity buffers, dirty vs writeback page levels, the swap file cache, etc.), and in general, it tends to be extremely conservative in its estimation.

So after going over some C++ code related to memory management that I wrote a while ago for another project at work, I've written a better way to get the estimate of the current amount of "Available RAM" so I submitted this PR with the new approach. Please take a look and, when you get a chance, test the new code on your own routers.

I've already run testing & verification on my RT-AC86U and my cousin's RT-AX86S, and it's all good. The estimate is much better in situations when "Free RAM" is high and when it's becoming low. Another good thing about this new approach is that it works the same way whether the router has 512MB, 1GB, or 2GB RAM.

@ExtremeFiretop ExtremeFiretop merged commit efebacc into ExtremeFiretop:dev Apr 2, 2024
1 check passed
@ExtremeFiretop ExtremeFiretop added the enhancement New feature or request label Apr 2, 2024
@ExtremeFiretop
Copy link
Owner

@Martinski4GitHub

Great work, I like the improvements, as you mentioned here:

and in general, it tends to be extremely conservative in its estimation.

I generally agree that based on my testing it tended to be more conservative than accurate, so the fact that this improves accuracy, plus works the same way whether the router has 512MB, 1GB, or 2GB RAM, is a major plus.

Merged! Will test it tomorrow it's starting to get late but seems solid enough to merge into dev :)
Will report back more tomorrow!

@Martinski4GitHub
Copy link
Collaborator Author

I generally agree that based on my testing it tended to be more conservative than accurate, so the fact that this improves accuracy, plus works the same way whether the router has 512MB, 1GB, or 2GB RAM, is a major plus.

Merged! Will test it tomorrow it's starting to get late but seems solid enough to merge into dev :) Will report back more tomorrow!

Sounds good. I'm going to bed early tonight as well since I have an early morning meeting tomorrow.

Good night, buddy!!

@ExtremeFiretop
Copy link
Owner

@Martinski4GitHub

Find the attached results comparing the 2 runs between the old memory method and the new memory method:

OLD MEMORY METHOD:
OLD_MEM_GT-AXE11000_FW_Update_2024-04-03_22_02_04.log

NEW MEMORY METHOD:
NEW_MEM_GT-AXE11000_FW_Update_2024-04-03_21_56_25.log

@ExtremeFiretop
Copy link
Owner

At the last stage of before the flash on the new method it stated:

Required RAM: 227272 KB - RAM Free: 210568 KB - RAM Available: 449770 KB

Old method stated:

Required RAM: 227272 KB - RAM Free: 210956 KB - RAM Available: 352788 KB

@ExtremeFiretop
Copy link
Owner

I rather accuracy than conservatism and this seems to accomplish that!

Nice work :) This may even explain why my router looked like it wasn't decreasing in memory usage in my previous tests, when obviously it had to be (since I was loading it with more and more junk.)

Makes me think I should re-run those tests!

@ExtremeFiretop
Copy link
Owner

Oh! And to the point of the user that had low memory, this would technically get him over the minimum requirement I believe as well.

@ExtremeFiretop
Copy link
Owner

FYI regarding Gnuton:

Screenshot_2024-04-03-23-33-36-43_572064f74bd5f9fa804b05334aa4f912

@ExtremeFiretop
Copy link
Owner

And here's the output of the webs_update.sh on Gnuton: https://pastebin.com/886EQVzN#google_vignette

@Martinski4GitHub
Copy link
Collaborator Author

Martinski4GitHub commented Apr 5, 2024

@ExtremeFiretop,

Apologies for not responding earlier. My wife's Mom has a bad fall at her home late afternoon on Tuesday. At first, it seemed like it was just some bruises & scrapes, but after the pain got worse overnight, they went to the doctor & found out she had a hairline fracture on both her wrist & ulna. So my wife & I have been driving to my in-law's home in the evenings to check on her and take food to have dinner with them & some fruits, vegetables and easy-to-prepare food so they can eat during the day. Anyway, needless to say, my last few evenings have been occupied so I have not done much WRT MerlinAU.

@ExtremeFiretop
Copy link
Owner

@ExtremeFiretop,

Apologies for not responding earlier. My wife's Mom has a bad fall at her home late afternoon on Tuesday. At first, it seemed like it was just some bruises & scrapes, but after the pain got worse overnight, they went to the doctor & found out she had a hairline fracture on both her wrist & ulna. So my wife & I have been driving to my in-law's home in the evenings to check on her and take food to have dinner with them & some fruits, vegetables and easy-to-prepare food so they can eat during the day. Anyway, needless to say, my last few evenings have been occupied so I have done much WRT MerlinAU.

No worries I totally understand, I always assume something is just keeping you busy, it's unfortunate to hear it's due to an unfortunate accident. I do hope she recovers quickly and best wishes for you and the family!

I've slowly started poking at Gnuton stuff and tested this and that's basically the TLDR.

@ExtremeFiretop
Copy link
Owner

I'm sure she's appreciated having you visit in the evening :)

@Martinski4GitHub
Copy link
Collaborator Author

No worries I totally understand, I always assume something is just keeping you busy, it's unfortunate to hear it's due to an unfortunate accident. I do hope she recovers quickly and best wishes for you and the family!

Thanks. This evening she seemed much better, so my wife was relieved & also feeling much better about the situation. Her dad was also less anxious, so overall we were all breathing a lot easier this evening.

I'm sure she's appreciated having you visit in the evening :)

My in-laws are good folks and have always been willing & ready to help us with our kids since they were babies. Along with my own parents, they took a fair share of babysitting duties, taking them to the doctor when needed, picking them up from school, staying with them at home when they were sick, etc. As a parent, when someone shows your kids how much they love them & demonstrates how much they care about them, you never forget it, so I'm always appreciative of that. Also, despite our disagreements about other topics (e.g. politics, societal issues, etc.), my in-laws have been respectful to us about how my wife and I raised our kids and about our marriage. The proverb: "It takes a village to raise a child" is certainly true, and the "first village" starts with your close relatives.

@Martinski4GitHub
Copy link
Collaborator Author

At the last stage of before the flash on the new method it stated:

Required RAM: 227272 KB - RAM Free: 210568 KB - RAM Available: 449770 KB

Old method stated:

Required RAM: 227272 KB - RAM Free: 210956 KB - RAM Available: 352788 KB

This looks very good and is comparable to the test results I got when verifying the code with RT-AC86U & RT-AX86S (both with 512MB RAM).

@Martinski4GitHub
Copy link
Collaborator Author

Oh! And to the point of the user that had low memory, this would technically get him over the minimum requirement I believe as well.

Yes, I do think this new code should address the issue with low "Free RAM" but enough "Available RAM" to continue with F/W flashing.

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

Successfully merging this pull request may close these issues.

2 participants