1

I have an old Raspberry Pi one model B with 256Mb RAM with FreeBSD installed (12.0-CURRENT). Since the device has so little memory, I thought I'd try to use compressed swap in RAM, in order to achieve something similar to what ZRAM does on Linux, so I did the following.

I had 209Mb RAM, 166Mb free:

# freecolor -m -o
             total       used       free     shared    buffers     cached
Mem:           209         42        166          0          0          0
Swap:            0          0          0

Created a memory disk with 50Mb, with -o compress so the data will be compressed before being written:

# mdconfig -a -t malloc -o compress -o reserve -s 50m -u 7

Ok, so I could see that I have 50Mb less available RAM:

# freecolor -m -o
             total       used       free     shared    buffers     cached
Mem:           209         95        114          0          0          0
Swap:            0          0          0

Then I activated a swap device on the newly created disk:

# swapon /dev/md7

So I finally got 50Mb swap, which is mapped onto RAM:

# freecolor -m -o
             total       used       free     shared    buffers     cached
Mem:           209         94        114          0          0          0
Swap:           50          0         50

So -- my first quesion is, will this work as expected? (I mean, will data be compressed when pages are swapped onto /dev/md7?)

And also, why -- since it seems that I still have 114M of available RAM -- can't I create more ramdisks?

# mdconfig -a -t malloc -o compress -o reserve -s 10m -u 8
mdconfig: ioctl(/dev/mdctl): Cannot allocate memory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.