[pve-devel] [PATCH installer] fix #1239: enhance swap on ZFS setup

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Jan 26 08:41:26 CET 2017


On Wed, Jan 25, 2017 at 11:07:37PM +0100, Andreas Steinel wrote:
> Good! I presume you did not implement the variable page block size due to
> the "controlled kernel" you provide which always has default 4K pages on
> x64?

kind of. the Linux kernel hard-codes the 4K pages for x86 (currently).

getting it dynamically in the installer would only use the page size of
the installer environment/kernel, so that would not gain much.

since it is rather easy to change after the fact if you are running some
crazy kernel of your own ;) or if a future kernel switches to bigger
pages by default, I'll leave this as it is. you can just zfs destroy the
old swap zvol and zfs create a new one after all (volblocksize is not
changeable for obvious reasons).

> 
> On Wed, Jan 25, 2017 at 4:03 PM, Fabian Grünbichler <
> f.gruenbichler at proxmox.com> wrote:
> 
> > set properties according to upstream documentation
> >
> > Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
> > ---
> >  proxinstall | 25 ++++++++++++++++---------
> >  1 file changed, 16 insertions(+), 9 deletions(-)
> >
> > diff --git a/proxinstall b/proxinstall
> > index 18df7bb..0642098 100755
> > --- a/proxinstall
> > +++ b/proxinstall
> > @@ -762,19 +762,26 @@ sub zfs_create_rpool {
> >  sub zfs_create_swap {
> >      my ($swapsize) = @_;
> >
> > -    syscmd ("zfs create -V ${swapsize}K -b 4K $zfspoolname/swap")  == 0 ||
> > -       die "unable to create zfs swap device\n";
> > +    my $cmd = "zfs create -V ${swapsize}K -b 4K";
> >
> > -    syscmd ("zfs set com.sun:auto-snapshot=false $zfspoolname/swap") == 0
> > ||
> > -       die "unable to set zfs properties\n";
> > +    $cmd .= " -o com.sun:auto-snapshot=false";
> >
> >      # reduces memory pressure
> > -    syscmd ("zfs set sync=always $zfspoolname/swap") == 0 ||
> > -       die "unable to set zfs properties\n";
> > +    $cmd .= " -o sync=always";
> >
> > -    # copies for swap does not make sense
> > -    syscmd ("zfs set copies=1 $zfspoolname/swap") == 0 ||
> > -       die "unable to set zfs properties\n";
> > +    # cheapest compression to drop zero pages
> > +    $cmd .= " -o compression=zle";
> > +
> > +    # skip log devices
> > +    $cmd .= " -o logbias=throughput";
> > +    # only cache metadata in RAM (caching swap content does not make
> > sense)
> > +    $cmd .= " -o primarycache=metadata";
> > +    # don't cache anything in L2ARC
> > +    $cmd .= " -o secondarycache=none";
> > +
> > +    $cmd .= " $zfspoolname/swap";
> > +    syscmd ($cmd)  == 0 ||
> > +       die "unable to create zfs swap device\n";
> >
> >      return "/dev/zvol/$zfspoolname/swap";
> >  }
> > --
> > 2.1.4
> >
> >
> > _______________________________________________
> > pve-devel mailing list
> > pve-devel at pve.proxmox.com
> > http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> >
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list