yashsingh1/xdaforums huggingface dataset:
[Magisk] EarlyMon:
If RAM Truth shows more than zero swap total, and you issued the command as root, it should be similar to the picture in post number 10.

If RAM Truth shows zero swap total, you don't need this module.
[Magisk] kouzelnik3:
Ok, thank you for youw answer. It shows zero. :D
[Magisk] Telperion:
Correct. Adblock, Greenify, Busybox, MagiskHide Props Config. My zram device is at /dev/block/zram0.

Update: I turned swap off from a root shell, it took a minute per 100MB of data being held in swap. So if all 500MB were filled, it would take 5 minutes. I can't speak to whether that's why it's hanging my boot or not. I tried echoing 1 to /sys/block/zram0/reset but it didn't empty the block device.
[Magisk] theduke7:
It seems either not working or not needed on OnePlus 3, I attached a screen, it shows the same thing either the module is installed or not
[Magisk] EarlyMon:
You have a phone that treats the timing of using zram just like a desktop. :)

If zram had filled completely, it could have taken hours to clean up.

Magisk has places for scripts to run right after the file systems are mounted and data is available, and even later than that in the boot up sequence.

I expected to use the first one but during development I discovered that my device and others needed the second one.

Yours needs it earlier.

I've modified the Swap Torpedo to attempt both. If the first one succeeds quickly, the second one will see that there's nothing to do and not waste your time. Others won't notice a difference because the first one will exit gracefully if the system isn't ready for it yet.

Please let me know if it works for you.

(redacted)

If this does not work then you will need a custom modification for your phone, we're at the limits of what Magisk can do.

Let me know if that's required and if you are interested and I can give you pointers for that.

Congratulations, you don't need it.

Somebody ought to mention RAM Truth up in here. ;) :D
[Magisk] zoel.fahmi:
This one is mine
[Magisk] EarlyMon:
Try the new version in the first post please.
[Magisk] Costa02:
Hey this is mine
[Magisk] GreatLordAnt:
This is what I get on lineage 14.1.
[Magisk] Costa02:
do what the OP said... above ;)
[Magisk] GreatLordAnt:
Use the test 4 version linked above? That's what I'm using.
[Magisk] Costa02:
no the version on the first post... ?
[Magisk] GreatLordAnt:
Prerelease 5 was the first one I tried this morning.

Thanks for assistance. Guess I'll just try each release lol
[Magisk] EarlyMon:
Please show me what it says in a terminal when you do the following, thanks -

ls -l /system/bin/swapoff

In each case those are lowercase Ls and there's a space after the s and before the dash.

And as root -

cat /proc/swap*
[Magisk] frenzyboi:
Before installation, Ram truth shows 500mb swap total.

After installation, it changes to 0mb swap total. Am I doing something wrong? May I know the expected output?

On Mi 5 LOS 14.1
[Magisk] EarlyMon:
That's exactly the expected change.

You ought to experience better responsiveness and no degradation in performance.

If you don't like it, uninstall it and it will be as if it was never there - Swap Torpedo does NOT make any permanent changes to your system.

I think that you'll want to keep it. ;) :)
[Magisk] EarlyMon:
So that's two cases of LOS 14.1 - one worked, one didn't.

If there's a kernel deficiency keeping it from working, I don't know if there's much I'll be able to do. :(
[Magisk] Telperion:
Phone boots now with that zip, but zram0 block device still exists. I can try anything, just let me know what to do.
[Magisk] :
It's working for me on lineageos 15.1.
[Magisk] EarlyMon:
Ok - Magisk is a systemless mod, it doesn't affect the actual system.

This mod DOES affect the system.

Make a nandroid backup in TWRP first.

Find where your dot-rc init scripts are - mine are in /system/etc/init as shown below -

View attachment 4455467

Unzip the following file, you will get a text file named noswap.sh and that's it.

View attachment 4455468 *** NOT A MAGISK ZIP FILE

Use a file manager and copy noswap.sh to the dot-rc init files location.

Note the location of the dot-rc init files and substitute it below, in a terminal as root -

cd dot-rc-init-files-location
chown root:root noswap.sh
chmod 755 noswap.sh

You're going to lose Google Pay and anything else that insists on a clean system image.

War could break out on Mars and you may need to restore your nandroid backup. I'm not responsible for any of that or anything else that goes wrong.

If that doesn't work then the only option will be to prevent swap from ever getting turned on in the first place. In that case, send me a private message if you seriously want to proceed with that. ;)

PS - Pixels have the whole A/B partition mirror going on - I just remembered that. You may have to repeat this for each partition. I can't help with that.

Do verify that you booted the modified /system by looking for the noswap.sh file.
[Magisk] Aswin08:
Using my nexus 5 as secondary device, the only issue is lag due to insufficient memory. Can you please brief your device setup along with this mod?
[Magisk] poligarpi:
I can notice that there is a huge difference in performance, however the battery life is kind worse now with this module enabled, I tested for 2 days and I am getting about a half hour less of screen on time
[Magisk] Curiousn00b:
I've enever paid any attention to that, but after some days of use, apps started working weird for me. I'd have to reboot just to get a call, view my contacts, or even view my messages. I experienced it on my 6P and now on my Pixel 2 but only after installing this. Quite odd. p:
[Magisk] EarlyMon:
See my comment a few posts back in case you missed it. :)

That's coindental to your Swap Torpedo installation, not causal, and doesn't occur on any of the several 6P and Pixel 2 installs that I track privately, up through Oreo.

Your best bet is to assume that you have an app that isn't set up correctly, and you can test that by clearing your cache and Dalvik, that will cause your class tables to rebuild and your apps to recompile, without loss of data.

I've had those symptoms when I've run internal free storage below 500 MB but that's really an extreme corner case and I doubt that you would do that on multiple phones.

Also check your running services to see if your media server is going nuts consuming CPU time. If it is you have a media file common to both phones that's driving indexing insane. Most common cause for that would be a corrupted music file but I've also seen it with jpegs. Again, occurring across phones would suggest a music file. Go to your app manager, system processes, Media Storage, clear data, reboot, and wait a half hour for the database to rebuild before using any media. If the media server is still running out of control a few hours later, remove your media files and clear Media Storage again. The fastest way (with a better than 90% success rate) to find a bad media file would be to plug into your pc and start copying over media files. Windows has been pretty good about choking trying to copy a corrupt MP3 file from a phone for me.

Also check to see if you have an app growing consistently in RAM the longer it runs. That's a defective app with what we call a memory leak. If so, that could be leaking faster than when it was swapped out because things swapped out aren't running. In that case you'll need to decide whether to keep the defective app or the Swap Torpedo.

If you're on the developer preview of P, go ahead and uninstall the Swap Torpedo and see if that fixes it. If it does then you'll probably want to leave it off until you have a stable version of P.

Let me know what you find. :)
[Magisk] Curiousn00b:
I'll try to diagnose it when I have off to test for a couple of days. My phone is pretty much always clean due to starting to use cloud things more, and also streaming music.

As for the cache, I've always cleared that when I ran into issues. I have an idea though that may give me more of a an idea for what's going on exactly.

I'll update you when I figure it out. ?
[Magisk] dangerhouse:
on magisk 16.3 no probs, now on 16.6 no functionality. is there a solution/update. thx
[Magisk] AlexxAnders:
For me it's working as usual. What have you done?
[Magisk] dangerhouse:
latest magisk (16.6), latest magisk manager (5.8.1), did uninstall and reinstall, modul is not working. with 16.3 and older manager no problems
[Magisk] Kulaffo:
Not working on my RedMi Note 4X with AEX Rom and KudKernel see the photo
[Magisk] Dreamer(3MF):
Kindly Do The Following

- Download RAM Truth From PlayStore (Or Download Terminal Emulator From PlayStore --> Opent It --> Write

su

--> Click On Enter --> Write

cat /proc/swap*

--> Click On Enter) & Check The Swap Value

- Generally You Need To Check The Swap Value Before Flashing The Module & After Flashing The Module

- Before Flashing The Module: If The Shown Swap Value Is 0, It Means That You Don't Need The Module

- After Flashing The Module: If The Shown Swap Value Is 0, It Means That The Module Is Working Properly

- IF The Swap Value After Flashing The Module Is Less Than The Swap Value Before Flashing The Module, It Means That The Module Has Some Effect On Your Device
[Magisk] dangerhouse:
did the downgrade of magisk to 16.3

problem solved, just for info

thx for the modul
[Magisk] Kulaffo:
Okay thanks for the help
[Magisk] Mort015:
Does i need the module?
[Magisk] FadjarDarwin:
Wooowww man this module making my phone so much faster!!!!!!!!!!!!!!! It works super flawlessly on my mi5 running viperOS final with magisk 16.0. SUPER!!!!!
[Magisk] riccetto80:
better use this module or set zram disksize to 0 in kernel auditor?
[Magisk] Dreamer(3MF):
Give It A Try.
[Magisk] riccetto80:
ok but my question is different!

is better to use this magisk module, or i can do the same using kernel auditor to set up zram disk to 0?

reading all the topic i found out the response from dev to the same question:

So, i will ty to set to 0 using kernel auditor!!!

edit: seems really to made the system more reactive, for example animation in yahoo mail when i check email now is fluid, before was choppy, always... my device (mi a1) have 4gb of ram and the z-ram was set at 1,5gb.... what are thinking at google/xiaomy?
[Magisk] EarlyMon:
Swap Torpedo will work with your phone.

Kernel Adiutor is a great app and I've recommended it often - it is not a kernel mod however. A kernel mod is something that you typically get with a custom kernel or included with a custom rom's kernel.

Sorry for the late replies, family stuff came up, shout out to [MENTION=9018566]Dreamer(3MF)[/MENTION] for helping. :)
[Magisk] KOLIOSIS:
Just wanted to say howdy,hope all is good w/the "family stuff". :good:

Thought you might appreciate a good laugh/scream/etc.......... ;)

If you think that's ridiculous,IIRC,its close cousin,the VIVO NEX S has 2GB Swap............................. :eek:
[Magisk] EarlyMon:
Hello my friend! :)

That's just ridiculous.
[Magisk] riccetto80:
Well, i have a custom kernel, i run francisco franco kernel and kernel auditor let me change the z-ram seething, and ram truth confirm after i apply in kernel auditor 0 z-ram, there is really 0 z-ram available, so seems to work!!!
[Magisk] EarlyMon:
Yes.

I have noted from the second post onwards that Kernel Adiutor will work for many people to take zram to zero.

But as I also said, it is not a kernel mod.

