News for hackers. Stuff that matters.
Re:macOS 10.15 Vista by Lio on Wednesday October 09, 2019 @02:56AM (#21200747)
The only real problem I have left with my XPS13 is with sleep/hibernate.

I’d like it to work like macOS. It seems like that’s possible but it requires a swapfile to save state to. As far as I can tell that means enabling virtual memory which is a no no on SSD.

Just that and I wish Bluetooth remembered the on/off state it was left in after reboot.

Re:macOS 10.15 Vista by JustFinishedBSG on Wednesday October 09, 2019 @03:49AM (#21200991)
Both s2idle and deep ( https://www.kernel.org/doc/Documentation/power/states.txt ) are what you want, and work.

> Just that and I wish Bluetooth remembered the on/off state it was left in after reboot.

That's just a Qualcomm problem. The BT is completely broken. Fixed in the latest kernel for me.

Re:macOS 10.15 Vista by Lio on Wednesday October 09, 2019 @09:22AM (#21202898)
I might be missing something but doesn't that still depend on swap space and having a swapfile and virtual memory set up?

I'm fine with having a swapfile but I don't want it used for anything other than Suspend-to-disk. i.e. I don't want the SSD being hit with multiple writes caused by VM.

Re:macOS 10.15 Vista by JustFinishedBSG on Wednesday October 09, 2019 @11:23AM (#21204068)
No they just enter lower power states and keep everything in RAM. I don't even have a swap and it works fine.
Re:macOS 10.15 Vista by Lio on Wednesday October 09, 2019 @01:17PM (#21205383)
Sorry maybe I'm not explaining what I want to very well.

On the Mac it will suspend to RAM but also dump to an image file at the same time. If the mac runs out of power it will later restore from the image once power is restored.

That's possible on Linux using hybrid-sleep and suspend-then-hibernate but they require a swapfile.

I haven't yet found a way to have a swapfile without allowing that swapfile to be used for virtual memory too. I worry that virtual RAM will eat my SSD.

Re:macOS 10.15 Vista by seba_dos1 on Wednesday October 09, 2019 @01:54PM (#21205869)
How often do you upgrade your drive? If you expect to change it sometime in next 5 years or so, I wouldn't worry about using swap on SSD at all.
Re:macOS 10.15 Vista by Lio on Thursday October 10, 2019 @04:00AM (#21212004)
To be honest I hadn’t really considered that. I’ve never actually upgraded an SSD in a laptop.

I guess it may be more the thought that it will kill the SSD than the reality but it’s still something I’d prefer to avoid if there’s a solution.

Re:macOS 10.15 Vista by phoe-krk on Wednesday October 09, 2019 @03:03AM (#21200776)
> It seems like that’s possible but it requires a swapfile to save state to.

Has macOS solved this issue differently? Do they save RAM state to some non-SSD non-volatile memory, or do they just not care and dump it to SSD anyway?

Re:macOS 10.15 Vista by eknkc on Wednesday October 09, 2019 @03:27AM (#21200895)
I believe they favour sleep mode where the ram is powered on and the state is kept alive on ram. Only when the sleep time goes too long or battery starts running low, they dump into SSD.
Re:macOS 10.15 Vista by Lio on Wednesday October 09, 2019 @09:23AM (#21202915)
It's not the swapfile that's the issue it's having the swapfile also be used for virtual memory.

If it was only used for suspend that would be fine because it would only be written to when you suspend the laptop, which in the grand scheme of things is pretty rare compared to writes caused by virtual memory swapping.

Re:macOS 10.15 Vista by chungus_khan on Wednesday October 09, 2019 @01:32PM (#21205574)
Mac OS does the same in this regard though, but in my experience neither Mac OS or Linux are particularly aggressive at using swap anyway.
Re:macOS 10.15 Vista by seba_dos1 on Wednesday October 09, 2019 @01:57PM (#21205906)
Yup, macOS dynamically allocates swap files on disk when they're needed - that's why you may see 0 swap space in htop, which doesn't mean that it doesn't use swap.
Re:macOS 10.15 Vista by Lio on Thursday October 10, 2019 @04:03AM (#21212021)
That’s interesting. I wonder can Linux be persuaded to dynamically alter the swap space from 0 as part of the suspend script?
Re:macOS 10.15 Vista by chungus_khan on Thursday October 10, 2019 @07:44AM (#21213307)
I think if you were to use a swapfile and set swappiness to zero it should behave like this.
Re:macOS 10.15 Vista by Lio on Friday October 11, 2019 @04:35AM (#21222543)
Brilliant! I think this is the going to be the answer. Have the swapfile but use swappiness to tell the kernel not to use it day to day. Thank you :D