[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Is there a way to make the pi use swap?



On Monday 17 September 2018 03:18:09 Philip Hands wrote:

> Gene Heskett <gheskett@shentel.net> writes:
> > On Saturday 15 September 2018 16:16:24 Jeffrey Walton wrote:
> >> On Fri, Sep 14, 2018 at 8:16 PM, Alan Corey <alan01346@gmail.com>
> >
> > wrote:
> >> > My /etc/fstab just has
> >> >  /var/swap2 none swap sw 0 0
> >> > That's for a swap file which was made by dding 0s into it, then
> >> > running mkswap.
> >> >
> >> > You'd replace /var/swap2 with /dev/sda2
> >> >
> >> > Sounds like you're just not loading it from your fstab.  Should
> >> > load every boot.  Nothing new or tricky there.
> >>
> >> In addition, it also helps to set swappiness to a low value, like 1
> >> or 3, on modern kernels. That has the effect of telling the kernel
> >> to prefer to keep things in memory.
> >>
> >> With swapon and low swappiness I can actually run a C++ compiler
> >> with multiple jobs and without an OOM kill.
> >>
> >> Jeff
> >
> > And pray tell, where does one set that swappiness?
> > Sounds like something that could be handy.
>
> When wondering that sort of thing, I generally try this sort of
> command to find out:
>
>   sudo find /sys /proc -name \*swappiness\* | less
>
> which in this case leads you quite quickly to /proc/sys/vm/swappiness
>
> which you can do things like:
>
>   cat /proc/sys/vm/swappiness
currently 60
> and
>
>   echo 1 > /proc/sys/vm/swappiness
>
> with.  Of course, that will only persist until the next reboot, so
> you'd then want to set things in /etc/sysctl.* to make things
> permanent.
>
> There are man pages for sysctl.d, sysctl.conf and sysctl, and also a
> README in /etc/sysctl.d/
>
> Something like this (as root) would do the trick:
>
>   echo vm.swappiness=1 > /etc/sysctl.d/local-swapiness.conf
>
> (that's all true on Debian -- no idea how much of that applies for
> *bian derivatives).
>
Like jessie for raspbian? Seems to be there, and that file/contents has 
now been created. So we'll see if it helps.
> Cheers, Phil.

Thank you very much, Phil. But this leads to two more questions, the 
first being:

Can something along this general line by used to make the kernel 
recognize at boot time, the settings contained in the (XFCE) 
menu>preferences>keyboard-and-mouse? I have a pi-3b running jessie that 
has a 500 cps keyboard repeat UNTIL this preference adjuster is run, 
then closed w/o changing anything.

And the 2nd has to do with keyboard and mouse priority, as in it seems 
they are last on the list to get a turn at the internal usb port, 
resulting in (and highly variable percentage depending on unknown 
factors during the boot, so it gets rebooted until it works) thrown away 
mouse and keyboard events.

These two things can be made tolerable, but are a safety consideration 
when they miss-behave, its running heavy machinery.

Finding a fix for those 2 problems would be appreciated very much.

Thanks Phil.

-- 
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>


Reply to: