View Single Post
Old 02-15-2016, 07:03 PM   #9
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by nixkalo View Post
Sorry, English is not my mother language. what I meant with "other side" was:

-your proposal is using what we could loosely call "filesystem bytes" (eMMC) in order to have more virtual memory by using swap
-but the /var (NOT /var/local) filesystem is using tmpfs and does exactly the contrary; it steals "virtual memory bytes" from RAM in order to give us more "filesystem bytes"

Hence my idea of just reducing the space occupied by the /var filesystem.Then it wouldn't use as many VFS blocks, more RAM is available for other things and swap is not needed.
It seems like only 3 files in /etc/upstart would need modification. Partitions are NOT touched.

.... but since I know little about internals of Linux memory management, maybe tmpfs is so "smart" that the following
Code:
[root@kindle /etc]# df /var
Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                    32768      1104     31664   3% /var
means only 1104K (as opposed to 32768) are really used. In which case my proposal is completely useless

BR,
Nix
VFS: Virtual File System

I/O in Linux is 'layered'.

VFS is the 'highest' (closest to kernel code) layer.

On the 'other side' of VFS is a cache system.

The backing store of tmpfs is the memory pages in the cache system.

In general:
Lower the tmpfs usage - increase the free cache pages, reduce the need for actual i/o.
Increase the tmpfs usage - decrease the free cache pages, increase the need for actual i/o.

So using tmpfs for a swap file, decreases the free cache pages, increasing the need for i/o, increasing the use of swap.

But as you can imagine, that is a much longer code path than just leaving the cache pages alone in the first place.

= = = =

There is another way that I haven't tried, but may be worth trying -
What ASUS liked to do with their media player systems.

Create a ram disk, reducing the system memory by however much you use.

Keep in mind that Kindles only had 256 Mbytes of ram for years, it is only recently they went to 512 Mbytes in the most recent models.
So reducing that 512 Mbytes by a few Mbytes **should not** have all that great an impact on the overall system.

Linux, unlike some popular operating systems, can use either files or partitions for swap space.
It can also use multiple files and/or partitions in any combination for swap space.

Each of the members of such a combination of swap stores can be assigned a priority, 0 ... 100, 60 is the default.
The larger numbered stores are used first.

So perhaps we can reduce the (slow to write) use of the eMMC swap space with a smaller, much faster, swap file on ram disk.

I'll try such a setup on my PW-3 (512 Mbyte of ram) tomorrow, and see just how crazy ASUS was with their ramdisk swap file idea.
knc1 is offline   Reply With Quote