Re: Adding file swap on btrfs

2022-12-23 Thread Chris Murphy
FWIW there are some fixes and enhancements coming in btrfs-progs 6.1, now in 
koji for Rawhide, including making it easier to get info about hibernation file 
offset in a swapfile.

I haven't messed with the new subcommand, but I personally prefer putting 
swapfiles in their own subvolume so that I can still snapshot the root 
subvolume. Snapshotting a subvolume containing a swapfile will render the 
swapfile invalid for use (or maybe the snapshot fails, not sure, haven't tried 
recently).

The way I do this is mount the top-level of the file system (just do a normal 
mount without any options), and inside you'll see what appears to be two 
directories: root and home. Those are the subvolumes the installer creates by 
default. Create a new subvolume in here and add it to fstab such that:

UUID=$fsuuid /var/swap   btrfs   noatime,subvol=swap 0 0

I use chattr +C on this swap subvolume, that way any new files created inside 
will inherit. This is something the new subcommand will do for you.

An additional entry in fstab:
/var/swap/swapfile1 none swap defaults 0 0

You can certainly make a nested /var/swap thereby avoiding the need to create 
the earlier fstab entry. But note that snapshots still don't have this nested 
subvolume in them, so if you do a rollback it also won't have the nested swap 
subvolume or file - thus you boot probably hangs because the fstab is looking 
for this swapfile to activate and never finds it. So I just do it the way I 
describe, that way I can more or less forget about it. But an alternative to 
that, if you really prefer nested, is s/defaults/nofail/ for the swapfile entry 
and now a missing swap won't cause boot to fail *but* you also may one day 
forget all this and come to realize that there's no swap activated because you 
once did a rollback way back when... :D


--
Chris Murphy
___
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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Adding file swap on btrfs

2022-12-19 Thread Barry


> On 19 Dec 2022, at 19:59, Neal Becker  wrote:
> 
> 
> I've just installed f37 on a new lenovo x1 carbon.
> One thing, the installation didn't setup any swap (other than zswap).
> 

That is the preferred way to setup swap. Research has shown that
use of swap files on HDD or SSD is far worse then using the zswap in almost
all desktop workloads.

My advice is to not bother adding a swap file, you are very unlikely to ever 
need it.

Barry



> After a bit of reading I found
> sudo btrfs filesystem mkswapfile -s 32G /swapfile
> But:
>  sudo swapon -v /swapfile 
> swapon: /swapfile: found signature [pagesize=4096, signature=swap] 
> swapon: /swapfile: pagesize=4096, swapsize=1073741824, devsize=34359738368
> 
> Although I created 32G swapfile, only 1G is used.
> swapon 
> NAME   TYPE   SIZE USED PRIO 
> /dev/zram0 partition8G 6.3M  100 
> /swapfile  file  1024M   0B   -2
> 
> 
> What's wrong?
> 
> Thanks,
> Neal
> ___
> 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
> Do not reply to spam, report it: 
> https://pagure.io/fedora-infrastructure/new_issue
___
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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Adding file swap on btrfs

2022-12-19 Thread Samuel Sieb

On 12/19/22 12:19, Jonathan Billings wrote:


On Dec 19, 2022, at 15:10, Samuel Sieb  wrote:


On 12/19/22 11:58, Neal Becker wrote:

I've just installed f37 on a new lenovo x1 carbon.
One thing, the installation didn't setup any swap (other than zswap).
After a bit of reading I found
sudo btrfs filesystem mkswapfile -s 32G /swapfile
But:
 sudo swapon -v /swapfile
swapon: /swapfile: found signature [pagesize=4096, signature=swap]
swapon: /swapfile: pagesize=4096, swapsize=1073741824, 
devsize=34359738368

Although I created 32G swapfile, only 1G is used.
swapon
NAME   TYPE   SIZE USED PRIO
/dev/zram0 partition    8G 6.3M  100
/swapfile  file  1024M   0B   -2
What's wrong?


Something is wrong with how it creates the swap format.  Just run 
"mkswap /swapfile" and it will be


I totally missed the size discrepancy.

I believe in new btrfs versions, you can use:

# btrfs filesystem mkswapfile swapfile
# swapon swapfile


That's what he did, but the swapfs on the volume had the wrong size.  So 
a simple run of mkswap fixes that.  It's still the same volume with all 
the same attributes, just different data.

___
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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Adding file swap on btrfs

2022-12-19 Thread Jonathan Billings

On Dec 19, 2022, at 15:10, Samuel Sieb  wrote:
> 
> On 12/19/22 11:58, Neal Becker wrote:
>> I've just installed f37 on a new lenovo x1 carbon.
>> One thing, the installation didn't setup any swap (other than zswap).
>> After a bit of reading I found
>> sudo btrfs filesystem mkswapfile -s 32G /swapfile
>> But:
>>  sudo swapon -v /swapfile
>> swapon: /swapfile: found signature [pagesize=4096, signature=swap]
>> swapon: /swapfile: pagesize=4096, swapsize=1073741824, devsize=34359738368
>> Although I created 32G swapfile, only 1G is used.
>> swapon
>> NAME   TYPE   SIZE USED PRIO
>> /dev/zram0 partition8G 6.3M  100
>> /swapfile  file  1024M   0B   -2
>> What's wrong?
> 
> Something is wrong with how it creates the swap format.  Just run "mkswap 
> /swapfile" and it will be  

I totally missed the size discrepancy. 

I believe in new btrfs versions, you can use:

# btrfs filesystem mkswapfile swapfile
# swapon swapfile

https://btrfs.readthedocs.io/en/latest/Swapfile.html

Otherwise you need to set the No_COW attribute with `chattr +C 
/path/to/swap/directory`. 

--
Jonathan Billings___
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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Adding file swap on btrfs

2022-12-19 Thread Samuel Sieb

On 12/19/22 12:13, Richard Shaw wrote:
On Mon, Dec 19, 2022 at 2:10 PM Samuel Sieb > wrote:


On 12/19/22 11:58, Neal Becker wrote:
 > I've just installed f37 on a new lenovo x1 carbon.
 > One thing, the installation didn't setup any swap (other than zswap).
 >
 > After a bit of reading I found
 > sudo btrfs filesystem mkswapfile -s 32G /swapfile
 > But:
 >   sudo swapon -v /swapfile
 > swapon: /swapfile: found signature [pagesize=4096, signature=swap]
 > swapon: /swapfile: pagesize=4096, swapsize=1073741824,
devsize=34359738368
 >
 > Although I created 32G swapfile, only 1G is used.
 > swapon
 > NAME   TYPE   SIZE USED PRIO
 > /dev/zram0 partition    8G 6.3M  100
 > /swapfile  file  1024M   0B   -2
 >
 >
 > What's wrong?

Something is wrong with how it creates the swap format.  Just run
"mkswap /swapfile" and it will be fine.


Not quite, without the chattr +C it will still perform COW file 
operations which you don't want on large files.


It's still the same device that was created by the btrfs tool.  I just 
ran the mkswap formatting tool to fix the swap size.

___
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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Adding file swap on btrfs

2022-12-19 Thread Richard Shaw
On Mon, Dec 19, 2022 at 2:10 PM Samuel Sieb  wrote:

> On 12/19/22 11:58, Neal Becker wrote:
> > I've just installed f37 on a new lenovo x1 carbon.
> > One thing, the installation didn't setup any swap (other than zswap).
> >
> > After a bit of reading I found
> > sudo btrfs filesystem mkswapfile -s 32G /swapfile
> > But:
> >   sudo swapon -v /swapfile
> > swapon: /swapfile: found signature [pagesize=4096, signature=swap]
> > swapon: /swapfile: pagesize=4096, swapsize=1073741824,
> devsize=34359738368
> >
> > Although I created 32G swapfile, only 1G is used.
> > swapon
> > NAME   TYPE   SIZE USED PRIO
> > /dev/zram0 partition8G 6.3M  100
> > /swapfile  file  1024M   0B   -2
> >
> >
> > What's wrong?
>
> Something is wrong with how it creates the swap format.  Just run
> "mkswap /swapfile" and it will be fine.
>

Not quite, without the chattr +C it will still perform COW file operations
which you don't want on large files.

Thanks,
Richard
___
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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Adding file swap on btrfs

2022-12-19 Thread Jonathan Billings
On Dec 19, 2022, at 14:59, Neal Becker  wrote:

> I've just installed f37 on a new lenovo x1 carbon.
> One thing, the installation didn't setup any swap (other than zswap).
> 
> After a bit of reading I found
> sudo btrfs filesystem mkswapfile -s 32G /swapfile
> But:
>  sudo swapon -v /swapfile 
> swapon: /swapfile: found signature [pagesize=4096, signature=swap] 
> swapon: /swapfile: pagesize=4096, swapsize=1073741824, devsize=34359738368
> 
> Although I created 32G swapfile, only 1G is used.
> swapon 
> NAME   TYPE   SIZE USED PRIO 
> /dev/zram0 partition8G 6.3M  100 
> /swapfile  file  1024M   0B   -2
> 
> 
> What's wrong?

This is pretty much expected behavior. 

Your zram swap device has a priority of 100, the swap file of -2. 

See the swap(2) man page:
https://linux.die.net/man/2/swapon

Basically, you want to have swapped pages in the compressed memory device, it 
is much faster and essentially is expanding available RAM. If memory pressure 
gets high enough it will use your swap file, but unlikely unless your system is 
really thrashing. 

--
Jonathan Billings___
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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Adding file swap on btrfs

2022-12-19 Thread Samuel Sieb

On 12/19/22 11:58, Neal Becker wrote:

I've just installed f37 on a new lenovo x1 carbon.
One thing, the installation didn't setup any swap (other than zswap).

After a bit of reading I found
sudo btrfs filesystem mkswapfile -s 32G /swapfile
But:
  sudo swapon -v /swapfile
swapon: /swapfile: found signature [pagesize=4096, signature=swap]
swapon: /swapfile: pagesize=4096, swapsize=1073741824, devsize=34359738368

Although I created 32G swapfile, only 1G is used.
swapon
NAME   TYPE   SIZE USED PRIO
/dev/zram0 partition    8G 6.3M  100
/swapfile  file  1024M   0B   -2


What's wrong?


Something is wrong with how it creates the swap format.  Just run 
"mkswap /swapfile" and it will be fine.

___
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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Adding file swap on btrfs

2022-12-19 Thread Neal Becker
On Mon, Dec 19, 2022 at 2:58 PM Neal Becker  wrote:

> I've just installed f37 on a new lenovo x1 carbon.
> One thing, the installation didn't setup any swap (other than zswap).
>
> After a bit of reading I found
> sudo btrfs filesystem mkswapfile -s 32G /swapfile
> But:
>  sudo swapon -v /swapfile
> swapon: /swapfile: found signature [pagesize=4096, signature=swap]
> swapon: /swapfile: pagesize=4096, swapsize=1073741824, devsize=34359738368
>
> Although I created 32G swapfile, only 1G is used.
> swapon
> NAME   TYPE   SIZE USED PRIO
> /dev/zram0 partition8G 6.3M  100
> /swapfile  file  1024M   0B   -2
>
>
> What's wrong?
>
> Thanks,
> Neal
>

Something wrong with btrfs filesystem mkswap.  If I do it the old-fashioned
way:

# truncate -s 0 swapfile# chattr +C swapfile# fallocate -l 2G
swapfile# chmod 0600 swapfile# mkswap swapfile# swapon swapfile

It works correctly
___
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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Adding file swap on btrfs

2022-12-19 Thread Neal Becker
I've just installed f37 on a new lenovo x1 carbon.
One thing, the installation didn't setup any swap (other than zswap).

After a bit of reading I found
sudo btrfs filesystem mkswapfile -s 32G /swapfile
But:
 sudo swapon -v /swapfile
swapon: /swapfile: found signature [pagesize=4096, signature=swap]
swapon: /swapfile: pagesize=4096, swapsize=1073741824, devsize=34359738368

Although I created 32G swapfile, only 1G is used.
swapon
NAME   TYPE   SIZE USED PRIO
/dev/zram0 partition8G 6.3M  100
/swapfile  file  1024M   0B   -2


What's wrong?

Thanks,
Neal
___
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
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: Swap on BTRFS

2020-11-11 Thread Patrick O'Callaghan
On Wed, 2020-11-11 at 01:12 -0700, Chris Murphy wrote:
> On Thu, Nov 5, 2020, 3:24 PM Patrick O'Callaghan 
> wrote:
> 
> 
> > This is a clean install, so it's enabled by default and has reserved
> > 4GB. I think that's what's actually causing the OOMs. I have 16GB of
> > RAM. On F32 I could run an 8GB VM with hugepages, i.e. dedicated
> > memory, plus normal stuff including multiple browser tabs etc. and
> > never had a problem. Now as soon as I try to start the VM it gets OOM
> > errors, and multiple Firefox tabs are failing and have to be restarted.
> 
> 
> Oof!
> 
> One 8G VM , and how many FF tabs? What VM guest?

The guest is Windows 10. I have since configured a large swapfile on my
SSD (with BTRFS) and the improvement has been dramatic, both in
performance and in OOMs (which have vanished completely). There's still
a zram device as well (4GB) but I've just left it untouched for now.

> You can certainly experiment with a custom zram-generator.conf and xhange
> the limit to 16G. You'll get an 8G zram device in this case, if you make no
> other changes to the configuration.
> 
> I'm curious at what minimum zram allocation this problem doesn't happen.
> 6G, 8G, 10G?

Maybe I'll get round to testing that, but for now it works and I'm not
keen to mess with it.

poc
___
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


Re: Swap on BTRFS

2020-11-11 Thread Patrick O'Callaghan
On Wed, 2020-11-11 at 01:04 -0700, Chris Murphy wrote:
> On Thu, Nov 5, 2020, 10:03 AM Patrick O'Callaghan 
> wrote:
> 
> > The swapon(8) man page says:
> > 
> >    The  swap  file  implementation in the kernel expects to be able to
> > write
> >    to the file directly, without the assistance of the filesystem.  This
> > is a
> >    problem on files with holes or on copy-on-write files on filesystems
> > like Btrfs.
> > 
> > As I'm getting OOM errors when I try to run a VM, it looks like I need
> > a swap file or partition. I'd prefer to use part of my (large) SSD for
> > this, but currently it's entirely formatted as BTRFS. Do I need to
> > resize the BTRFS partition rather than using a swap file?
> 
> 
> 
> 
> There's several options depending on the workload.
> 
> swapfile on Btrfs performs the same as a swap partition in my testing. The
> main difference other than the limitations in 'man 5 btrfs' is an
> additional  set of steps are needed to make it possible to do  hibernation.
> 
> The swapfile must not be snapshot. If it is, COW applies and the swapfile
> can no longer be activated. There's several ways to avoid this if you want
> to snapshot root (but not the swapfile). Create a /swap subvolume, or
> /var/swap subvolume. Since btrfa snapshots are not recursive, either of
> these prevents a snapshot of root from snapshotting the swapfile.
> 
> if you aren't doing any snapshotting at all then it doesn't matter you can
> probably make the swapfile most anywhere.
> 
> I've got some work to do to figure out if there's a more elegant way to do
> it. And of course, encryption and SELinux implications.
> 
> The longer story is to automatically create the swap files on demand
> dynamically in the proper location. And in that case possibly use zswap,
> instead of swap on zram.
> 
> It's a bit esoteric, but there is a way to track sysfs memory.stat for page
> faults. And the zram driver tracks some statistics that could be helpful in
> figuring out situations where zram is getting full of seldom used dirty
> pages that are just taking up memory. In those kinds of workloads it's
> probably more beneficial to use conventional disk-based swap. That's
> because disk space swap fully evicts the page, freeing up all of that
> memory, whereas with the zram based swap we are still consuming some
> memory, in effect it's a partial eviction.
> 
> One thing to watch out for with new installs, it's possible we will see
> cases where there's average or below average RAM and heavy Firefox usage.
> And it could be easier to go below the low water threshold on zram-based
> swap, leading to early home issuing SIGTERM to a Firefox tab. This does get
> logged.
> 
> I think the first recommendation is to create a custom zram-generator
> configuration and bump the size of the zram device from 50% ram to 75% ram.
> While 100% is normally OK, it might be a use case better off with disk
> based swap. It just depends on the workload.
> 
> Most users should be ok with the defaults. It's what I'm using most of the
> time for over one year now. But I'm always on the lookout for any issues.

Thanks. For the moment I'm not doing hibernation (it doesn't work
properly when you have a VM guest with GPU passthrough, basically
because the GPU state is not preserved) but I'll keep your notes on
file if I ever change my mind.

poc
___
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


Re: Swap on BTRFS

2020-11-11 Thread Chris Murphy
On Thu, Nov 5, 2020, 3:24 PM Patrick O'Callaghan 
wrote:


> This is a clean install, so it's enabled by default and has reserved
> 4GB. I think that's what's actually causing the OOMs. I have 16GB of
> RAM. On F32 I could run an 8GB VM with hugepages, i.e. dedicated
> memory, plus normal stuff including multiple browser tabs etc. and
> never had a problem. Now as soon as I try to start the VM it gets OOM
> errors, and multiple Firefox tabs are failing and have to be restarted.


Oof!

One 8G VM , and how many FF tabs? What VM guest?

You can certainly experiment with a custom zram-generator.conf and xhange
the limit to 16G. You'll get an 8G zram device in this case, if you make no
other changes to the configuration.

I'm curious at what minimum zram allocation this problem doesn't happen.
6G, 8G, 10G?

--
Chris Murphy
___
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


Re: Swap on BTRFS

2020-11-11 Thread Chris Murphy
On Thu, Nov 5, 2020, 10:03 AM Patrick O'Callaghan 
wrote:

> The swapon(8) man page says:
>
>The  swap  file  implementation in the kernel expects to be able to
> write
>to the file directly, without the assistance of the filesystem.  This
> is a
>problem on files with holes or on copy-on-write files on filesystems
> like Btrfs.
>
> As I'm getting OOM errors when I try to run a VM, it looks like I need
> a swap file or partition. I'd prefer to use part of my (large) SSD for
> this, but currently it's entirely formatted as BTRFS. Do I need to
> resize the BTRFS partition rather than using a swap file?




There's several options depending on the workload.

swapfile on Btrfs performs the same as a swap partition in my testing. The
main difference other than the limitations in 'man 5 btrfs' is an
additional  set of steps are needed to make it possible to do  hibernation.

The swapfile must not be snapshot. If it is, COW applies and the swapfile
can no longer be activated. There's several ways to avoid this if you want
to snapshot root (but not the swapfile). Create a /swap subvolume, or
/var/swap subvolume. Since btrfa snapshots are not recursive, either of
these prevents a snapshot of root from snapshotting the swapfile.

if you aren't doing any snapshotting at all then it doesn't matter you can
probably make the swapfile most anywhere.

I've got some work to do to figure out if there's a more elegant way to do
it. And of course, encryption and SELinux implications.

The longer story is to automatically create the swap files on demand
dynamically in the proper location. And in that case possibly use zswap,
instead of swap on zram.

It's a bit esoteric, but there is a way to track sysfs memory.stat for page
faults. And the zram driver tracks some statistics that could be helpful in
figuring out situations where zram is getting full of seldom used dirty
pages that are just taking up memory. In those kinds of workloads it's
probably more beneficial to use conventional disk-based swap. That's
because disk space swap fully evicts the page, freeing up all of that
memory, whereas with the zram based swap we are still consuming some
memory, in effect it's a partial eviction.

One thing to watch out for with new installs, it's possible we will see
cases where there's average or below average RAM and heavy Firefox usage.
And it could be easier to go below the low water threshold on zram-based
swap, leading to early home issuing SIGTERM to a Firefox tab. This does get
logged.

I think the first recommendation is to create a custom zram-generator
configuration and bump the size of the zram device from 50% ram to 75% ram.
While 100% is normally OK, it might be a use case better off with disk
based swap. It just depends on the workload.

Most users should be ok with the defaults. It's what I'm using most of the
time for over one year now. But I'm always on the lookout for any issues.

--
Chris Murphy
___
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


Re: Swap on BTRFS

2020-11-06 Thread Patrick O'Callaghan
On Fri, 2020-11-06 at 12:50 -0400, George N. White III wrote:
> > # chattr +C swapfile
> > chattr: Invalid argument while setting flags on swapfile
> > 
> 
> Mybe we are no lnpger meant to use chattr: Manual page btrfs-
> property(8)
> says:
> 
> "btrfs property provides an unified and user-friendly method to tune
> different btrfs
> properties instead of using the traditional method like chattr(1) or
> lsattr(1)."

I had already looked at btrfs-property when originally trying to set
this up. Unfortunately it doesn't have options relating to COW (or if
it does they aren't documented). Seems strange to me, but there it is.
I don't know of any other way to do this apart from chattr.

poc
___
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


Re: Swap on BTRFS

2020-11-06 Thread Patrick O'Callaghan
On Fri, 2020-11-06 at 10:59 -0800, Samuel Sieb wrote:
> On 11/6/20 3:36 AM, Patrick O'Callaghan wrote:
> > On Thu, 2020-11-05 at 15:23 -0800, Samuel Sieb wrote:
> > > On 11/5/20 2:23 PM, Patrick O'Callaghan wrote:
> > > > On Thu, 2020-11-05 at 10:47 -0800, Samuel Sieb wrote:
> > > > > Yes.  But have you enabled zram yet for swap?
> > > > 
> > > > This is a clean install, so it's enabled by default and has reserved
> > > > 4GB. I think that's what's actually causing the OOMs. I have 16GB of
> > > > RAM. On F32 I could run an 8GB VM with hugepages, i.e. dedicated
> > > > memory, plus normal stuff including multiple browser tabs etc. and
> > > > never had a problem. Now as soon as I try to start the VM it gets OOM
> > > > errors, and multiple Firefox tabs are failing and have to be restarted.
> > > 
> > > Check what's using the memory.  zram doesn't *reserve* memory.  It
> > > doesn't use any memory until you start swapping out.  Try increasing the
> > > zram size.  I would suggest at least 12GB.  On my 12GB laptop, I have it
> > > set to 12GB.
> > 
> > Trying to get my head around that. You mean all of your RAM is
> > potentially usable as compressed swap? How does that work? Surely it
> > can never reach that limit?
> 
> No, that's the uncompressed size.  In general, the compression is at 
> least 3:1 so the 12GB of swap takes up a maximum of 4GB of RAM.  My zram 
> config appears to be a little confused at this point, but here's what 
> one device looks like:
> # zramctl
> NAME   ALGORITHM DISKSIZE   DATA  COMPR  TOTAL STREAMS MOUNTPOINT
> /dev/zram1 lz4 5G   4.9G   1.3G   1.4G   4
> 
> It's currently storing 4.9GB of swap data using 1.4GB of RAM.

OK.

poc
___
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


Re: Swap on BTRFS

2020-11-06 Thread Samuel Sieb

On 11/6/20 3:36 AM, Patrick O'Callaghan wrote:

On Thu, 2020-11-05 at 15:23 -0800, Samuel Sieb wrote:

On 11/5/20 2:23 PM, Patrick O'Callaghan wrote:

On Thu, 2020-11-05 at 10:47 -0800, Samuel Sieb wrote:

Yes.  But have you enabled zram yet for swap?


This is a clean install, so it's enabled by default and has reserved
4GB. I think that's what's actually causing the OOMs. I have 16GB of
RAM. On F32 I could run an 8GB VM with hugepages, i.e. dedicated
memory, plus normal stuff including multiple browser tabs etc. and
never had a problem. Now as soon as I try to start the VM it gets OOM
errors, and multiple Firefox tabs are failing and have to be restarted.


Check what's using the memory.  zram doesn't *reserve* memory.  It
doesn't use any memory until you start swapping out.  Try increasing the
zram size.  I would suggest at least 12GB.  On my 12GB laptop, I have it
set to 12GB.


Trying to get my head around that. You mean all of your RAM is
potentially usable as compressed swap? How does that work? Surely it
can never reach that limit?


No, that's the uncompressed size.  In general, the compression is at 
least 3:1 so the 12GB of swap takes up a maximum of 4GB of RAM.  My zram 
config appears to be a little confused at this point, but here's what 
one device looks like:

# zramctl
NAME   ALGORITHM DISKSIZE   DATA  COMPR  TOTAL STREAMS MOUNTPOINT
/dev/zram1 lz4 5G   4.9G   1.3G   1.4G   4

It's currently storing 4.9GB of swap data using 1.4GB of RAM.
___
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


Re: Swap on BTRFS

2020-11-06 Thread Patrick O'Callaghan
On Fri, 2020-11-06 at 23:03 +0800, Qiyu Yan wrote:
> Okay, I think I get it now, just don't set
> btrfs property set /SWAP compression no
> seems that this lead to something strange, while I can't tell why but
> it is totally fine to do so, since nocow means no datacsum and no
> compression

OK, that seems to have worked. Trying it now.

poc
___
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


Re: Swap on BTRFS

2020-11-06 Thread George N. White III
On Fri, 6 Nov 2020 at 08:42, Patrick O'Callaghan 
wrote:

> On Fri, 2020-11-06 at 20:27 +0800, Qiyu Yan wrote:
> > Patrick O'Callaghan  于2020年11月6日周五 下午8:14写道:
> > >
> > > On Fri, 2020-11-06 at 11:18 +, Patrick O'Callaghan wrote:
> > > > On Fri, 2020-11-06 at 05:43 +, Qiyu Yan wrote:
> > > > > You can use swapfile on btrfs with nocow
> > > > > [...]
> > > > > https://wiki.archlinux.org/index.php/btrfs#Swap_file for
> instructions
> > > >
> > > > Great. I was actually wondering about precisely that, so I'm glad to
> > > > see it's supported with the right incantations.
> > >
> > > Trying to follow the instructions in the above URL, but clearly I'm
> > > misunderstanding something:
> > >
> > > # btrfs sub create /SWAP
> > > Create subvolume '//SWAP'
> > > # btrfs property set /SWAP compression no
> > > # btrfs sub show /SWAP
> > > root/SWAP
> > > Name:   SWAP
> > > UUID:   1d4d839a-fd4e-d345-8d3f-ea858af71982
> > > Parent UUID:-
> > > Received UUID:  -
> > > Creation time:  2020-11-06 11:41:37 +
> > > Subvolume ID:   1311
> > > Generation: 14657
> > > Gen at creation:14547
> > > Parent ID:  257
> > > Top level ID:   257
> > > Flags:  -
> > > Snapshot(s):
> > > # cd /SWAP
> > > # truncate -s 0 ./swapfile
> > > # chattr +C /SWAP
> > > chattr: Invalid argument while setting flags on /SWAP
> > Try setting +C flag on the file rather than the subvolume itself
>
> # chattr +C swapfile
> chattr: Invalid argument while setting flags on swapfile
>

Mybe we are no lnpger meant to use chattr: Manual page btrfs-property(8)
says:

"btrfs property provides an unified and user-friendly method to tune
different btrfs
properties instead of using the traditional method like chattr(1) or
lsattr(1)."

-- 
George N. White III
___
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


Re: Swap on BTRFS

2020-11-06 Thread Qiyu Yan
Okay, I think I get it now, just don't set
btrfs property set /SWAP compression no
seems that this lead to something strange, while I can't tell why but
it is totally fine to do so, since nocow means no datacsum and no
compression
___
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


Re: Swap on BTRFS

2020-11-06 Thread Patrick O'Callaghan
On Fri, 2020-11-06 at 21:08 +0800, Qiyu Yan wrote:
> see
> lsattr swapfile

# lsattr swapfile
 swapfile
#

poc
___
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


Re: Swap on BTRFS

2020-11-06 Thread Qiyu Yan
see
lsattr swapfile
___
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


Re: Swap on BTRFS

2020-11-06 Thread Patrick O'Callaghan
On Fri, 2020-11-06 at 20:27 +0800, Qiyu Yan wrote:
> Patrick O'Callaghan  于2020年11月6日周五 下午8:14写道:
> > 
> > On Fri, 2020-11-06 at 11:18 +, Patrick O'Callaghan wrote:
> > > On Fri, 2020-11-06 at 05:43 +, Qiyu Yan wrote:
> > > > You can use swapfile on btrfs with nocow
> > > > [...]
> > > > https://wiki.archlinux.org/index.php/btrfs#Swap_file for instructions
> > > 
> > > Great. I was actually wondering about precisely that, so I'm glad to
> > > see it's supported with the right incantations.
> > 
> > Trying to follow the instructions in the above URL, but clearly I'm
> > misunderstanding something:
> > 
> > # btrfs sub create /SWAP
> > Create subvolume '//SWAP'
> > # btrfs property set /SWAP compression no
> > # btrfs sub show /SWAP
> > root/SWAP
> > Name:   SWAP
> > UUID:   1d4d839a-fd4e-d345-8d3f-ea858af71982
> > Parent UUID:-
> > Received UUID:  -
> > Creation time:  2020-11-06 11:41:37 +
> > Subvolume ID:   1311
> > Generation: 14657
> > Gen at creation:14547
> > Parent ID:  257
> > Top level ID:   257
> > Flags:  -
> > Snapshot(s):
> > # cd /SWAP
> > # truncate -s 0 ./swapfile
> > # chattr +C /SWAP
> > chattr: Invalid argument while setting flags on /SWAP
> Try setting +C flag on the file rather than the subvolume itself

# chattr +C swapfile 
chattr: Invalid argument while setting flags on swapfile

poc

___
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


Re: Swap on BTRFS

2020-11-06 Thread Qiyu Yan
Patrick O'Callaghan  于2020年11月6日周五 下午8:14写道:
>
> On Fri, 2020-11-06 at 11:18 +, Patrick O'Callaghan wrote:
> > On Fri, 2020-11-06 at 05:43 +, Qiyu Yan wrote:
> > > You can use swapfile on btrfs with nocow
> > > [...]
> > > https://wiki.archlinux.org/index.php/btrfs#Swap_file for instructions
> >
> > Great. I was actually wondering about precisely that, so I'm glad to
> > see it's supported with the right incantations.
>
> Trying to follow the instructions in the above URL, but clearly I'm
> misunderstanding something:
>
> # btrfs sub create /SWAP
> Create subvolume '//SWAP'
> # btrfs property set /SWAP compression no
> # btrfs sub show /SWAP
> root/SWAP
> Name:   SWAP
> UUID:   1d4d839a-fd4e-d345-8d3f-ea858af71982
> Parent UUID:-
> Received UUID:  -
> Creation time:  2020-11-06 11:41:37 +
> Subvolume ID:   1311
> Generation: 14657
> Gen at creation:14547
> Parent ID:  257
> Top level ID:   257
> Flags:  -
> Snapshot(s):
> # cd /SWAP
> # truncate -s 0 ./swapfile
> # chattr +C /SWAP
> chattr: Invalid argument while setting flags on /SWAP
Try setting +C flag on the file rather than the subvolume itself
>
> What am I missing?
>
> poc
> ___
> 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


Re: Swap on BTRFS

2020-11-06 Thread Patrick O'Callaghan
On Fri, 2020-11-06 at 11:18 +, Patrick O'Callaghan wrote:
> On Fri, 2020-11-06 at 05:43 +, Qiyu Yan wrote:
> > You can use swapfile on btrfs with nocow
> > [...]
> > https://wiki.archlinux.org/index.php/btrfs#Swap_file for instructions 
> 
> Great. I was actually wondering about precisely that, so I'm glad to
> see it's supported with the right incantations.

Trying to follow the instructions in the above URL, but clearly I'm
misunderstanding something:

# btrfs sub create /SWAP
Create subvolume '//SWAP'
# btrfs property set /SWAP compression no
# btrfs sub show /SWAP
root/SWAP
Name:   SWAP
UUID:   1d4d839a-fd4e-d345-8d3f-ea858af71982
Parent UUID:-
Received UUID:  -
Creation time:  2020-11-06 11:41:37 +
Subvolume ID:   1311
Generation: 14657
Gen at creation:14547
Parent ID:  257
Top level ID:   257
Flags:  -
Snapshot(s):
# cd /SWAP
# truncate -s 0 ./swapfile
# chattr +C /SWAP
chattr: Invalid argument while setting flags on /SWAP

What am I missing?

poc
___
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


Re: Swap on BTRFS

2020-11-06 Thread Patrick O'Callaghan
On Thu, 2020-11-05 at 15:23 -0800, Samuel Sieb wrote:
> On 11/5/20 2:23 PM, Patrick O'Callaghan wrote:
> > On Thu, 2020-11-05 at 10:47 -0800, Samuel Sieb wrote:
> > > Yes.  But have you enabled zram yet for swap?
> > 
> > This is a clean install, so it's enabled by default and has reserved
> > 4GB. I think that's what's actually causing the OOMs. I have 16GB of
> > RAM. On F32 I could run an 8GB VM with hugepages, i.e. dedicated
> > memory, plus normal stuff including multiple browser tabs etc. and
> > never had a problem. Now as soon as I try to start the VM it gets OOM
> > errors, and multiple Firefox tabs are failing and have to be restarted.
> 
> Check what's using the memory.  zram doesn't *reserve* memory.  It 
> doesn't use any memory until you start swapping out.  Try increasing the 
> zram size.  I would suggest at least 12GB.  On my 12GB laptop, I have it 
> set to 12GB.

Trying to get my head around that. You mean all of your RAM is
potentially usable as compressed swap? How does that work? Surely it
can never reach that limit?

poc
___
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


Re: Swap on BTRFS

2020-11-06 Thread Patrick O'Callaghan
On Fri, 2020-11-06 at 05:43 +, Qiyu Yan wrote:
> You can use swapfile on btrfs with nocow
> 
> See: 
> https://btrfs.wiki.kernel.org/index.php/FAQ#Does_btrfs_support_swap_files.3F
> 
> And
> 
> https://wiki.archlinux.org/index.php/btrfs#Swap_file for instructions 

Great. I was actually wondering about precisely that, so I'm glad to
see it's supported with the right incantations.

poc
___
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


Re: Swap on BTRFS

2020-11-06 Thread Patrick O'Callaghan
On Thu, 2020-11-05 at 17:46 -0600, Gabriel Ramirez wrote:
> On 11/5/20 4:23 PM, Patrick O'Callaghan wrote:
> > This is a clean install, so it's enabled by default and has reserved
> > 4GB. I think that's what's actually causing the OOMs. I have 16GB of
> > RAM. On F32 I could run an 8GB VM with hugepages, i.e. dedicated
> > memory, plus normal stuff including multiple browser tabs etc. and
> > never had a problem. Now as soon as I try to start the VM it gets OOM
> > errors, and multiple Firefox tabs are failing and have to be restarted.
> > 
> > poc
> maybe is:
> 
> https://fedoraproject.org/wiki/Changes/KDEEarlyOOM
> 
> try:
> 
> sudo systemctl disable earlyoom

Yes, I may do that. However I'd also like to tune the system so it's
not needed. It was never a problem on F32.

poc
___
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


Re: Swap on BTRFS

2020-11-05 Thread Qiyu Yan
Yes, only available on 5.x+ kernel and only for one disk btrfs volume.

And for btrfs, nocow means no checksumming. Because you can't keep atomicity 
with csum when not using cow.
___
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


Re: Swap on BTRFS

2020-11-05 Thread Samuel Sieb

On 11/5/20 9:43 PM, Qiyu Yan wrote:

You can use swapfile on btrfs with nocow

See:
https://btrfs.wiki.kernel.org/index.php/FAQ#Does_btrfs_support_swap_files.3F


So it's something new with 5.x kernels.  I wonder how that works with 
the checksumming.

___
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


Re: Swap on BTRFS

2020-11-05 Thread Qiyu Yan
You can use swapfile on btrfs with nocow

See: 
https://btrfs.wiki.kernel.org/index.php/FAQ#Does_btrfs_support_swap_files.3F

And

https://wiki.archlinux.org/index.php/btrfs#Swap_file for instructions 
___
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


Re: Swap on BTRFS

2020-11-05 Thread Earl Ramirez
On Thu, 2020-11-05 at 15:23 -0800, Samuel Sieb wrote:
> Check what's using the memory.  zram doesn't *reserve* memory.  It 
> doesn't use any memory until you start swapping out.  Try increasing
> the 
> zram size.  I would suggest at least 12GB.  On my 12GB laptop, I have
> it 
> set to 12GB.

This is interesting, I was running F33 with the the following
configurations.

BTRFS RAID1 with two subvolumes / and home

The laptop has 32GB of RAM and 4GB ZRAM

I was experiencing delayed reads especially when I am trying to open a
file from any application (gedit, TeXstudio, etc.) for example, when I
click file open, I will have to wait over 30 seconds before nautilus
opens so that I can select the file. 

To see if it was related with filesystem I switch to my traditional
installation with RAID1, LVM and XFS filesystem and I haven't
experience the similar behaviour when I was using BTRFS. I will try
your recommendations and see if it resolves the issue.


signature.asc
Description: This is a digitally signed message part
___
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


Re: Swap on BTRFS

2020-11-05 Thread Gabriel Ramirez

On 11/5/20 4:23 PM, Patrick O'Callaghan wrote:

This is a clean install, so it's enabled by default and has reserved
4GB. I think that's what's actually causing the OOMs. I have 16GB of
RAM. On F32 I could run an 8GB VM with hugepages, i.e. dedicated
memory, plus normal stuff including multiple browser tabs etc. and
never had a problem. Now as soon as I try to start the VM it gets OOM
errors, and multiple Firefox tabs are failing and have to be restarted.

poc

maybe is:

https://fedoraproject.org/wiki/Changes/KDEEarlyOOM

try:

sudo systemctl disable earlyoom

and

restart
___
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


Re: Swap on BTRFS

2020-11-05 Thread Samuel Sieb

On 11/5/20 2:23 PM, Patrick O'Callaghan wrote:

On Thu, 2020-11-05 at 10:47 -0800, Samuel Sieb wrote:

Yes.  But have you enabled zram yet for swap?


This is a clean install, so it's enabled by default and has reserved
4GB. I think that's what's actually causing the OOMs. I have 16GB of
RAM. On F32 I could run an 8GB VM with hugepages, i.e. dedicated
memory, plus normal stuff including multiple browser tabs etc. and
never had a problem. Now as soon as I try to start the VM it gets OOM
errors, and multiple Firefox tabs are failing and have to be restarted.


Check what's using the memory.  zram doesn't *reserve* memory.  It 
doesn't use any memory until you start swapping out.  Try increasing the 
zram size.  I would suggest at least 12GB.  On my 12GB laptop, I have it 
set to 12GB.

___
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


Re: Swap on BTRFS

2020-11-05 Thread Patrick O'Callaghan
On Thu, 2020-11-05 at 10:47 -0800, Samuel Sieb wrote:
> On 11/5/20 9:02 AM, Patrick O'Callaghan wrote:
> > The swapon(8) man page says:
> > 
> > The  swap  file  implementation in the kernel expects to be able to 
> > write
> > to the file directly, without the assistance of the filesystem.  This 
> > is a
> > problem on files with holes or on copy-on-write files on filesystems 
> > like Btrfs.
> > 
> > 
> > As I'm getting OOM errors when I try to run a VM, it looks like I need
> > a swap file or partition. I'd prefer to use part of my (large) SSD for
> > this, but currently it's entirely formatted as BTRFS. Do I need to
> > resize the BTRFS partition rather than using a swap file?
> 
> Yes.  But have you enabled zram yet for swap?

This is a clean install, so it's enabled by default and has reserved
4GB. I think that's what's actually causing the OOMs. I have 16GB of
RAM. On F32 I could run an 8GB VM with hugepages, i.e. dedicated
memory, plus normal stuff including multiple browser tabs etc. and
never had a problem. Now as soon as I try to start the VM it gets OOM
errors, and multiple Firefox tabs are failing and have to be restarted.

poc
___
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


Re: Swap on BTRFS

2020-11-05 Thread Samuel Sieb

On 11/5/20 9:02 AM, Patrick O'Callaghan wrote:

The swapon(8) man page says:

The  swap  file  implementation in the kernel expects to be able to write
to the file directly, without the assistance of the filesystem.  This is a
problem on files with holes or on copy-on-write files on filesystems like 
Btrfs.

As I'm getting OOM errors when I try to run a VM, it looks like I need

a swap file or partition. I'd prefer to use part of my (large) SSD for
this, but currently it's entirely formatted as BTRFS. Do I need to
resize the BTRFS partition rather than using a swap file?


Yes.  But have you enabled zram yet for swap?
___
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


Swap on BTRFS

2020-11-05 Thread Patrick O'Callaghan
The swapon(8) man page says:

   The  swap  file  implementation in the kernel expects to be able to write
   to the file directly, without the assistance of the filesystem.  This is a
   problem on files with holes or on copy-on-write files on filesystems like 
Btrfs.
   
As I'm getting OOM errors when I try to run a VM, it looks like I need
a swap file or partition. I'd prefer to use part of my (large) SSD for
this, but currently it's entirely formatted as BTRFS. Do I need to
resize the BTRFS partition rather than using a swap file?

poc
___
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