Kernel Adiutor works post-boot as does the Swap Torpedo to dial it back to zero (Swap Torpedo will do it a little bit earlier but it's not a kernel mod either).

A kernel mod prevents zram from ever getting mounted in the first place. That's why I said that it would be the most efficient method, if available from the kernel developer for your device. I was not referring to the Kernel Adiutor or the Swap Torpedo when I said that.

Our solutions exist for those of us without the necessary kernel modification available. Use whichever one you prefer or works for you. :)
[Magisk] riccetto80:
ah, now i understand, thank you!!! is rare see a dev spend time to explain stuff to noobs!!! :D GG!
[Magisk] 4uvak91:
How can I make this module work on Android P Treble?
[Magisk] DanGLES3:
It should work out of the box as the module is not mounting anything is just executing a script at boot
[Magisk] 4uvak91:
When I'm trying install the script from manager it tells me I should have version 15.0+. I have 16.7 Treble installed :eek: from here
[Magisk] DanGLES3:
Is Your magisk 16.7 (1670) or 16.7 (1671) ? check with your magisk app by changing the update channel to fron stable to beta to see if there are any updates
[Magisk] 4uvak91:
Thx. The beta state helped.
[Magisk] DanGLES3:
You updated to the latest beta 1671 then? Its because the latest beta fixed some issues with xiaomi's modded treble implementation
[Magisk] 4uvak91:
Yeah I updated to the latest beta (1671).
[Magisk] fer_cabgar:
This module works on Android P (rom port)?
[Magisk] Dreamer(3MF):
Kindly Check The Following Steps (The Module Isn't Flashed Yet):

- The Module Should Work Because It Doesn't Depend On Any Particular Android Version

- Download RAM Truth From PlayStore (Or Download Terminal Emulator From PlayStore --> Opent It --> Write

su

--> Click On Enter --> Write

cat /proc/swap*

--> Click On Enter) & Check The Swap Value

- Generally You Need To Check The Swap Value Before Flashing The Module & After Flashing The Module

- Before Flashing The Module: If The Shown Swap Value Is 0, It Means That You Don't Need The Module

- After Flashing The Module: If The Shown Swap Value Is 0, It Means That The Module Is Working Properly

- IF The Swap Value After Flashing The Module Is Less Than The Swap Value Before Flashing The Module, It Means That The Module Has Some Effect On Your Device

- The Target Of Swap Torpedo Is Swap (Total) To Be 0

- The Module Doesn't Change The Values Permanently So If You Don't Observe Any Change In The Performance, Uninstall It From Magisk Manager (Magisk Manager --> Modules --> swaptorpedo --> Tap On The Bin Icon) Then Reboot
[Magisk] abd96iq:
doesnt work on my galaxy note 3 aokp oreo rom
[Magisk] Dreamer(3MF):
Kindly Do What Are Mentioned In The Following Post:
[Magisk] abd96iq:
I did all the steps above

installed magisk version 16.7

I've installed busybox too

flashed the module then rebooted and nothing changed
[Magisk] Didgeridoohan:
Your swap is zero... Either the module worked or you didn't need it in the first place.
[Magisk] Dreamer(3MF):
Kindly Check The Following Steps (The Module Is Already Flashed):

- Disable Swap Torpedo From Magisk Manager (Magisk Manager --> Modules --> swaptorpedo --> Tap On The True Icon) Then Reboot --> Download RAM Truth From PlayStore --> Open RAM Truth --> Check The Value Of

Swap (Total)

(This Value Without/Before Using The Module)

- Enable Swap Torpedo From Magisk Manager Then Reboot --> Open RAM Truth --> Check The Value Of

Swap (Total)

(This Value With/After Using The Module)

- Compare The Values According To The Following

- Generally You Need To Check The Swap Value Before Flashing/Using The Module & After Flashing/Using The Module

- Before Flashing/Using The Module: If The Shown Swap Value Is 0, It Means That You Don't Need The Module

- After Flashing/Using The Module: If The Shown Swap Value Is 0, It Means That The Module Is Working Properly

- IF The Swap Value After Flashing The Module Is Less Than The Swap Value Before Flashing The Module, It Means That The Module Has Some Effect On Your Device

- The Target Of Swap Torpedo Is Swap (Total) To Be 0

- The Module Doesn't Change The Values Permanently So If You Don't Observe Any Change In The Performance, Uninstall It From Magisk Manager (Magisk Manager --> Modules --> swaptorpedo --> Tap On The Bin Icon) Then Reboot
[Magisk] EarlyMon:
The Swap Torpedo doesn't depend on any particular Android version and while it's been proven to be highly effective for the usual zram use cases, it's also capable by design of turning off vnswap (Samsung's zram alternative).

RAM Truth is the easy way to check, I usually ask for the /proc/swap* output if there are problems.

As well said by friends above, swap total=zero is zero and that's the Swap Torpedo target. ;) :)
[Magisk] KOLIOSIS:
Slightly OT:

Do you still have/using the Honor View 10 (BKL-L04)?

Just curious,nothing more,currently my DD (only driver ATM,5 days of using the Oppo Find X was enough,the courts & correctional institutions could sentence people to using it in lieu of incarceration/etc....) ;)
[Magisk] EarlyMon:
Yep, the hv10 is doing a good job for me.

I have two other dev projects in the work with it and a little frustrated that I can't get a block of time to move forward with them - it's a family thing though.
[Magisk] KOLIOSIS:
Gotcha,real life comes 1st............. :good:

Running stock/rooted .110 on BKL-L04,should you need a beta tester/etc.. for something,feel free to P.M. me any time. :good:
[Magisk] 73sydney:
Sadly latest version doesn't work on Note 4, Oreo 8.1, latest magisk beta
[Magisk] Dreamer(3MF):
Kindly Check The Following Posts
[Magisk] 73sydney:
Already been through the referred posts, but no way I'm going to downgrade magisk for a single mod, the only one that doesn't work amongst 10 others that do, sorry.

For the moment I've removed it and using kernel aduitor to do the job

I'll keep a lookout for future updates, thanks

Pity, the previous build worked fine
[Magisk] Dreamer(3MF):
What Is The Current Used Magisk Version?
[Magisk] 73sydney:
Latest beta
[Magisk] EarlyMon:
Not uncommon with new betas, that's why they're betas. :)
[Magisk] 73sydney:
Doesn't explain why an earlier version of this module works...
[Magisk] DB126:
As a developer I'm not necessarily going to chase ever changing betas or try to understand 'incompatibilities' with the latest experimental build of someone else's creation. Suspect OP will look into it as time and motivation permits.
[Magisk] EarlyMon:
When you said previous build, I thought you meant of Magisk.

What previous build of the Swap Torpedo worked for you? If you want to upload the zip that worked to avoid confusion, even better.

Magisk betas have broken this module before, corrected in the next Magisk version.

If you found a latent defect in the Swap Torpedo, I'm more than happy to know about it and address it.
[Magisk] narflynn619:
Great work dev, but I had to report it's not doing anything with my Z5 (E6683). RAM Truth still reports 512MB swap after 2 days of use but Terminal Emulator says "deleted." So which one is to be believed?

---------- Post added at 05:37 PM ---------- Previous post was at 05:36 PM ----------

Addendum: I'm using Magisk 16.0, if that's of any help.
[Magisk] Dreamer(3MF):
Could I Ask You To Do The Following?

- Disable Swap Torpedo From Magisk Manager (Magisk Manager --> Modules --> swaptorpedo --> Tap On The True Icon) Then Reboot --> Download RAM Truth From PlayStore --> Open It --> Send Its Screenshot

- Download Terminal Emulator From PlayStore --> Opent It --> Write

su

--> Click On Enter --> Write

cat /proc/swap*

--> Click On Enter --> Send Its Screenshot

- Enable Swap Torpedo From Magisk Manager (Magisk Manager --> Modules --> swaptorpedo --> Tap On The Unchecked-Box Icon) Then Reboot --> Open RAM Truth --> Send Its Screenshot

- Open Terminal Emulator --> Write

su

--> Click On Enter --> Write

cat /proc/swap*

--> Click On Enter --> Send Its Screenshot
[Magisk] EarlyMon:
^ What he said. :)

Magisk 16 is fine.
[Magisk] narflynn619:
Yep did that on Terminal Emulator and also checked RAM Truth since the beginning. Works perfectly fine for my Shield Tablet but not on my Xperia Z5.

After applying the module, the Terminal Emulator result now shows the following:

As you can see, it says deleted but the size still exists unlike on my Tablet which shows nothing already. On RAM Truth, it reports 512MB swap size. On my Shield Tablet it reports 0MB, meaning the module is effective. ?
[Magisk] EarlyMon:
Ok - I've seen this only once before and we're going to have to try some things. Swap is definitely active, the zram partition got marked for deletion, and the kernel never finished the job.

Using my crystal ball, I expect there's a particular type of timing issue (race condition) that's outside of what the Swap Torpedo can help with.

First, uninstall the Swap Torpedo, reboot, recheck using Terminal Emulator. I expect that (deleted) condition to clear. Let me know either way, it will be helpful for others moving forward.

Regardless, you're still going to have an active swap - and I would like you to try the Kernel Adiutor. Go to the virtual memory part, set zram to 0, and apply on boot. Then into its settings and change the apply on boot delay from the 10 seconds default down to 1. Reboot, see if swap is 0 in RAM Truth. If it's not, wait 5 minutes and see if the total used is going down.

If not, go back into Kernel Adiutor settings, increase the delay to 2 seconds - reboot, repeat until it succeeds or until you hit 10 seconds, whichever comes first.

Swap Torpedo starts earlier than Kernel Adiutor. Our goal here is to delay long enough to get away from where the kernel is choking, but no longer than that. I won't be surprised if just the 1 second delay fixes it.

Let me know. :)
[Magisk] narflynn619:
So here's my report, dev:

Upon uninstalling the module from within Magisk Manager and then checking the results via Terminal Emulator, it still produces the same result as I have quoted above: (deleted) but still has a value.

I tried restoring a TWRP backup from a time when I haven't installed the module yet and still shows the same. IDK really if that modification goes along with TWRP backups, I'm not really well-versed in those areas.

Anyway, I tried what you recommended using Kernel Adiutor from the Play Store. I followed exactly what you instructed except on the part where I set 1 second for the delay since the smallest value among the options were 'Instant'. This, however, seem to solve the abovementioned problem since RAM Truth is now reporting 0.00MB for Swap (total) as well as for Used (none). Previously there were values for these at around 512MB even with the module applied.

On the other hand, running the command on Terminal Emulator produces nothing. I mean, no results whatsoever, not even a single text.

Bottomline, I'm assuming the Swap Torpedo module doesn't work on the Z5. However, the zram can still be set to 0MB using Kernel Adiutor.
[Magisk] narflynn619:
Oops, doing what you said on Kernel Adiutor seems to prevent my phone from booting unless I first press the triple-button combination to reset it.
[Magisk] EarlyMon:
Sorry about the option change in Kernel Adiutor, that is a fairly recent change and I didn't check it. :p

It's odd that the Z5 doesn't even have a header line in the swaps file - but nothing surprises me any more. Google provides the basic kernel and an implementation guide for swap, device makers do what they think best.

Did the 5 second delay option affect the booting problem?

And yes, you are correct, the Swap Torpedo is incompatible with your Z5's present boot/initialization stack - nothing I can do about it without breaking it for others. I do thank you for trying the Swap Torpedo in any case! :) And of course I'm happy that it's useful for your other device.

If you can't perfect the solution with timing with the Kernel Adiutor then the only other solutions I can think of with a meaningfully different approach would either be a community kernel (if available, for example, as part of a rom) or by modifying your initialization sequence directly - and that's going to definitely put a big fail on checking SafetyNet.
[Magisk] narflynn619:
Thanks for the support all the way out, great dev. We all are grateful for your awesome work.

One last question, however: Despite reporting (deleted) on the terminal, we can conclude swap is still there right? But how do I remove that (deleted) text? You know, I'm kind of OC on this one, seeing that (deleted) text still there despite having the module uninstalled and the swap still active. :D

Reflashing a clean FTF through Flashtool doesn't do the trick. No success, too, by restoring a TWRP backup. Any ideas? Where exactly does this /dev/block directory live so I can flash the proper component from Flashtool?