LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   problem with swapoff -a (https://www.linuxquestions.org/questions/linux-server-73/problem-with-swapoff-a-860137/)

mahmoodn 02-02-2011 01:03 AM

problem with swapoff -a
 
In our cluster, both the server and worker had been gone to swap and the performance is extremely slow. Although currently the memory is free but I don't know why the in the swap area is still being there and ubuntu doesn't move them to the memory and empty the swap.

On the other hand, when I run
Code:

sudo swapoff -a
on the server it says:
Code:

mahmood@server:~$ sudo swapoff -a
[sudo] password for mahmood:
swapoff: /dev/sda1: swapoff failed: Cannot allocate memory

Any idea about that?

prodev05 02-02-2011 01:06 AM

While switching off the swap, the running apps, doesn't know to take which memory. Is that apps cluster or OS Cluster?

mahmoodn 02-02-2011 01:16 AM

I don't exactly what you mean but they are normal applications and not OS

prodev05 02-02-2011 01:22 AM

some thing happened inside memory allocator. some thing junky-monkey :P

syg00 02-02-2011 01:27 AM

Quote:

Originally Posted by mahmoodn (Post 4245418)
Although currently the memory is free

How did you determine that ?. Show us evidence - /proc/meminfo would be acceptable.

swapoff is designed to fail if sufficient memory can't be allocated.

mahmoodn 02-02-2011 01:32 AM

Code:

mahmood@server:~$ cat /proc/meminfo
MemTotal:      33013844 kB
MemFree:          71028 kB
Buffers:          15480 kB
Cached:          370436 kB
SwapCached:      2124200 kB
Active:        26670708 kB
Inactive:        5321516 kB
Active(anon):  26630268 kB
Inactive(anon):  4977432 kB
Active(file):      40440 kB
Inactive(file):  344084 kB
Unevictable:      15784 kB
Mlocked:          15784 kB
SwapTotal:      62698488 kB
SwapFree:      33240212 kB
Dirty:              120 kB
Writeback:          124 kB
AnonPages:      30788868 kB
Mapped:            12224 kB
Shmem:                80 kB
Slab:              98160 kB
SReclaimable:      61580 kB
SUnreclaim:        36580 kB
KernelStack:        3816 kB
PageTables:      130440 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    79205408 kB
Committed_AS:  66997324 kB
VmallocTotal:  34359738367 kB
VmallocUsed:      364908 kB
VmallocChunk:  34333713840 kB
HardwareCorrupted:    0 kB
HugePages_Total:      0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:      2048 kB
DirectMap4k:        9920 kB
DirectMap2M:    3135488 kB
DirectMap1G:    30408704 kB


druuna 02-02-2011 01:37 AM

Hi,
Quote:

.....and ubuntu doesn't move them to the memory and empty the swap.
If the amount of (free) physical memory is less then the amount occupied by swap, then you cannot turn off swap.

Quote:

In our cluster, both the server and worker had been gone to swap and the performance is extremely slow.
Turning off swap won't solve this problem, it will probably make it worse. Without any extra info it looks like your machine tries to allocate more resources then it has available.

Hope this helps.

mahmoodn 02-02-2011 01:39 AM

how can i sort processes by memory usage? TOP command sort them by cpu usage

druuna 02-02-2011 01:51 AM

Hi,

Using top: Start top, press F or O and select the field you want to sort on.

Hope this helps.

robertjinx 02-02-2011 01:54 AM

Try to drop all caches from memory, but maybe first stop all main apps and then drop caches:

Code:

echo "3" > /proc/sys/vm/drop_caches
wait... for like a min, then

Code:

echo "0" > /proc/sys/vm/drop_caches
and check if you can swap off after.

Also, this might not help, because from what I saw in /proc/meminfo, you don't seems to have too much caches objects, but you can always try.

mahmoodn 02-02-2011 02:44 AM

Thanks. I found the honger process and emptied the swap.


All times are GMT -5. The time now is 01:26 PM.