yashsingh1/xdaforums huggingface dataset:
[Magisk] EarlyMon:
Thanks!

Just on the wild outside chance that I *really* doubt, please try this as root in a terminal window and see if it returns anything -

mount | grep swap

And just because -

cat /proc/swap*

Thanks in advance if you can. :)
[Magisk] GreatLordAnt:
Just off to work but I'll get it done soon mate.
[Magisk] yyz71:
Test 8
[Magisk] EarlyMon:
Woo hoo, a Pixel 2! :) :cowboy:

Did you get a measure of how long it took to settle down by any chance?

Test 9 was a no go?
[Magisk] yyz71:
Yes test 9 works like a champ ::good: But no messages though!
[Magisk] EarlyMon:
Yeah, my bad, I didn't think to put in a debug timer. :(

And it's a detached background process so I don't expect it to be visible to anything from the outside while it's running - and I didn't want to get in to toast messages about it being done because I felt like that would be kind of invasive.

So, no user impression about time required, say, by updating RAM Truth (tap where it gives your phone model) after booting?

I really appreciate you taking the time to test them! :)
[Magisk] yyz71:
Hey man I don't mind doing these test for ya.. I'm glad to help in anyway :good:
[Magisk] GreatLordAnt:
First command returns nothing, second in screenshot. Let me know if it's wrong, pretty new to this ?
[Magisk] EarlyMon:
You're doing fine, thanks!

Open RAM Truth so you can see swap easily.

Go to the terminal, as root, and copy/paste this in (usually just long press in the terminal to get the choice to paste) -

( ( echo 0 > /sys/class/zram-control/hot_remove

echo 1 > /sys/block/zram0/reset

/system/bin/swapoff /dev/block/zram0 ) & )

You may have to hit the return/enter key after pasting.

Go back to RAM Truth - you can update the stats by tapping the Device Info block. Update every ten seconds a few times to see if it's going down.

Wait a few minutes and check again.

Expectation - after a few minutes, maybe even 5 or 10 minutes, swap will go to zero in RAM Truth.

Let me know. :)
[Magisk] GreatLordAnt:
[MENTION=2682748]EarlyMon[/MENTION] success my friend. I ran the instruction with su and then opened ram truth, result was instant ?

Well done.
[Magisk] EarlyMon:
:)

Ok, let's try the test 11 module. It may be quick or it may be slow. Running from boot now so I wouldn't be surprised if the timing changed.

Don't worry if it fails - the commands are the same but I have a timing constant in there to unify the solution across different phones.

If it doesn't work, I'll adjust that timing constant next.

Edit - unless something pressing comes up, test 11 above and repeated a few posts down will be finished into the release candidate for the next version.
[Magisk] Dreamer(3MF):
EarlyMon

Thanks for Your Efforts & Time.

I have a Phone with 1M Ram which doesnot support Swap so Could i ask you to advise me By Using Terminal Emulator about Creating/Making 350MB Swap File?

Thanks Again
[Magisk] EarlyMon:
If your kernel does not support swap, you're not going to fix it from the command line.

Nonetheless, assuming that you meant something different from what you said explicitly, here are the commands to get zram started -

https://stackoverflow.com/questions/24467604/swapon-failed-trying-to-enable-zram

Three things -

1. You really are better off with an app that will do this properly for you. I recommend Kernel Aduitor.

2. This is an easy way to screw up your phone if you don't understand the commands or make a human mistake trying it by hand.

3. I am not responsible if anything goes wrong. This is all of the help I'm comfortable giving here so I'm not open to more questions on this, I'm sure you understand - there are much better threads that will be more helpful to you.
[Magisk] EarlyMon:
Test version redacted.
[Magisk] DB126:
He probably means zram. I have yet to find a mainstream Android kernel that does not support 'swap' in some form.

As an aside, I have an older 2GB gizmos that do not support zram. Adding a small 256MB static swap file makes a huge difference maintaining context when multitasking. Improves switch time (lag reduction) in some cases. I actually place the file in the largely unused cache partition which leverages resources that would otherwise go to waste. Nifty solution.
[Magisk] EarlyMon:
Storage swap on Android goes back at least as far as Eclair. As I recall, many were surprised to discover that no one had bothered to turn the feature off, matching your own observation, and the swap to SD card mod was born from that.

Because of the hassle of adding an ext-type partition to an SD card along with speed issues, the hide-swap-in-cache mod was born.

Feel free to correct my version of history on that.

From there, we get in to the reliability issues associated with your choice of storage and that is flatly way out of scope and off-topic for this thread.

But this is not - there's nothing wrong by design with storage-based (aka file-based) swap. It's a known quantity, known art, and primarily a known and fixed implementation in the kernel. Users have to decide if they need or want it, and how they want to host it. It works.

For those reasons, the Swap Torpedo is purpose-built to leave storage-based swap alone.

Zram comes with implementation guidelines from Google.

Kernel source from some manufacturers have shown that the other ODMs will ignore those guidelines and roll their own versions. At least one has ignored the warnings in the kernel source code and configured it wrong. Some are just broken and they won't listen, and others have told me that they don't care what Google said.

And I'm not sure they're all wrong.

I watched over a hundred zram corrections get committed to one of the famous rom code bases in a single weekend. Turns out that dedicated devs around the world had been working for some time trying to fix what was wrong with AOSP zram.

And after they declared victory, it was still broken.

Zram is supposed to be a thing - and it's instead a divergent class of different things.

Swap Torpedo is there because zram is broken on Android and no one has to put up with that.

If there's some argument about the reality of that, please link the thread where it's discussed and everyone can get it over there. :)

There are many fine threads on storage-based swap and many apps to help with that.

Visit those threads and try those apps if you want.

Most all of that is off-topic here as well but as I said, this certainly is not:

Swap Torpedo reasonably tests itself to stay out of the way of storage-based swap. :)
[Magisk] GreatLordAnt:
[MENTION=2682748]EarlyMon[/MENTION] still not working via module I'm afraid. I've just tried both that you've posted and even after an hour no change.
[Magisk] EarlyMon:
Version 11 waited 5 seconds to ensure that swap was running before moving on - after that it did exactly what worked from your terminal.

Just a minute, I'll post a debug version for you...
[Magisk] EarlyMon:
[MENTION=8887123]GreatLordAnt[/MENTION]

Here's version 11 with the debug info I need saved to -

/storage/emulated/0/debug-Torpedo.txt

Let me know if that works out getting the file, thanks!

Edit - removed.
[Magisk] GreatLordAnt:
[MENTION=2682748]EarlyMon[/MENTION] still not working and no output file. Sorry mate.
[Magisk] EarlyMon:
My bad.

Look in /cache/debug-Torpedo.txt with this one.
[Magisk] GreatLordAnt:
Swap Torpedo debug Sun Apr 1 15:40:40 GMT 2018

Exited early Sun Apr 1 15:40:50 GMT 2018
[Magisk] EarlyMon:
Same file please.

Edit - removed
[Magisk] GreatLordAnt:
Success my friend.

Swap Torpedo debug Sun Apr 1 16:05:30 GMT 2018

started Sun Apr 1 16:06:02 GMT 2018

SO = /system/bin/swapoff

DIE = /dev/block/zram0;

j = 0

1
[Magisk] EarlyMon:
Outstanding. :)

So you just need more time for the system to get swap running before Swap Torpedo can do its job.

That's an easy fix.

I'm going to take some time to sort out a method so that it doesn't wait too long for everyone else.

In the meantime, use the debug version - and I'm going to take some family time today before coming back to this.

Thanks for your help! :)
[Magisk] GreatLordAnt:
It's me who should thank you. Enjoy your day ?
[Magisk] EarlyMon:
The v1.1 Release Candidate download is now available at the bottom of the first post.

Edit - not anymore.

If you've been following along, I'm allowing up to 45 seconds for swap to activate now.

[MENTION=8887123]GreatLordAnt[/MENTION] and anyone who tried the debug version - remember to remove the debug file from /cache.

[MENTION=5488402]Davey126[/MENTION] - Yeah, my Readme is way too harsh and beyond my intention. It's also not accurate, even given my opinion. I've corrected it already in the RC and the first post here. I certainly thank you again for bringing up the positive side of swap, no point in throwing out the baby with the bathwater!
[Magisk] DB126:
Note: I only quoted a couple passages in in the interest of space. Definitely recommend reading the entire post by [MENTION=2682748]EarlyMon[/MENTION] if you haven't already.

I certainly agree zram is not perfect and may actually be detrimental to memory management hygiene in some implementations. zswap supposedly addresses many of the limitations but TTBOMK it is not on the radar for Android. Perhaps because Google feels zram is 'good enough'. They are probably right.

I certainly appreciate Swap Torpedo does not broadly target swap and other knobs/dials associated with VM management ... in particular leaving file based swap alone. A very good choice IMHO!

---------- Post added at 09:05 PM ---------- Previous post was at 08:56 PM ----------

Not "harsh" ... impassioned!! That's not a bad thing. :)

Traditional file based swap, zram and Swap Torpedo all have their place. There is no one right answer. This thread does a good job laying out some of the basic arguments without diving into frothing zipperhead territory. It's up to readers to make an informed choice based on their own situation and experiences. I commend you once again for allowing all parties to have a seat at the table and adapting your own presentation based on various discussions.
[Magisk] EarlyMon:
The v1.1 release is official, download at the bottom of the first post.

It's the same working payload as the release candidate but it's better because it will keep the Magisk Manager from telling you to update.

Download is at the bottom of the first post.

I finally filled in the second post so you can enjoy that as a bonus for bouncing back to the beginning. :) ;)
[Magisk] DB126:
Actually, RAM Truth is less than truthful under several different scenarios often misidentifying the type(s) of swap in use and their relative sizes. Diskinfo (available in the Play Store) is an alternative that has proven accurate on my suite of devices. I use the 'pro' build but the freebie should work fine too.
[Magisk] EarlyMon:
The swap size values in RAM Truth come directly from /proc/meminfo and are therefore the kernel's definition of the truth. I never thought of the kernel being less than truthful about what it's showing.

If you can cite specific examples of size disagreements along with illustrations, I'm all eyes and ears.

The type being wrong is something I've been aware of for some time and just haven't had time to sort out.

Please note that the DiskInfo dev points out in the Play Store readme that it's not compatible with Oreo due to permission changes - exactly one of the issues RAM Truth faces, as I mentioned.

It's even worse for Storage Truth on Oreo - the df command under Oreo is now manufacturer-specific - but I digress. Let's stick with the RAM Truth complaint.

PS - this is very much on-topic as the Swap Torpedo also believes /proc/meminfo.
[Magisk] DB126:
Couple snips from a low-end gizmo used primary for content consumption. This pup configured w/64MB zram and 192MB static swap stuffed into the cache partition.
[Magisk] EarlyMon:
The used values are within 2 MB of each other.

Open RAM Truth, tap the Device Info block to force a display update, and repeat it for a few seconds - you'll see the expected drift in used swap and even when idle from the user's point of view, drift occurs normally on a dynamical system. Especially with zram involved.

So, 184.18 vs 186 MB used are really the same value in a dynamic environment. Frankly I'm surprised that you could do an app switch and not see a bigger difference, so, well done on your vm parameters, I must say.

As far as configuring 128 MB in cache, DiskInfo is seeing a different file size of 191 MB and the kernel is telling RAM Truth that it's got 192 MB there.

Edit - I see that you fixed a typo and it's 192 MB.

Not sure what to tell you about that but it would be interesting to see "ls -lFa /cache/*" in a terminal as root. Followed by "cat /proc/meminfo | grep Swapto" while you're there.

As far as the total difference - maybe one tool is better at arithmetic than the other? Or a different choice of rounding error?

Fair warning - RAM Truth scales by factors of 1024. I've never bought in to the dumbed-down definitions scaling by 1000s courtesy of marketing departments and I refuse to adopt the Mebibyte language because it sounds like baby talk. As far as I can tell, the DiskInfo dev and I are in complete agreement on that.

Total and free ram agree so DiskInfo is obviously using /proc/meminfo for that, either directly or indirectly.

From your own description of configurating 192 MB + 64 MB as swap, RAM Truth is the one agreeing with you.

Hardly fair to claim that it's less than truthful going by that.
[Magisk] DB126:
You missed the point. RAM Truth suggests all used 'swap' is zram when is reality is it a combination of zram and file based swap. Nor does it distinguish between the two types.

Schooling on factors of two and resource utilization 'drift' between samples? Oy vey.
[Magisk] EarlyMon:
You said that it was not truthful about values of sizes and I was trying to understand where you got that with an open mind. If you find my attempt schooling, that's not on me.

I said in the first post that it has a type identification problem. I repeated it above. I asked where the RAM values are wrong.

And your complaint is that it has a type identification problem?

And it's worse on a rooted system with a hybrid swap configuration?

You called it less than truthful and I'm missing the point?

What does RAM Truth say at run time about it? Picture attached. That's about as truthful as I could get for the non-rooted market with a tool intended to teach people truthfully what their phone has.

It has a type identification issue that I would never intend to fix for hybrid cases. And even if I wanted to, I'd have a problem doing it on Oreo anyway.

RAM Truth is completely truthful about the numbers shown and as identified in each broad category. Its known limitation was already warned and explained.

Coming in calling it less than truthful under those terms and recommending a replacement that does not run on Oreo is a special form of insanity.
[Magisk] DB126:
Ah - I now see you are the author. Might have chosen different words had those dots connected but the core observation stands. It's fine; I understand your perspective. Differences between the tools have been exposed and readers can choose one or both depending on their interests and needs.

Time to move on. This exchange has clearly touched a nerve which was not the intent. Best wishes.
[Magisk] EarlyMon:
Yeah, I try not to be that guy but there it is.

I was afraid you found a numerical hole in Oreo and could tell me where it was so I wouldn't miss fixing it too while I was after the type problem - the rest speaks for itself.

RAM Truth exists for the easy way to see the overview and to help people with technical terms they see in every app but have never had explained. Its purpose when first built was to clean up confusion over the wrong free memory values that used to be common in settings and to help people to learn why they don't need ram cleaners. Swap type was added as the last thing, and an Easter egg. I'll probably remove it altogether given the permission issues and just rely on the help text.

Storage Truth was to help people understand why they couldn't install more apps and to clarify that the phone manufacturers aren't lying about how much storage they bought. It's spectacularly broken now.

Move on if you want, just know I didn't ask for that. The good gifs are just starting to appear so I'd stay but then I'm easily amused.
[Magisk] DB126:
And for that purpose it achieves its design objective quite well. I use and continue to recommend RAM Truth when swap isn't the focus. Easy to digest. Unfortunately, well intentioned Easter eggs tend to come around and bite you in the tail fluff. Might be best to remove the Swap readout or simply remove the word 'zram' and let it be unqualified. Since very few Android devices run with multiple swap types and/or partitions a simpler representation is probably better.
[Magisk] y2kbugleung:
Thanks for supporting Pixel finally!

RAM Truth [ 4 GB ]

Reserved: 441.31 MB

User: 3654.69 MB

Active: 2948.39 MB

Available: 706.30 MB

Hibernating: 634.73 MB

Idle: 71.57 MB

Swap (total): 0.00 MB

Used (none): 0.00 MB

Device Info:

Android: 8.1.0
Device: taimen
Model: Pixel 2 XL
Maker: Google
RAM Truth: v1.4

Press/touch this row to copy screen info to the clipboard.

Press/touch a component row for component definition or Device Info row to refresh display.

Legend:

Reserved - A reserved/hidden area that includes the below-kernel fixed allocations like DMA buffers, RAM for the baseband radios, CPU(s), GPU, etc. Due to the diverse nature of small-RAM devices, we can only claim better than 99% accuracy here and in the total. All listed values following this, from User through Swap Used, are 100% accurate.

User - The visible (non-hidden) portion of physical RAM available for use by the system.

Active - The amount of physical RAM currently in use by the system.

Available - The amount of physical RAM left unused or used as cache memory.

Hibernating - The amount of physical RAM used as cache memory and using no CPU or power resources. Other apps may be hibernating and written to storage rather than remaining in RAM.

Idle - The amount of physical RAM left unused by the system.

Used (type) - It's impossible to know the actual amount of compression when zram is used without looking at your virtual memory parameters, but it's often about 2 to 1.

Using swap increases your CPU usage, especially with zram where constant compression and decompression is going on (like using zip files on your PC), and is rarely beneficial on modern devices. Despite this, it's made a resurgence in the market.

Swap - A virtual memory scheme to increase your apparent total RAM. Unless you installed a modification to put this in storage, if you have swap you probably have a compressed block of RAM (called zram) acting as a virtual hard disk for this.

Users with rooted devices can very probably find kernel helpers or mods to let you change or turn off swap.
[Magisk] EarlyMon:
You bet! :)

Did it take long after boot to settle down to zero?
[Magisk] bggold:
Yes thanks for pixel support phone is very snappy now.
[Magisk] EarlyMon:
Glad to hear that. :)
[Magisk] y2kbugleung:
Oh?

After boot, I entered the PIN, and run RAM-Truth once the UI is there, and SWAP is 0 already.

Is it too fast? :laugh:

---------- Post added at 12:58 PM ---------- Previous post was at 12:57 PM ----------

Off-topic, I wonder how to disable the SWAP in Linux as well.

The partitions are managed by LVM. I have no idea how to free the occupied storage.

Nowadays we have so much RAM for use. There is no need for SWAP.
[Magisk] EarlyMon:
Nice and fast. :)

Check out the help center for your Linux distribution as it varies. Here are two examples you may want to look at -

https://askubuntu.com/questions/214805/how-do-i-disable-swap

https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-swap-removing-lvm2.html

^ caution, that second one is showing the # root prompt with the commands, so pretty sure that entering them literally will accomplish nothing - the last command in that example, the second # ought to be a ;

You want to avoid taking shortcuts and getting finished processes still holding on to swap (similar to a zombie).

The general steps are usually swapoff -a followed by editing it out of /etc/fstab and finally zeroing out the partition as described in the first link.

Google is your friend to check for the right steps for your distribution - hope that helps. :)
[Magisk] y2kbugleung:
I use ubuntu. I know swapoff, but I am not sure if it free up the patition or what.

For example, there is a 100MB swap partition. Is swapoff just use 0MB of 100MB? Or it free up the 100MB back to /?

Sorry for off topic.

Because of Android and RPi I love Linux now ?
[Magisk] EarlyMon:
Swapoff just turns its use off. Try "man lvremove" for details to begin to reclaim the space.

https://askubuntu.com/questions/532121/problem-removing-swap-partition
[Magisk] Wiciaki:
Hey, I just wanted to say "Thank you" for making our devices run smoother!

Worked wonders for me!

Shame the vendor implementation is so idiotic like putting 6+ gigs RAM and setting up extreme RAM savings...

I hope you dont lose motivation working on this and your other projects :)
[Magisk] axit50:
Is it recommended for Moto G having RAM of 1GB?
[Magisk] EarlyMon:
Glad it helps! :)

My theory is that this all comes down to the modern idea of giving marketing a seat at the product development table above R&D.

One or two percent of the users need something and without it, it's a support nightmare for them. Sales can and will be affected, marketing can't take the hit on the brand reputation.

Marketing demands that it goes in so in it goes and marketing hits the pub, happy that they saved the day because getting requirements right doesn't take an engineering degree or anything.

Meanwhile, R&D sits silently at lunch knowing that the whole thing could have been solved with another user setting and now, once again, 98-99% of the users are going to have something jammed down their throats that don't need it.

Later, marketing will find new things to bring customers back to the table. Things like the screen shape. Or removing an accessory hole because they've dreamed up that they'll sell their own Bluetooth accessory - which never happens and because the days of feature phones when it did are over.

A competent R&D engineer could make the Swap Torpedo unnecessary by making a swap switch in settings in the time it takes for a coffee break.

The Dunning-Kruger Effect in management will see that it never happens.

And that my friend is why we root and fix things. :D

I'll definitely keep an eye out here for any more trouble but you are absolutely correct about other projects. :cool:

Android has an OTG-USB trigger bug I'm tearing into and something needs to be done with decryption on the phone I'm holding. :)

The OTG-USB bug is starting to piss me off, wish me luck lol.
[Magisk] EarlyMon:
Probably not but it's harmless to try and easy to remove if it makes things slower in your case.

Let me know what you think. :)
[Magisk] axit50:
Actually I tried it yesterday and removed today because my device was lagging and it forced me to remove it
[Magisk] EarlyMon:
:good:
[Magisk] :
I had similar problems even though I got 2 GB of RAM. But anyway thanks for developing this! Doesn't hurt to try :highfive:
[Magisk] DB126:
ZRAM, (and to a lesser degree file based) swap sizes can have a significant impact on device responsiveness. Devices that perform poorly with no swap often show marked improvement with a modest swap allocation - say 256MB with 2GB RAM. More is not always better! In most cases I will opt for ZRAM over file based swap depending on kernel support and CPU characteristics. A hybrid solution is sometimes best on devices with a small memory footprint. But that requires additional tunings (eg: swap priorities) that are beyond the scope of this thread. In most cases manufacturer defaults are reasonable if not optimal for devices equipped with 2GB of RAM or less.
[LG G5 Questions & Answers] jimrfraser:
My sim unlocked to telus h831 canadian lg g5 allowes me to switch oem unlock.Never been rooted or modded in anyway that i know off.i baught it at a cell phone store in the mall.Does this mean that my bootloader is unlocked and i can root?