LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Memory Problem (https://www.linuxquestions.org/questions/linux-hardware-18/memory-problem-596827/)

kiketg 11-03-2007 08:53 AM

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.

Pearlseattle 11-03-2007 04:06 PM

Perhaps there was a big app running before issuing "free" which pushed out the 248MB to swap? What does "top" say?

kiketg 11-03-2007 05:51 PM

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


syg00 11-03-2007 08:27 PM

What does "cat /proc/cmdline" produce

kiketg 11-03-2007 08:47 PM

Produce this
Code:

~]# cat /proc/cmdline
ro root=LABEL=/


Pearlseattle 11-04-2007 06:49 AM

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

kiketg 11-04-2007 11:35 AM

Thanks, thats works fine! :)

syg00 11-04-2007 05:23 PM

That's a bit of a surprise - doesn't appear to be any cache/buffer pressure.
@kiketg, what did you set it to ???.

kiketg 11-05-2007 05:00 AM

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.

syg00 11-05-2007 06:03 AM

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.


All times are GMT -5. The time now is 05:33 PM.