LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 11-03-2007, 07:53 AM   #1
kiketg
LQ Newbie
 
Registered: Nov 2007
Posts: 5

Rep: Reputation: 0
Unhappy Memory Problem


I had my server kernel 2.6.9, 512MB ram, and update to 1GB of ram, but Linux don't use that, only uses 512MB. And the rest is unused, I leave here the result of free command.

Code:
 
[root@localhost ~]# free
             total       used       free     shared    buffers     cached
Mem:       1033960     455048     578912          0      14228      50364
-/+ buffers/cache:     390456     643504
Swap:       248996      74964     174032
[root@localhost ~]#
So, what happen??
Before, used the 97% of memory and used the swap, now uses swap and does not use 100% of memory.


ps: sorry bad english.
 
Old 11-03-2007, 03:06 PM   #2
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 997

Rep: Reputation: 130Reputation: 130
Perhaps there was a big app running before issuing "free" which pushed out the 248MB to swap? What does "top" say?
 
Old 11-03-2007, 04:51 PM   #3
kiketg
LQ Newbie
 
Registered: Nov 2007
Posts: 5

Original Poster
Rep: Reputation: 0
This is de TOP

Tops says this!
Code:
top - 18:48:29 up 9 days, 16:24,  1 user,  load average: 0.11, 0.33, 0.36
Tasks:  71 total,   1 running,  70 sleeping,   0 stopped,   0 zombie
Cpu(s):  2.0% us,  2.7% sy,  0.0% ni, 88.3% id,  6.0% wa,  1.0% hi,  0.0% si
Mem:   1033960k total,   491024k used,   542936k free,    25392k buffers
Swap:   248996k total,    91020k used,   157976k free,    76276k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2675 nobody    15   0  236m 222m 2428 S  3.0 22.1 126:13.12 squid
32726 root      15   0 74360  64m 1108 S  1.0  6.4  17:06.22 snort
 3604 root      15   0  3636  720  628 S  0.7  0.1  36:08.96 ipfm
 6858 root      15   0     0    0    0 S  0.3  0.0   0:34.89 kjournald
 2679 nobody    15   0  4016  664  624 S  0.3  0.1   7:57.18 diskd-daemon
    1 root      16   0  2776  564  512 S  0.0  0.1   0:00.80 init
    2 root      34  19     0    0    0 S  0.0  0.0   0:10.73 ksoftirqd/0
    3 root       5 -10     0    0    0 S  0.0  0.0   0:00.13 events/0
    4 root       5 -10     0    0    0 S  0.0  0.0   0:00.00 khelper
    5 root      15 -10     0    0    0 S  0.0  0.0   0:00.00 kacpid
   24 root       5 -10     0    0    0 S  0.0  0.0   0:00.00 kblockd/0
   37 root      15 -10     0    0    0 S  0.0  0.0   0:00.00 aio/0
   25 root      15   0     0    0    0 S  0.0  0.0   0:00.00 khubd
   36 root      15   0     0    0    0 S  0.0  0.0   0:48.45 kswapd0
  111 root      25   0     0    0    0 S  0.0  0.0   0:00.00 kseriod
  185 root      15   0     0    0    0 S  0.0  0.0   0:09.23 kjournald
  467 root       6 -10     0    0    0 S  0.0  0.0   0:00.00 ata/0
  468 root      19   0     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0
  469 root      20   0     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_1
  684 root       6 -10     0    0    0 S  0.0  0.0   0:00.00 kauditd
  746 root      16   0     0    0    0 S  0.0  0.0   0:00.00 kjournald
 1472 root      15   0  1568  588  500 S  0.0  0.1   0:05.39 syslogd
 1476 root      16   0  4032  516  460 S  0.0  0.0   0:00.04 klogd
 3253 ldap      18   0 58216 2156 1912 S  0.0  0.2   0:00.00 slapd
 3260 root      18   0 13288 1232 1196 S  0.0  0.1   0:00.03 slurpd
 3296 root      16   0  5560 1484 1384 S  0.0  0.1   0:02.59 sshd
 3311 root      21   0  6220 1076 1072 S  0.0  0.1   0:00.00 mysqld_safe
 3344 system-m  15   0  120m 4016  868 S  0.0  0.4   0:00.66 system-mysqld
 3426 root      24   0  4560 1076 1072 S  0.0  0.1   0:00.00 mysqld_safe
 3442 root      17   0  3272  496  472 S  0.0  0.0   0:00.00 gpm
 3468 mysql     16   0  125m  12m 2588 S  0.0  1.2   3:57.20 mysqld
 3487 root      16   0 19116 6256 4720 S  0.0  0.6   0:00.62 httpd
 3496 root      15   0  5788 1092  716 S  0.0  0.1   0:01.04 crond
 3613 root      18   0  5448 1044  928 S  0.0  0.1   0:00.00 saslauthd
 3617 root      18   0  5448 1044  928 S  0.0  0.1   0:00.00 saslauthd
 3618 root      18   0  5448 1044  928 S  0.0  0.1   0:00.00 saslauthd
 3619 root      18   0  5448 1044  928 S  0.0  0.1   0:00.00 saslauthd
 
Old 11-03-2007, 07:27 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,967

Rep: Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633
What does "cat /proc/cmdline" produce
 
Old 11-03-2007, 07:47 PM   #5
kiketg
LQ Newbie
 
Registered: Nov 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Produce this
Code:
 ~]# cat /proc/cmdline
ro root=LABEL=/
 
Old 11-04-2007, 05:49 AM   #6
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 997

Rep: Reputation: 130Reputation: 130
You could try have a look at this:
Quote:
Swappiness (2.6 kernels)

Since 2.6, there has been a way to tune how much Linux favors swapping out to disk compared to shrinking the caches when memory gets full.

When an application needs memory and all the RAM is fully occupied, the kernel has two ways to free some memory at its disposal: it can either reduce the disk cache in the RAM by eliminating the oldest data or it may swap some less used portions (pages) of programs out to the swap partition on disk. It is not easy to predict which method would be more efficient. The kernel makes a choice by roughly guessing the effectiveness of the two methods at a given instant, based on the recent history of activity.

Before the 2.6 kernels, the user had no possible means to influence the calculations and there could happen situations where the kernel often made the wrong choice, leading to thrashing and slow performance. The addition of swappiness in 2.6 changes this. Thanks, ghoti!

Swappiness takes a value between 0 and 100 to change the balance between swapping applications and freeing cache. At 100, the kernel will always prefer to find inactive pages and swap them out; in other cases, whether a swapout occurs depends on how much application memory is in use and how poorly the cache is doing at finding and releasing inactive items.

The default swappiness is 60. A value of 0 gives something close to the old behavior where applications that wanted memory could shrink the cache to a tiny fraction of RAM. For laptops which would prefer to let their disk spin down, a value of 20 or less is recommended.

As a sysctl, the swappiness can be set at runtime with either of the following commands:

sysctl -w vm.swappiness=30
echo 30 >/proc/sys/vm/swappiness

The default when Gentoo boots can also be set in /etc/sysctl.conf:
File: /etc/sysctl.conf

# Control how much the kernel should favor swapping out applications (0-100)
vm.swappiness = 30

Some patchsets (e.g. Con Kolivas' ck-sources patchset) allow the kernel to auto-tune the swappiness level as it sees fit; they may not keep a user-set value.
http://gentoo-wiki.com/FAQ_Linux_Memory_Management
 
Old 11-04-2007, 10:35 AM   #7
kiketg
LQ Newbie
 
Registered: Nov 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks, thats works fine!

Last edited by kiketg; 11-04-2007 at 10:47 AM.
 
Old 11-04-2007, 04:23 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,967

Rep: Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633
That's a bit of a surprise - doesn't appear to be any cache/buffer pressure.
@kiketg, what did you set it to ???.
 
Old 11-05-2007, 04:00 AM   #9
kiketg
LQ Newbie
 
Registered: Nov 2007
Posts: 5

Original Poster
Rep: Reputation: 0
I add "vm.swappiness = 0" in /etc/sysctl.conf, and then restart. Then, works fine, here is free result
Code:
[localhost@localdomain ~]# free
             total       used       free     shared    buffers     cached
Mem:       1032788     995836      36952          0     203380     294260
-/+ buffers/cache:     498196     534592
Swap:       248996          0     248996
[localhost@localdomain ~]
PS: Also, try back to "vm.swappiness = 60" then restart and the problem back, so i add "vm.swappiness = 0" and restart.
 
Old 11-05-2007, 05:03 AM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,967

Rep: Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633Reputation: 3633
Yes, I guessed you might have set it to zero - just wanted to check.
Seems to be the solution for several folks, especially for those used to the way 2.4 handled memory. Different situation in your case.
Glad you got it to work as you wanted.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory Problem cosmo289 Ubuntu 5 07-08-2006 02:02 AM
Memory problem sunhui Linux - Hardware 1 02-25-2006 12:43 AM
Out of Memory problem Gilion Linux - General 1 10-17-2003 08:20 AM
Help!?! RH 8 Memory Mapping -High Memory-Virtural Memory issues.. Merlin53 Linux - Hardware 2 06-18-2003 04:48 PM
a memory problem philfighter General 2 12-14-2001 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 07:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration