Author Topic: linux low IO performance on /dev/ram ?!?  (Read 5177 times)

0 Members and 1 Guest are viewing this topic.

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
linux low IO performance on /dev/ram ?!?
« on: February 28, 2018, 11:14:23 pm »
Code: [Select]
dd if=/dev/zero of=/dev/ram0 bs=1k count=4000
4000+0 records in
4000+0 records out
4096000 bytes (3.9MB) copied, 0.736300 seconds, 5.3MB/s

/dev/ram0 is ram, PC133 SDRAM! And the CPU is 266Mhz, how can IO performance on a RAM disk can be so ... slow?

What can be wrong? (there is no bus, no DMA, in the middle)  :palm: :palm: :palm:

 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #1 on: February 28, 2018, 11:15:41 pm »
linux-4.11

Code: [Select]
~ # cat /proc/cpuinfo
processor       : 0
cpu             : 405GP
clock           : 266.640000MHz
revision        : 1.69 (pvr 4011 0145)
bogomips        : 533.28
timebase        : 266640000
Memory          : 48 MB
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #2 on: February 28, 2018, 11:24:21 pm »
(it's a PowerPC 405GP by IBM/AMCC, the core is similar to a PPC603)
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: linux low IO performance on /dev/ram ?!?
« Reply #3 on: March 01, 2018, 03:44:12 am »
Is /dev/ram SUPPOSED to be a high-performance interface?  I would have guessed (without any actual knowledge) a sort of raw access to ramdisk from user space, probably involving multiple context switches and pager remapping for each block (or even for each byte...)  All the higher performance code would be stuck in the higher level drivers.  Sort-of like trying to access a hard drive with a "read sector" API.
 

Offline llkiwi2006

  • Regular Contributor
  • *
  • Posts: 105
  • Country: nz
Re: linux low IO performance on /dev/ram ?!?
« Reply #4 on: March 01, 2018, 03:57:21 am »
What is the performance like on a tmpfs? /dev/ram isn't used that much anymore. Also, try with a bigger block size, you might be limited by the CPU's performance.
 

Offline helius

  • Super Contributor
  • ***
  • Posts: 3640
  • Country: us
Re: linux low IO performance on /dev/ram ?!?
« Reply #5 on: March 01, 2018, 04:35:37 am »
Suggest you monitor the process with iostat
 

Offline hans

  • Super Contributor
  • ***
  • Posts: 1638
  • Country: nl
Re: linux low IO performance on /dev/ram ?!?
« Reply #6 on: March 01, 2018, 09:25:57 am »
Well, what figures do you actually expect to get?

I think 5MB/s on so much overhead is actually very respectable. Note that /dev/mem is a character device, so it must go through all the device driver layers, before it can finally commit the write.
If you want faster performance, I suppose you need to escape the user land.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #7 on: March 01, 2018, 10:17:10 am »
I was expecting 20 Mbyte/sec at least since it's a block of ram pre-allocated in an area that the kernel can't use for anything else.

I am experimenting the same kind of problem with a special block-device I have created recycling the MTD's code. It's a true-ram-disk used to store the rootfs, but it gives 3Mbyte/sec  :palm: :palm: :palm:
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: linux low IO performance on /dev/ram ?!?
« Reply #8 on: March 01, 2018, 10:34:31 am »
IDK, but for comparison, look:

Code: [Select]
pi@xu4:~$ sudo dd if=/dev/zero of=/dev/ram0 bs=1k count=4000
[sudo] password for pi:
4000+0 records in
4000+0 records out
4096000 bytes (4.1 MB) copied, 0.0402256 s, 102 MB/s

Code: [Select]
pi@bananapi:~$ sudo dd if=/dev/zero of=/dev/ram0 bs=1k count=4000
[sudo] password for pi:
4000+0 records in
4000+0 records out
4096000 bytes (4.1 MB) copied, 0.0706718 s, 58.0 MB/s

Code: [Select]
pi@odroidc1:~$ sudo dd if=/dev/zero of=/dev/ram0 bs=1k count=4000
[sudo] password for pi:
4000+0 records in
4000+0 records out
4096000 bytes (4.1 MB) copied, 0.0324672 s, 126 MB/s

Code: [Select]
pi@orangepipc:~$ sudo dd if=/dev/zero of=/dev/ram0 bs=1k count=4000
[sudo] password for pi:
4000+0 records in
4000+0 records out
4096000 bytes (4.1 MB) copied, 0.0309904 s, 132 MB/s

The further a society drifts from truth, the more it will hate those who speak it.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #9 on: March 01, 2018, 11:05:34 am »
yes, there is something wrong with my kernel!
/dev/ram0 is not /dev/mem, and it' a true block-device!

the problem is WTF is wrong?!?!?
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #10 on: March 01, 2018, 11:24:12 am »
The PPC405GP comes with a Synchronous DRAM (SDRAM) interface operating up to 133MHz
and it's 32-bit interface for non-ECC applications

Can't be so slow!!!

The kernel was (cross-)compiled with  powerpc-unknown-linux-gnu-v4.2.4 ...
I wonder ... if it needs some special "flags", but PPC405GB should be a true-PPC603 core  :-// :-// :-//
 

Offline donotdespisethesnake

  • Super Contributor
  • ***
  • Posts: 1093
  • Country: gb
  • Embedded stuff
Re: linux low IO performance on /dev/ram ?!?
« Reply #11 on: March 01, 2018, 11:32:18 am »
Sounds like you've never used software before  :-DD
Bob
"All you said is just a bunch of opinions."
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #12 on: March 01, 2018, 12:12:38 pm »
Sounds like you've never used software before  :-DD

sure, I a porn-actor  :-//
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #13 on: March 01, 2018, 12:15:36 pm »
I have changed the cross-builder's profile  and I am building a new gcc-toolchain with "-m405", that (I hope) should force gcc to be ppc405-optimized  :-//

I am open to better advice! ( I am more an HDL-guy than a linux-guy )
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #14 on: March 01, 2018, 01:19:00 pm »
Code: [Select]
mount -t tmpfs /mnt/disk0/ /mnt/disk0/
rm /root/here
uc-walnut-earlyrootfs disk0 # dd if=/dev/zero of=/mnt/disk0/here bs=1k count=5000
5000+0 records in
5000+0 records out
5120000 bytes (4.9MB) copied, 0.530093 seconds, 9.2MB/s

 :palm: :palm: :palm:
 

Offline Bruce Abbott

  • Frequent Contributor
  • **
  • Posts: 627
  • Country: nz
    • Bruce Abbott's R/C Models and Electronics
Re: linux low IO performance on /dev/ram ?!?
« Reply #15 on: March 01, 2018, 05:30:29 pm »
Code: [Select]
mount -t tmpfs /mnt/disk0/ /mnt/disk0/
rm /root/here
uc-walnut-earlyrootfs disk0 # dd if=/dev/zero of=/mnt/disk0/here bs=1k count=5000
5000+0 records in
5000+0 records out
5120000 bytes (4.9MB) copied, 0.530093 seconds, 9.2MB/s

 :palm: :palm: :palm:
What happens if you increase the block size?

For reference, here are the results for different buffer sizes on my ancient 50MHz Amiga 1200:-

Code: [Select]
Device: ram:
Comment A1200 with Blizzard 1230-50 MKII (50MHz 68030)
Test Intensity: High  Performance Stress: None

      147 Files/s Create
      249 Files/s Open/Close
     1620 Files/s Scan
      279 Files/s Delete

      688 Seek/Read

Buffer Size 512 4096 32768 262144
--------- --------- --------- --------- ---------
Bytes/s Create    582605   1355734   1631826   1672495
Bytes/s Write    828824   4391582   9418787 11012736
Bytes/s Read    837769   4449206   9644387 11302545
Faster than a 266MHz PPC with PC133 SDRAM!
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #16 on: March 01, 2018, 07:07:33 pm »
What happens if you increase the block size?

tmpfs stays around 9Mbyte/sec
/dev/ram0 stays around 4.5Mbyte/sec

I can't understand why the  PPC405GP's ram controller (built-in) is so slow.

I have re-created the toolchain, and gcc is now using a special flag for the 405GP, but .. it's still slow.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #17 on: March 01, 2018, 07:08:51 pm »
oh, tried kernels from 2.6.22 to 2.6.39, and then the 4.11

there is no difference  :palm: :palm: :palm:
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: linux low IO performance on /dev/ram ?!?
« Reply #18 on: March 01, 2018, 07:33:17 pm »
An OrangePi PC is only $15 :-)
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline Monkeh

  • Super Contributor
  • ***
  • Posts: 7992
  • Country: gb
Re: linux low IO performance on /dev/ram ?!?
« Reply #19 on: March 01, 2018, 07:37:16 pm »
An OrangePi PC is only $15 :-)

As his name implies, he's allergic to any technology developed in the 21st century.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #20 on: March 01, 2018, 07:44:56 pm »
An OrangePi PC is only $15 :-)

As his name implies, he's allergic to any technology developed in the 21st century.

I have a product based on PowerPC405GP, and I can't change it.
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: linux low IO performance on /dev/ram ?!?
« Reply #21 on: March 01, 2018, 07:59:04 pm »
I have a product based on PowerPC405GP, and I can't change it.

Oh ohhh. Good luck then.
The further a society drifts from truth, the more it will hate those who speak it.
 

Online langwadt

  • Super Contributor
  • ***
  • Posts: 4422
  • Country: dk
Re: linux low IO performance on /dev/ram ?!?
« Reply #22 on: March 01, 2018, 08:08:01 pm »
An OrangePi PC is only $15 :-)

As his name implies, he's allergic to any technology developed in the 21st century.

I have a product based on PowerPC405GP, and I can't change it.

tried from a c program?

 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: linux low IO performance on /dev/ram ?!?
« Reply #23 on: March 01, 2018, 08:09:39 pm »
I'd look for some kind of rogue (kernel) process or driver eating up all the CPU time.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: linux low IO performance on /dev/ram ?!?
« Reply #24 on: March 01, 2018, 08:14:21 pm »
I'd look for some kind of rogue (kernel) process or driver eating up all the CPU time.

I personally wrote the rootfs, and the bootstrap scripts. Once the kernel is loaded and booted, it loads /sbin/init, that loads sshd, and the bash shell.

you have a bash shell connected to the console (/dev/ttyS0, serial line), and a remote ssh shell.

there is nothing else launched!

which kind of rouge (kernel) process? and how to investigate?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf