Re: Turn off Swap on boot disk

2019-11-24 Thread gwes

On 11/24/19 9:35 AM, Stuart Henderson wrote:

On 2019-11-22, gwes  wrote:

First, why is your workload causing swapping? That hasn't been
a good idea since the beginning of computing.

Even if the main workload is OK, relinking the kernel (reorder_kernel)
causes swapping on smaller-memory systems.

Been there in 1980 on a KA-10. We fixed the linker to
do multiple passes so it never had to have all the inputs
in core at the same time. Not gonna happen to gnu ld.

Just for giggles I split the link into 4 partials with -r
then linked the partials with the low core.

Reduced RSS from over 200M to about 80M.
The output text size is identical.
Unfortunately some bss allocation changed so I can't
say the output is identical.

That could be tracked down if there were any interest.

Observation: ulimit -d 9 didn't change behavior even
when dsize was well over 100. Or am I assuming wrong things?

I've never seen an Alix so this may be impossible but
why don't you install a larger boot drive?

With how they're often used, it's usually easier to replace the whole
machine. Maybe also cheaper, if they can be replaced by mailing a new
machine rather than having to visit a remote site (swapping the CF card
requires removing the system board from the case, not just opening the
case).

Adding swap on USB is one way to eke out another release or two's use
from the machine that can be done fairly easily without a visit..

All very reasonable when the machine is in someone else's place.
I'm thinking ahead about my little Edgerouter... will I have to
replace that for 6.8? Will i386 die [well, it should have decades ago]

Geoff Steckel



Re: Turn off Swap on boot disk

2019-11-24 Thread Stuart Henderson
On 2019-11-22, gwes  wrote:
> First, why is your workload causing swapping? That hasn't been
> a good idea since the beginning of computing.

Even if the main workload is OK, relinking the kernel (reorder_kernel)
causes swapping on smaller-memory systems.

> I've never seen an Alix so this may be impossible but
> why don't you install a larger boot drive?

With how they're often used, it's usually easier to replace the whole
machine. Maybe also cheaper, if they can be replaced by mailing a new
machine rather than having to visit a remote site (swapping the CF card
requires removing the system board from the case, not just opening the
case).

Adding swap on USB is one way to eke out another release or two's use
from the machine that can be done fairly easily without a visit..




Re: Turn off Swap on boot disk

2019-11-23 Thread Sean Kamath



> On Nov 21, 2019, at 23:54, Theo de Raadt  wrote:
> 
> wait until you see the next thing i'm interested in.  modern
> machines will barely notice it, but alix's will quake.

I look forward to what’s in store.

As for all the other helpful comments (from Theo and others), thank you.  The 
workload is non-critical, and I’m just trying to figure out the best 
trade-offs.  If I felt the trade-offs weren’t worth it, I’d upgrade the 
machines.  I feel I’m on the edge, and, yes, likely 6.7 will be the end of 
their usefulness.  But I already own them, and they’re not useless yet.

Sean


Re: Turn off Swap on boot disk

2019-11-22 Thread gwes

On 11/21/19 2:47 AM, Sean Kamath wrote:

Hello.

Can someone provide me a pointer to how to do this?

I have a bunch of Alix 2d13 boxes.  With 6.6, I’ve found I need more swap than 
the default layout on a 2G compact flash drive has.  So, I got some 1G USB 
thumb drives, and want to use JUST those for swap.  Despite different attempts 
(setting the mount_opts to xx, setting mount_opts to “priority=1”), I can’t 
seem to prevent the swap on the boot disk being added with priority = 0.

Can I do anything to turn it off or change the priority, short of changing the 
filesystem type?

Thanks,
Sean


I think you're trying to solve the wrong problem(s).

First, why is your workload causing swapping? That hasn't been
a good idea since the beginning of computing.

Second, USB sticks are not designed to do frequent writes.
If you need more swap space and have a USB port open, get a cheap 100G
flash drive with a USB interface like a portable drive.

I've never seen an Alix so this may be impossible but
why don't you install a larger boot drive?

Geoff Steckel

































i



Re: Turn off Swap on boot disk

2019-11-22 Thread Theo de Raadt
Sebastien Marie  wrote:

> On Wed, Nov 20, 2019 at 11:47:39PM -0800, Sean Kamath wrote:
> > Hello.
> > 
> > Can someone provide me a pointer to how to do this?
> > 
> > I have a bunch of Alix 2d13 boxes.  With 6.6, I’ve found I need more swap 
> > than the default layout on a 2G compact flash drive has.  So, I got some 1G 
> > USB thumb drives, and want to use JUST those for swap.  Despite different 
> > attempts (setting the mount_opts to xx, setting mount_opts to 
> > “priority=1”), I can’t seem to prevent the swap on the boot disk being 
> > added with priority = 0.  
> > 
> > Can I do anything to turn it off or change the priority, short of changing 
> > the filesystem type?
> 
> If I recall correctly, the swap on the boot disk is directly added by the
> kernel, and not by rc(8). It is why priority in fstab(5) is ignored.

config  bsd swap generic

It is part of the "swap generic" logic.

> But you could change the priority of an already added swap with swapctl(8):
> 
> # swapctl -c -p 1 myduid.b
> 
> And you could automatically run it at boot-time by adding the command line in
> /etc/rc.local file, which is sourced by rc(8).
> 
> # echo 'swapctl -c -p 1 myduid.b' >> /etc/rc.local
> 
> This way, at boot time:
> - kernel adds the boot disk swap with priority 0
> - rc(8) adds the second swap with priority 0 (as configured in fstab(5))
> - rc(8) via rc.local changes the boot disk swap with priority 1
> - system will run with two swaps:
>   - second swap, priority 0, so used first
>   - boot disk swap, priority 1, used if second swap is full or by kernel for 
> dumping kernel core
> 
> I hope it helps.

It could help.  Or, leave it alone.

If you hit swap, you've learned something:  Your machine is too small.



Re: Turn off Swap on boot disk

2019-11-21 Thread Theo de Raadt
Sean Kamath  wrote:

> > On Nov 21, 2019, at 09:55, Kenneth Gober  wrote:
> > ...
> > The need for more swap may be related to kernel relinking -- it might be an
> > interesting experiment to see if your existing swap space is enough with
> > kernel relinking disabled.
> 
> Yes, precisely.
> 
> I did add some larger CF cards on machines that needed more space.  I just 
> happened to have a bunch of 1g thumb drives and figured I’d spare the CF all 
> the writes and use the thumbdrive.
> 
> I was just hoping to avoid removing the default swap device so that in the 
> even the thumb drive died or whatever that the machine would still boot 
> (ideally, just setting the priority to 1 instead of 0 would do what I want).
> 
> But, it sounds like the answer is delete/change the partition or live with 
> it.  I’ll live with it, since I don’t want to disable kernel relinking.

Sigh.

relinking was added because risks have moved on, and smaller machines
are less relevant.

my first programming was on vic-20's.  i wrote in basic.  i ran out
of space.  then i wrote video games in a mix of asm and basic.  then
i ran out of space, and stored stuff in the unused nibbles of colour
table.  the lesson is eventually we need more, because we want to do
more.

we are now many decades later than the vic20, and arguably 2 decades
after the best years of the alix.

as a result, solutions using more resources to create benefits get
added.  wait until you see the next thing i'm interested in.  modern
machines will barely notice it, but alix's will quake.



Re: Turn off Swap on boot disk

2019-11-21 Thread Sebastien Marie
On Wed, Nov 20, 2019 at 11:47:39PM -0800, Sean Kamath wrote:
> Hello.
> 
> Can someone provide me a pointer to how to do this?
> 
> I have a bunch of Alix 2d13 boxes.  With 6.6, I’ve found I need more swap 
> than the default layout on a 2G compact flash drive has.  So, I got some 1G 
> USB thumb drives, and want to use JUST those for swap.  Despite different 
> attempts (setting the mount_opts to xx, setting mount_opts to “priority=1”), 
> I can’t seem to prevent the swap on the boot disk being added with priority = 
> 0.  
> 
> Can I do anything to turn it off or change the priority, short of changing 
> the filesystem type?

If I recall correctly, the swap on the boot disk is directly added by the
kernel, and not by rc(8). It is why priority in fstab(5) is ignored.

But you could change the priority of an already added swap with swapctl(8):

# swapctl -c -p 1 myduid.b

And you could automatically run it at boot-time by adding the command line in
/etc/rc.local file, which is sourced by rc(8).

# echo 'swapctl -c -p 1 myduid.b' >> /etc/rc.local

This way, at boot time:
- kernel adds the boot disk swap with priority 0
- rc(8) adds the second swap with priority 0 (as configured in fstab(5))
- rc(8) via rc.local changes the boot disk swap with priority 1
- system will run with two swaps:
  - second swap, priority 0, so used first
  - boot disk swap, priority 1, used if second swap is full or by kernel for 
dumping kernel core

I hope it helps.
-- 
Sebastien Marie



Re: Turn off Swap on boot disk

2019-11-21 Thread Sean Kamath



> On Nov 21, 2019, at 09:55, Kenneth Gober  wrote:
> ...
> The need for more swap may be related to kernel relinking -- it might be an
> interesting experiment to see if your existing swap space is enough with
> kernel relinking disabled.

Yes, precisely.

I did add some larger CF cards on machines that needed more space.  I just 
happened to have a bunch of 1g thumb drives and figured I’d spare the CF all 
the writes and use the thumbdrive.

I was just hoping to avoid removing the default swap device so that in the even 
the thumb drive died or whatever that the machine would still boot (ideally, 
just setting the priority to 1 instead of 0 would do what I want).

But, it sounds like the answer is delete/change the partition or live with it.  
I’ll live with it, since I don’t want to disable kernel relinking.

Sean



Re: Turn off Swap on boot disk

2019-11-21 Thread Kenneth Gober
On Thu, Nov 21, 2019 at 3:50 AM Sean Kamath 
wrote:

> I have a bunch of Alix 2d13 boxes.  With 6.6, I’ve found I need more swap
> than the default layout on a 2G compact flash drive has.  So, I got some 1G
> USB thumb drives, and want to use JUST those for swap.  Despite different
> attempts (setting the mount_opts to xx, setting mount_opts to
> “priority=1”), I can’t seem to prevent the swap on the boot disk being
> added with priority = 0.
>
> Can I do anything to turn it off or change the priority, short of changing
> the filesystem type?


I wouldn't.  The swap space is sometimes used for other things besides swap
(like crash dumps) so why risk breaking something?  Just add your thumb
drive as additional swap space and leave it be.  If it were me this would
all be a temporary solution anyway while I acquire larger CF cards to
switch to.  I'm a huge fan of not getting rid of old stuff if it's still
working, but when your needs outgrow your hardware, sometimes the simplest
path forward is to just upgrade.

The need for more swap may be related to kernel relinking -- it might be an
interesting experiment to see if your existing swap space is enough with
kernel relinking disabled.

-ken


Turn off Swap on boot disk

2019-11-21 Thread Sean Kamath
Hello.

Can someone provide me a pointer to how to do this?

I have a bunch of Alix 2d13 boxes.  With 6.6, I’ve found I need more swap than 
the default layout on a 2G compact flash drive has.  So, I got some 1G USB 
thumb drives, and want to use JUST those for swap.  Despite different attempts 
(setting the mount_opts to xx, setting mount_opts to “priority=1”), I can’t 
seem to prevent the swap on the boot disk being added with priority = 0.  

Can I do anything to turn it off or change the priority, short of changing the 
filesystem type?

Thanks,
Sean