Bug 215407 - ubi: high cpu usage by ubi_bgt with fastmap enabled
Summary: ubi: high cpu usage by ubi_bgt with fastmap enabled
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-25 08:28 UTC by Zhihao Cheng
Modified: 2022-04-28 08:08 UTC (History)
0 users

See Also:
Kernel Version: 5.16-rc5
Subsystem:
Regression: No
Bisected commit-id:


Attachments
a.c (1.87 KB, text/plain)
2021-12-25 08:30 UTC, Zhihao Cheng
Details
diff.patch (1.94 KB, patch)
2021-12-25 08:30 UTC, Zhihao Cheng
Details | Diff
a.c v2 (2.47 KB, text/plain)
2021-12-25 10:32 UTC, Zhihao Cheng
Details
diff2 (1.28 KB, patch)
2022-04-28 08:06 UTC, Zhihao Cheng
Details | Diff
b.c (2.47 KB, text/plain)
2022-04-28 08:08 UTC, Zhihao Cheng
Details

Description Zhihao Cheng 2021-12-25 08:28:05 UTC
top - 12:10:42 up 5 min,  2 users,  load average: 1.76, 0.68, 0.27
Tasks: 123 total,   3 running,  54 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.2 us, 27.1 sy,  0.0 ni, 68.9 id,  2.0 wa,  0.0 hi,  0.8 si,  0.0 st
KiB Mem :  7450768 total,  7117392 free,    85744 used,   247632 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  7055348 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                              
 1589 root      20   0       0      0      0 R  45.0  0.0   0:38.86 ubi_bgt0d                                                                            
  319 root      20   0       0      0      0 I  15.2  0.0   0:15.29 kworker/0:3-eve                                                                      
  371 root      20   0       0      0      0 I  14.9  0.0   0:12.85 kworker/3:3-eve                                                                      
   20 root      20   0       0      0      0 I  11.3  0.0   0:05.33 kworker/1:0-eve                                                                      
  202 root      20   0       0      0      0 I  11.3  0.0   0:04.93 kworker/2:3-eve
Comment 1 Zhihao Cheng 2021-12-25 08:29:48 UTC
Reproducer (CONFIG_MTD_UBI_FASTMAP):
1. Apply diff.patch(optional, some printing messages)
2. compile and run ./aa


top - 12:10:42 up 5 min,  2 users,  load average: 1.76, 0.68, 0.27
Tasks: 123 total,   3 running,  54 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.2 us, 27.1 sy,  0.0 ni, 68.9 id,  2.0 wa,  0.0 hi,  0.8 si,  0.0 st
KiB Mem :  7450768 total,  7117392 free,    85744 used,   247632 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  7055348 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                              
 1589 root      20   0       0      0      0 R  45.0  0.0   0:38.86 ubi_bgt0d                                                                            
  319 root      20   0       0      0      0 I  15.2  0.0   0:15.29 kworker/0:3-eve                                                                      
  371 root      20   0       0      0      0 I  14.9  0.0   0:12.85 kworker/3:3-eve                                                                      
   20 root      20   0       0      0      0 I  11.3  0.0   0:05.33 kworker/1:0-eve                                                                      
  202 root      20   0       0      0      0 I  11.3  0.0   0:04.93 kworker/2:3-eve
Comment 2 Zhihao Cheng 2021-12-25 08:30:05 UTC
Created attachment 300143 [details]
a.c
Comment 3 Zhihao Cheng 2021-12-25 08:30:19 UTC
Created attachment 300145 [details]
diff.patch
Comment 4 Zhihao Cheng 2021-12-25 10:32:22 UTC
Created attachment 300147 [details]
a.c v2
Comment 5 Zhihao Cheng 2022-04-28 08:06:48 UTC
Created attachment 300837 [details]
diff2

Make sure the old problem(fixed by 4b68bf9a69d2 "ubi: Select fastmap anchor PEBs considering wear level rules") is not imported again.

1. Apply diff2, CONFIG_MTD_UBI_WL_THRESHOLD=50
2. ./bb
3. while true; do ubimkvol -N vol_b -m -n 1 /dev/ubi0; ubirmvol -n1 /dev/ubi0; done
4. ubiscan /dev/mtd0

PEB erase counters
=========================================================
valid    : 1024
empty    : 0
corrupted: 0
alien    : 0
bad      : 0

Histogram
=========================================================
from              to     count      min      avg      max
---------------------------------------------------------
0        ..        9:        0        0        0        0
10       ..       99:        0        0        0        0
100      ..      999:        0        0        0        0
1000     ..     9999:      960     8007     8030     8057
10000    ..    99999:       64    59972    60010    60022
100000   ..      inf:        0        0        0        0
---------------------------------------------------------
Total               :     1024     8007    11279    60022
Comment 6 Zhihao Cheng 2022-04-28 08:08:09 UTC
Created attachment 300838 [details]
b.c

Note You need to log in before you can comment on or make changes to this bug.