Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
only half of my RAM is in use
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
noqrax
n00b
n00b


Joined: 04 Oct 2016
Posts: 51

PostPosted: Sat Oct 15, 2016 11:05 am    Post subject: only half of my RAM is in use Reply with quote

Code:
user@localhost ~ $ free
              total        used        free      shared  buff/cache   available
Mem:        8167344      876880     2242568       60288     5047896     7154888
Swap:             0           0           0


What I did wrong in my installation?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43391
Location: 56N 3W

PostPosted: Sat Oct 15, 2016 11:28 am    Post subject: Reply with quote

noqrax,

Nothing.

You have 2.2G not in use. The 7.1G available, includes the free and buff/cache.
The buff/cache space can be dropped immediately if its already committed to permanent storage, or after the write operation completes if not.

This is why its a bad idea to not have swap space. The kernel can and will 'swap' by dropping data that has a permanent home on HDD, then reload it as required.
You will notice the speed drop, just as with any other form of swapping.
Swap space, be it a file or partition, is only used for dynamically allocated memory. By not having swap, the kernel is robbed of one of its swap mechanisms.

It also explains why if you have the RAM to put /var/tmp/portage into tmpfs, you see little or no speed improvement in build times.
The kernel already does it for you in the buff/cache space reported above. However, putting /var/tmp/portage into tmpfs does save lots of HDD writes that will never be read.
This is considered a good thing for SSD users.

The 2.2G not in use, will reduce as you do more and the amount of buff/cache grows.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
noqrax
n00b
n00b


Joined: 04 Oct 2016
Posts: 51

PostPosted: Sat Oct 15, 2016 12:23 pm    Post subject: Reply with quote

NeddySeagoon wrote:
noqrax,

Nothing.

You have 2.2G not in use. The 7.1G available, includes the free and buff/cache.
The buff/cache space can be dropped immediately if its already committed to permanent storage, or after the write operation completes if not.

This is why its a bad idea to not have swap space. The kernel can and will 'swap' by dropping data that has a permanent home on HDD, then reload it as required.
You will notice the speed drop, just as with any other form of swapping.
Swap space, be it a file or partition, is only used for dynamically allocated memory. By not having swap, the kernel is robbed of one of its swap mechanisms.

It also explains why if you have the RAM to put /var/tmp/portage into tmpfs, you see little or no speed improvement in build times.
The kernel already does it for you in the buff/cache space reported above. However, putting /var/tmp/portage into tmpfs does save lots of HDD writes that will never be read.
This is considered a good thing for SSD users.

The 2.2G not in use, will reduce as you do more and the amount of buff/cache grows.

I tried to connect swap partition using crypttab, but my system not connects it during booting into the system.
Code:
# <name>     <device>               <password>   <options>
swap      UUID=d2a53f07-9788-4afb-a2ef-96555530fb09   /dev/urandom   plain,swap,cipher=aes-xts-plain64:sha256,size=256
home      UUID=f2b7f948-2e36-4bfa-95c6-70aa348bd127   none      luks

Code:
# <fs>                  <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
UUID=c7a9c819-aef9-4cb1-bf17-d31939103b29   /boot      ext4      noatime            1 2
/dev/mapper/swap            none      swap      sw            0 0
/dev/mapper/home            /home      ext4      rw,suid,exec,auto,nouser,async   0 2   
shm        /dev/shm        tmpfs        nodev,nosuid,noexec  0 0
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2971
Location: Germany

PostPosted: Sat Oct 15, 2016 1:03 pm    Post subject: Reply with quote

1. Gentoo does not have a crypttab unless perhaps you switched to systemd?

2. random key swap UUID does not work like this. The UUID does not exist / would be overwritten by the swap the first time it was created.

See https://wiki.archlinux.org/index.php/Dm-crypt/Swap_encryption#UUID_and_LABEL for a workaround the crypttab swap UUID issue.

----

I don't really agree with the necessity of swap. Especially if only half of your RAM is used, there's no real point to it. And your random key swap can not be used for hibernation either - you'd need to know the key on wakeup.

Adding swap will not really make Linux keep your cached stuff in memory. Memory allocation needs to be quick, when something requests a chunk of memory that will always be served by dropping caches first; it will not swap something else out in favour of keeping the caches. The best you can hope for is that whatever got swapped out will never be swapped back in so there will be more free ram for caching afterwards, but if your RAM is never full that scenario basically never applies, so...
Back to top
View user's profile Send private message
Wallsandfences
Guru
Guru


Joined: 29 Mar 2010
Posts: 366

PostPosted: Sat Oct 15, 2016 7:10 pm    Post subject: Reply with quote

NeddySeagoon wrote:


It also explains why if you have the RAM to put /var/tmp/portage into tmpfs, you see little or no speed improvement in build times.
The kernel already does it for you in the buff/cache space reported above. However, putting /var/tmp/portage into tmpfs does save lots of HDD writes that will never be read.
This is considered a good thing for SSDS


Are you saying that it is ok to enable swap spce on a ssd? I would have guessed no in order to spare life cycles of the SSD.
Rüdiger
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43391
Location: 56N 3W

PostPosted: Sat Oct 15, 2016 8:02 pm    Post subject: Reply with quote

Wallsandfences,

As frostschutz, says, swap is rarely used. My swap use rarely goes above 7Mb and once its there, it seems to stay there.
I guess its dynamically allocated RAM that's not needed until shutdown.

Putting /var/tmp/portage on SSD may hurt the SSD more that swar. It all depends on usage patterns.
My media player has had /var/tmp/portage on SSD for over three years. Its updated monthly and has had a couple of emerge -e @worlds too.
It also has 512Mb swap on SSD.

smartctl -x says
Code:
0x01  0x010  4            3015  ---  Power-on Hours
0x01  0x018  6      5823474653  ---  Logical Sectors Written
0x01  0x020  6        48653832  ---  Number of Write Commands
0x01  0x028  6      1085819460  ---  Logical Sectors Read
0x01  0x030  6        38970322  ---  Number of Read Commands
0x07  0x008  1               2  N--  Percentage Used Endurance Indicator

The last statistic says that the drive has used 2% of its useful life.
At my rate of use, it should last about 150 years. That's OK to me.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
The Doctor
Moderator
Moderator


Joined: 27 Jul 2010
Posts: 2586

PostPosted: Sat Oct 15, 2016 9:37 pm    Post subject: Reply with quote

There is no rule that says you can't have an 80 Gig system SSD and a 10 TB mechanical drive for /home and swap, especially if you are concerned with lifetime writes to the SSD.

It may or may not be an option for you, but a mechanical hard drive is still better value per byte for mass data that you don't need to access super fast, ie your photos, music, etc.

Another reason to put /var/tmp/portage in a tmpfs is that failed builds will be automatically purged at shutdown so they won't take over the partition. The disadvantage is that they will be purged at shutdown so you can't go back and read the logs later.
_________________
First things first, but not necessarily in that order.

Apologies if I take a while to respond. I'm currently working on the dematerialization circuit for my blue box.
Back to top
View user's profile Send private message
Wallsandfences
Guru
Guru


Joined: 29 Mar 2010
Posts: 366

PostPosted: Sat Oct 15, 2016 9:45 pm    Post subject: Reply with quote

No, but there's a rule saying that hdd's don't fit into tiny intel nuc's :lol:
Back to top
View user's profile Send private message
noqrax
n00b
n00b


Joined: 04 Oct 2016
Posts: 51

PostPosted: Sun Oct 16, 2016 1:30 am    Post subject: Reply with quote

Guys, can somebody tell me, how to define source by label or UUID in /etc/conf.d/dmcrypt?

P.S.: I just was trying to figure out, why Dota 2 stucks for a second or two, when something new appears on the screen (it usually starts after 10-20min of playing). The first thing I noticed, that my RAM is halfed. But after clearing buffer/cashe, game still freezes for 1-2 seconds. Maybe something wrong with my nvidia card settings?
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