Sreyan Chakravarty <sreya...@gmail.com> 于 2020年12月6日周日 下午6:23写道:

> On Sun, Dec 6, 2020 at 1:29 PM Samuel Sieb <sam...@sieb.net> wrote:
>
>> Are you actually using the swap?  If you aren't, or only very little,
>> then you aren't going to notice anything.  It will only use RAM if
>> you're swapping out pages.
>>
>>
> Well I do have a lot of open tabs in chrome and firefox for testing.
> I haven't noticed any difference, but that's just my perception,
> I won't know anything unless a real benchmark is run.
>

https://chrisdown.name/2018/01/02/in-defence-of-swap.html

A good article answering why we need swap.

>
> I have definitely noticed a drastic improvement on my laptop after
>> setting up zram and as I mentioned, I'm using a *lot* more than the
>> default.  Do check out the very large threads from -devel a while back
>> on this topic.
>>
>
> Ok after reading up on this topic I have a little more knowledge and
> context and have some questions.
>
> Please forgive my ignorance, I do not wish to be glib, I understand that
> these are extremely complex topics.
>
> Now my questions are as follows:
>
> 1) Why not have separate partitions for swap and hibernate ?
>
> Seems the number one problem when it comes to using hibernation is that
> there is no kernel support for dedicating where the hibernation will be
> done dedicatedly.
> It uses the swap and if it does not have enough contiguous memory then it
> will fail.
> An obvious fix would be to have a dedicated hibernation file/partition and
> use zram for swap.
>
> It is currently possible to have both partition/file and zram for swap but
> no way to mark the partition/file for just hibernation exclusively, AFAIK.
>
> This separation seems like an essential feature then why has more work not
> gone into this ?
>
> I only ask since Windows provides a dedicated Hibernate file called
> hiberfil.sys.
>
IDK, maybe just because no one is working on this. But changing PRIO may do
similar thing, page swap to zram and hibernat to disk.

Or another workaround, swapon the hibernation only file and swapoff all
others before hibernation happens. This could be able to do with some
tricks with systemd.

>
> 2)  Can we have on-demand hibernate files ?
>
> Why not just create a hibernate file each time we hibernate ?
>
It's hard to do so, resuming from swap file needs to be done before
mounting any filesystem, thus systemd in initramfs needs to know where the
file is, usually the information is passed to initramfs via kernel cmdline.
While it is possible to create a new swap file on hibernation and rewrite
kernel cmdline, but IIRC nobody implements that.

So you have to stick to a swapfile and hardcode its block path and offset
on kernel cmdline.

>
> Thanks for all your help.
>
> --
> Regards,
> Sreyan Chakravarty
> _______________________________________________
> users mailing list -- users@lists.fedoraproject.org
> To unsubscribe send an email to users-le...@lists.fedoraproject.org
> Fedora Code of Conduct:
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
> https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
>
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to