Mailinglist Archive: opensuse-factory (355 mails)

< Previous Next >
Re: [opensuse-factory] TW partitioning propsal swap
  • From: Chris Murphy <lists@xxxxxxxxxxxxxxxxx>
  • Date: Thu, 5 Mar 2020 16:08:24 -0700
  • Message-id: <CAJCQCtSDmG7tZ5-=8ub7bjKXhhg5EOS-NA56gJdz0Hr7X8kDcA@mail.gmail.com>
On Thu, Mar 5, 2020 at 11:15 AM Larry Finger <Larry.Finger@xxxxxxxxxxxx> wrote:

On 3/5/20 11:09 AM, ITwrx wrote:
On 3/5/20 11:06 AM, Axel Braun wrote:
Hi,
I'm just installing TW on a new machine.
Partition proposal is 2GB for swap, with 16GB RAM.
Following that proposal hibernation should never work.
Is RAM =Swap size still a valid assumption?
Viele Grüße
Axel



when i installed TW there was an option for setting swap equal to ram,
for just this reason. Maybe it's not there for all install
images/options? maybe it's just hiding from you?

The requirement is that swap be as large as the compressed contents of RAM. A
factor of 2 in the compression is a reasonable choice.

It's a bit complicated.

1. 50% RAM needs to be free to create the hibernation image, so first
evict enough anon pages to swap
2. create the hibernation image in memory
3. compress and write out the hibernation image to *contiguous space*
in the swap device

Because the workload could result in locality usage of the swap
partition such that there isn't enough contiguous space in the swap
device, it could fail. Also, there's some non-deterministic aspects to
eviction of anonymous pages, and that too can non-deterministically
fail.
https://lore.kernel.org/linux-mm/CAA25o9TvFMEJnF45NFVqAfdxzKy5umzHHVDs+SCxrChGSKczTw@xxxxxxxxxxxxxx/

It's fairly trivial to hit failure on the first step, if
vm.swappiness=0 and you fill up RAM above 50% with e.g. just some
Firefox tabs. If you really think you want vm.swappiness=0 you
actually want vm.swappiness=1 to make sure you don't run into this
problem. In reality, with an SSD or ZRAM backed, you're probably
better off with vm.swappiness=100 because there's no meaningful
difference in cost between reclaim on file pages and anonymous pages.

I think swap 1:1 with RAM is reasonable for most use cases. But if the
workload tends to produce a lot of swap, and/or less compressible
pages, then you might need a bigger swap partition. Or split out
hibernation images into a dedicated file, separate from swapfile (page
file really). I'm not sure how likely that is on Linux. But making it
reliable for the vast majority of workloads has been elusive. Quite a
lot of people say they can't get it to work reliably, and then some
say it works more reliably than S3 (suspend to RAM). *shrug*



--
Chris Murphy
--
To unsubscribe, e-mail: opensuse-factory+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-factory+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups