Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 03 Sep 2015, 00:52
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Howto: 1. freeupRAM ; 2. freeswap ; 3. runaway /sbin/udevb
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [8 Posts]  
Author Message
mcewanw

Joined: 16 Aug 2007
Posts: 2598
Location: New Zealand

PostPosted: Thu 02 Jun 2011, 01:13    Post subject:  Howto: 1. freeupRAM ; 2. freeswap ; 3. runaway /sbin/udevb  

HOWTO free up RAM of reserved cache and buffers space:

1. A long time ago I posted a tip on how to regularly free up RAM of the caches and buffers used by Linux (the cache and buffers used does gradually fill up again of course):
http://www.murga-linux.com/puppy/viewtopic.php?t=43298

Code:

#!/bin/sh
sync && echo 3 > /proc/sys/vm/drop_caches


I somewhat unnecessarily uploaded it as a one liner script called freeupram too:
http://www.murga-linux.com/puppy/viewtopic.php?p=356501&search_id=1802544596#356501

It works.


HOWTO free up swap space:

2. However, for a long time I've noticed another problem in terms of my low-memory (256MByte) low-end (500MHz CPU) old laptop machine, which is currently running Wary 500:

Even when quite a bit of free RAM remains available... the machine has a tendency to eventually use a little swap. Once that happens, I've observed that the machine becomes noticably slower... (even when the amount swapped stays very low - a few tens of kilobytes even...). I suspect a problem with the algorithm used in Linux to determine when swap should occur.

For my machine, I'd like to have no swapping at all unless a certain percentage of RAM was being utilised, but I know of no method for doing exactly that.

I've tried: echo 0 > /proc/sys/vm/swappiness; a mechanism I earlier also discussed here: http://www.murga-linux.com/puppy/viewtopic.php?p=313208&search_id=1801896506#313208

In practice, however, that does not stop swap occurring.

What does I find work, which is why I'm providing this tip, and I've been using this method for a long time, is to regularly empty swap as follows:

Code:

swapoff <whatever_your_swap_partition_is>
# on my machine I use: swapoff /dev/sda3 (since that's my swap partition...)
swapoff <whatever_your_swap_partition_is>


(Note that on my machine I use /dev/sda3 as my swap partition).

You might like to run "sync" first though I rarely bother...

So if you've noticed your system gradually slowing down, the method I'm suggested may be the "keep-your-old-machine-running-fastish" solution you need...

The method isn't perfect, because if the system RAM really is over-utilised, turning off swap as per the above can crash the system. However, today, when I was looking into the matter further, I stumbled across the following script at help.ubuntu.com which suggested the same as I already do, but which checks for the RAM already over-utilised danger. I haven't bothered providing a ready-made script of this, so just cut and paste it into your favourite text editor, save it as, say, "freeswap", make the script executable and put it in, for example, in /usr/sbin or somewhere in your else in your "PATH"):

Very slightly modified from https://help.ubuntu.com/community/SwapFaq:

Code:

#!/bin/sh
err="not enough RAM to write swap back, nothing done"
mem=$(free|grep Mem:|awk '{print $4}')
swap=$(free|grep Swap:|awk '{print $3}')
[ $mem -lt $swap ] && echo -e $err && exit 1
swapoff <whatever_your_swap_partition_is> && swapon <whatever_your_swap_partition_is> && exit 0


You need to of course replace <whatever_your_swap_partition_is> with whatever it is... (or use the -a option to swap if all your swap partitions are listed in /etc/fstab)

HOWTO somewhat drastically at least resolve a runaway /sbin/udev daemon problem I've come across in irregular circumstances:

3. One last thing I've come across in this system-slowing-down regard (which is probably hard to reproduce without the dodgy power connector problem I have...):

One of my old laptop machines (300MHz Celeron, 256 MBytes, running Wary 500) has a dodgy power connector. For reasons I know nothing about, that occasionally causes a great deal of activity from the daemon: /sbin/udevd --daemon --resolve-names=never Indeed, running "top" when that happens reveals the CPU io load becomes really high when the power becomes intermittent in that fashion; the fan turns on and the machine slows to a crawl... Killing off the /sbin/udevd daemon then has the dramatic effect of fixing the problem... I do wonder why /sbin/udevd doesn't recover by itself when I jiggle the power connector about a bit, which does restore "regular" power to my machine. Perhaps someone has an answer. For now I just mention it here, with what at least is a (somewhat drastic) "remedy".

