Skip to contentSkip to conversation

f2fs using tons of cpu

DISCUSSION folkert 2 participants 3 messages Oct 8, 2013 – Nov 9, 2013

lore
Share & tools
lore

folkert

author
#0 lore raw

Hi,

For the last few days f2fs started to use loads of cpu on one of my raspberry pi systems:

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
 2822 root      20   0     0    0    0 R  35.3  0.0 328:34.01 f2fs_gc-254:0
 2826 root      20   0     0    0    0 R  35.3  0.0 327:40.07 flush-254:0

This is continuous load, the whole day.
This is to a SSD connected via USB:
Bus 001 Device 025: ID 0c45:7401 Microdia
The SSD does not support trim (that's why I put f2fs on it).

It is constantly reading (and not writing) data from the SSD it is on:

folkert@vnvnation ~ $ vmstat 2
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----

 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 2  0      0  20744     16 375052    0    0 305774     0  413  157  0 100  0  0
 2  0      0  20744     16 375052    0    0 304272     0  409  151  0 100  0  0
 2  0      0  21536     16 375052    0    0 301444     0  410  163  0 100  0  0
 2  0      0  21536     16 375052    0    0 305052     0  408  150  0 100  0  0
 2  0      0  21536     16 375052    0    0 302994     0  407  151  0 100  0  0
 2  0      0  21932     16 375052    0    0 303408     0  406  153  0 100  0  0
 2  0      0  21932     16 375052    0    0 301580     0  417  152  1 99  0  0
 2  0      0  21932     16 375052    0    0 304142     0  411  150  0 100  0  0
 2  0      0  21932     16 375052    0    0 305944     0  409  152  0 100  0  0
 2  0      0  21932     16 375052    0    0 299700     0  414  156  0 100  0  0

It has lots of free diskspace left:

folkert@vnvnation ~ $ df -h /home/folkert/backups
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/backups 118G 91G 27G 78% /home/folkert/backups

Kernel:

folkert@vnvnation ~ $ uname -r
3.9.8+

Folkert van Heusden

Signature · 13 lines
Multitail es una herramienta flexible que permite visualizar los "log
file" y seguir la ejecución de comandos. Permite filtrar, añadir
colores, combinar archivos, la visualización de diferencias (diff-
view), etc.  http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
#1 lore raw

Hi,

2013-10-08 (화), 13:25 +0200, folkert:

Quoted 8 lines

Hi,

For the last few days f2fs started to use loads of cpu on one of my raspberry pi systems:

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
 2822 root      20   0     0    0    0 R  35.3  0.0 328:34.01 f2fs_gc-254:0
 2826 root      20   0     0    0    0 R  35.3  0.0 327:40.07 flush-254:0

The f2fs_gc is a kernel thread conducting on-line defragementation. The period between each triggers is dependant on the system idling time, ranging from 30 to 60 secs by default.
In order to control these times, you can use sysfs enabled by the following patch that was merged into 3.12-rc1.

commit d2dc095f4280ad5fdea33769e8e119fd16648426 f2fs: add sysfs entries to select the gc policy

commit b59d0bae6ca30c496f298881616258f9cde0d9c6 f2fs: add sysfs support for controlling the gc_thread

Quoted 1 line

This is continuous load, the whole day.

Right. It runs until there is no fragmentation.

Quoted 5 lines

This is to a SSD connected via USB:
Bus 001 Device 025: ID 0c45:7401 Microdia
The SSD does not support trim (that's why I put f2fs on it).

It is constantly reading (and not writing) data from the SSD it is on:

The f2fs_gc just loads a bunch of victim blocks from the disk to in-memory cache first.
Afterwards, it writes cached blocks by the write-back mechanism in VFS according to the system status.

Quoted 15 lines

folkert@vnvnation ~ $ vmstat 2
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----

 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 2  0      0  20744     16 375052    0    0 305774     0  413  157  0 100  0  0
 2  0      0  20744     16 375052    0    0 304272     0  409  151  0 100  0  0
 2  0      0  21536     16 375052    0    0 301444     0  410  163  0 100  0  0
 2  0      0  21536     16 375052    0    0 305052     0  408  150  0 100  0  0
 2  0      0  21536     16 375052    0    0 302994     0  407  151  0 100  0  0
 2  0      0  21932     16 375052    0    0 303408     0  406  153  0 100  0  0
 2  0      0  21932     16 375052    0    0 301580     0  417  152  1 99  0  0
 2  0      0  21932     16 375052    0    0 304142     0  411  150  0 100  0  0
 2  0      0  21932     16 375052    0    0 305944     0  409  152  0 100  0  0
 2  0      0  21932     16 375052    0    0 299700     0  414  156  0 100  0  0
Quoted 1 line

It has lots of free diskspace left:

You'd better keep track on /sys/kernel/debug/f2fs/status, and I think you can find many dirty segments across the partition.
In the status file, you can also see the f2fs_gc behavior.

Thanks,

Quoted 13 lines

folkert@vnvnation ~ $ df -h /home/folkert/backups
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/backups 118G 91G 27G 78% /home/folkert/backups

Kernel:

folkert@vnvnation ~ $ uname -r
3.9.8+

Folkert van Heusden

Signature · 15 lines
Jaegeuk Kim
Samsung



------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
author
#2 lore raw

[ garbage collector ]

Quoted 3 lines

You'd better keep track on /sys/kernel/debug/f2fs/status, and I think you can find many dirty segments across the partition.
In the status file, you can also see the f2fs_gc behavior.

Ok but if the gc runs, the system completely locks up. That is: it is 100% unresponsive. And since it is a 120GB volume on a raspberry pi it is practically down for _days_ (maybe even weeks - I rebooted the device after a day).

Folkert van Heusden

Signature · 12 lines
www.vanheusden.com/multitail - win een vlaai van multivlaai! zorg
ervoor dat multitail opgenomen wordt in Fedora Core, AIX, Solaris of
HP/UX en win een vlaai naar keuze
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk