-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
Code improvements to obtain a better estimate for the current amount of "Available RAM" to compare with "Required RAM."
Updated version string.
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. |
Great work, I like the improvements, as you mentioned here:
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 :) |
Sounds good. I'm going to bed early tonight as well since I have an early morning meeting tomorrow. Good night, buddy!! |
Find the attached results comparing the 2 runs between the old memory method and the new memory method: OLD MEMORY METHOD: NEW MEMORY METHOD: |
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 |
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! |
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. |
And here's the output of the webs_update.sh on Gnuton: https://pastebin.com/886EQVzN#google_vignette |
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. |
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. |
I'm sure she's appreciated having you visit in the evening :) |
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.
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. |
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). |
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. |
Code improvements to obtain a better estimate for the current amount of "Available RAM" to compare with "Required RAM."