[EDIT: I'm currently experimenting with running freeupram and freeswap regularly (every ten minutes or so) with cron (in Wary at least, you can use Menu->System->Pschedule to conveniently set up crontab entries)]

_________________
SomeOfMyWork: pAVrecord Precord Premote DoMyFile DoMyCommand fokSyfEyeR xhippo-mod flite_hts_pet Pfetch WIAKAPPS Pcreole DebMintDogDevWork
Back to top
View user's profile Send private message Visit poster's website 
Guy

Joined: 26 May 2008
Posts: 52

PostPosted: Sat 04 Jun 2011, 11:27    Post subject: sorry post not working
Subject description: will try again later
 

I saw your post & thought of this:

https://help.ubuntu.com/community/SwapFaq#What is swappiness and how do I change it?

this should deter the kernel from using swap when you still have RAM

Hope this helps
G
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11525
Location: Arizona USA

PostPosted: Sat 04 Jun 2011, 15:11    Post subject:  

Guy, I removed the URL tags. The forum has a quirk where, if it doesn't think the URL inside the tags is valid, it will show a blank post.
Back to top
View user's profile Send private message 
Guy

Joined: 26 May 2008
Posts: 52

PostPosted: Sat 04 Jun 2011, 17:07    Post subject:  

@Flash - thanks. You have no idea how many ways I tried to sort this.
Back to top
View user's profile Send private message 
jakfish

Joined: 18 Jul 2008
Posts: 761

PostPosted: Sat 04 Jun 2011, 17:34    Post subject:  

mcewanw--

This was an extremely helpful post, many thanks. I'm running 4.31 on an old Sony Vaio Picturebook, only 114mb available RAM, so every bit counts.

Much obliged,
Jake
Back to top
View user's profile Send private message 
mcewanw

Joined: 16 Aug 2007
Posts: 2598
Location: New Zealand

PostPosted: Sun 05 Jun 2011, 05:51    Post subject: Re: sorry post not working
Subject description: will try again later
 

Guy wrote:
I saw your post & thought of this:

https://help.ubuntu.com/community/SwapFaq#What is swappiness and how do I change it?

this should deter the kernel from using swap when you still have RAM

Hope this helps
G


Thanks Guy... but if you check my first post carefully you should notice that I already discussed and included exactly that same link! :-)

The problem I was discussing is that Linux has a tendency to swap whether or not you make the swappiness value 0. Hence the script to empty swap I suggested.

_________________
SomeOfMyWork: pAVrecord Precord Premote DoMyFile DoMyCommand fokSyfEyeR xhippo-mod flite_hts_pet Pfetch WIAKAPPS Pcreole DebMintDogDevWork
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 2988
Location: www.eussenheim.de/

PostPosted: Sun 05 Jun 2011, 07:34    Post subject: Re: sorry post not working
Subject description: use %23
 

Guy wrote:
I saw your post & thought of this:

https://help.ubuntu.com/community/SwapFaq#What is swappiness and how do I change it?

this should deter the kernel from using swap when you still have RAM

Hope this helps
G


replace # by %23

https://help.ubuntu.com/community/SwapFaq%23#What

Thanks to nooby who reported first that % has to be used
http://www.murga-linux.com/puppy/viewtopic.php?t=67213&start=49
Back to top
View user's profile Send private message 
Ether

Joined: 21 Aug 2013
Posts: 80

PostPosted: Sat 29 Aug 2015, 10:25    Post subject: Re: 1. freeupRAM ; 2. freeswap ; 3. runaway /sbin/udevb  

.
mcewanw @ http://www.murga-linux.com/puppy/viewtopic.php?p=529914#529914 wrote:
...
HOWTO free up swap space:
...


I'm running DD Squeeze on a 15-year-old machine with a single 12GB disk with only one partition (GPartEd shows only sda1... no swap partition) and 385MB RAM.

Does that mean there will be no swapping and I don't need this script?

.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [8 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1010s ][ Queries: 11 (0.0049s) ][ GZIP on ]