Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Strange problem with swap
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Kurogane
n00b
n00b


Joined: 23 May 2010
Posts: 39

PostPosted: Tue Apr 16, 2019 3:38 am    Post subject: Strange problem with swap Reply with quote

Hello everybody,

I cannot understand why but my swap it is not being used never hit.

When i emerge big packages such as gcc, glib etc, always building is killed cc1plus (Killed signal terminated program cc1plus) all indicates because out of RAM but my box never hit swap.

I create swap by partition


Code:
swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda3                            partition            2097144 0       -1


Here free -h

Code:
free -h
              total        used        free      shared  buff/cache   available
Mem:          8.0Gi       7.7Gi        17Mi       130Mi       292Mi       146Mi
Swap:         2.0Gi          0B       2.0Gi


Not work, i create a swapfile if for some reason the partition is bad.

Code:
swapon -s
Filename                                Type            Size    Used    Priority
/dev/sda3                            partition            2097144 0       -1
/swapfile                            file            2097144 0       -2


What's happening?

Hints?
Back to top
View user's profile Send private message
pietinger
n00b
n00b


Joined: 17 Oct 2006
Posts: 48

PostPosted: Tue Apr 16, 2019 7:57 am    Post subject: Reply with quote

Do you have swapping in the kernel enabled ? (General setup ---> Support for paging of anonymous memory (swap))
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 536
Location: Romania

PostPosted: Tue Apr 16, 2019 8:04 am    Post subject: Reply with quote

pietinger wrote:
Do you have swapping in the kernel enabled ? (General setup ---> Support for paging of anonymous memory (swap))



I thought about that. you can't enable swap if you dont have the necessary swap support in the kernel. can't be that. I think.

CONFIG_SWAP=y

But i dont think swap commands work at all if that is not enabled. So it can't be that. I think.
Back to top
View user's profile Send private message
Kurogane
n00b
n00b


Joined: 23 May 2010
Posts: 39

PostPosted: Tue Apr 16, 2019 9:28 pm    Post subject: Reply with quote

Yes, i have that option enabled in kernel.
Back to top
View user's profile Send private message
apiaio
Apprentice
Apprentice


Joined: 04 Dec 2008
Posts: 208

PostPosted: Wed Apr 17, 2019 6:16 pm    Post subject: Reply with quote

IMHO your swap partition is too small. Some sources say, that with 8GB RAM you should use min. 3GB swap without hibernation and 11GB with hibernation.
As HD space is cheap, I would suggest 16 GB size of swap partition.
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1746

PostPosted: Wed Apr 17, 2019 7:18 pm    Post subject: Reply with quote

Quote:
IMHO your swap partition is too small
The size of swap does not seem to be a problem here.
Also, sizing your swap based solely on the total amount of RAM is riddiculous. It all depends on your use case, e.g. sometimes you need an emergency space that will let you complete whatever task you have _eventually_, and other times you'd rather have some process killed to keep the system running at peak performance.

Quote:
(Killed signal terminated program cc1plus) all indicates because out of RAM but my box never hit swap.

Any hints in dmesg? It's a pretty good source of information when weird stuff "just happens".
Chaining it like emerge || dmesg > dmesg.log would ensure your crash is close to the end of your dump file.
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 536
Location: Romania

PostPosted: Wed Apr 17, 2019 7:25 pm    Post subject: Reply with quote

I'm gonna say, but this is a shot in the dark... it's the kernel missing CONFIG_MEMCG_SWAP and CONFIG_MEMCG_SWAP_ENABLED because it's a systemd system and the cgroups for swap are not provided by the kernel.


This is just a guess, because we don't have more information. Kernel version, kernel config, emerge --info
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1294
Location: Frankfurt, Germany

PostPosted: Wed Apr 17, 2019 10:06 pm    Post subject: Reply with quote

Your swap partition (/dev/sda3):
  1. Does it have the correct partition type 82 "Linux swap"? (Look at the output of 'fdisk -l /dev/sda')

  2. Did you format it with 'mkswap /dev/sda3'?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13830

PostPosted: Thu Apr 18, 2019 1:47 am    Post subject: Reply with quote

mike155 wrote:
Your swap partition (/dev/sda3):
  1. Does it have the correct partition type 82 "Linux swap"? (Look at the output of 'fdisk -l /dev/sda')

  2. Did you format it with 'mkswap /dev/sda3'?
As far as I know, Linux does not inspect the partition type for this. Yes, he must have formatted it as swap. Otherwise, he would not be able to use swapon on it, and it can only count toward available swap if it is successfully enabled via swapon.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
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