Commit f5ad9f9
erofs: free pclusters if no cached folio is attached
Once a pcluster is fully decompressed and there are no attached cached
folios, its corresponding `struct z_erofs_pcluster` will be freed. This
will significantly reduce the frequency of calls to erofs_shrink_scan()
and the memory allocated for `struct z_erofs_pcluster`.
The tables below show approximately a 96% reduction in the calls to
erofs_shrink_scan() and in the memory allocated for `struct
z_erofs_pcluster` after applying this patch. The results were obtained
by performing a test to copy a 4.1GB partition on ARM64 Android devices
running the 6.6 kernel with an 8-core CPU and 12GB of memory.
1. The reduction in calls to erofs_shrink_scan():
+-----------------+-----------+----------+---------+
| | w/o patch | w/ patch | diff |
+-----------------+-----------+----------+---------+
| Average (times) | 11390 | 390 | -96.57% |
+-----------------+-----------+----------+---------+
2. The reduction in memory released by erofs_shrink_scan():
+-----------------+-----------+----------+---------+
| | w/o patch | w/ patch | diff |
+-----------------+-----------+----------+---------+
| Average (Byte) | 133612656 | 4434552 | -96.68% |
+-----------------+-----------+----------+---------+
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20241112043235.546164-1-guochunhai@vivo.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>1 parent bf1aa03 commit f5ad9f9
1 file changed
Lines changed: 38 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
888 | | - | |
| 888 | + | |
889 | 889 | | |
890 | 890 | | |
891 | | - | |
892 | | - | |
893 | | - | |
894 | 891 | | |
895 | | - | |
| 892 | + | |
896 | 893 | | |
897 | 894 | | |
898 | 895 | | |
899 | 896 | | |
900 | 897 | | |
901 | 898 | | |
902 | 899 | | |
903 | | - | |
| 900 | + | |
904 | 901 | | |
905 | 902 | | |
906 | 903 | | |
| |||
909 | 906 | | |
910 | 907 | | |
911 | 908 | | |
912 | | - | |
913 | | - | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
914 | 919 | | |
915 | 920 | | |
916 | 921 | | |
| |||
942 | 947 | | |
943 | 948 | | |
944 | 949 | | |
945 | | - | |
| 950 | + | |
| 951 | + | |
946 | 952 | | |
| 953 | + | |
| 954 | + | |
947 | 955 | | |
948 | 956 | | |
949 | 957 | | |
950 | 958 | | |
951 | | - | |
952 | | - | |
953 | | - | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
954 | 966 | | |
| 967 | + | |
| 968 | + | |
955 | 969 | | |
956 | 970 | | |
957 | 971 | | |
| |||
972 | 986 | | |
973 | 987 | | |
974 | 988 | | |
975 | | - | |
| 989 | + | |
976 | 990 | | |
977 | 991 | | |
978 | 992 | | |
| |||
1274 | 1288 | | |
1275 | 1289 | | |
1276 | 1290 | | |
| 1291 | + | |
1277 | 1292 | | |
1278 | 1293 | | |
1279 | 1294 | | |
| |||
1331 | 1346 | | |
1332 | 1347 | | |
1333 | 1348 | | |
1334 | | - | |
1335 | | - | |
| 1349 | + | |
1336 | 1350 | | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
1337 | 1355 | | |
1338 | 1356 | | |
1339 | 1357 | | |
| |||
1379 | 1397 | | |
1380 | 1398 | | |
1381 | 1399 | | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
1382 | 1405 | | |
1383 | 1406 | | |
1384 | 1407 | | |
| |||
1401 | 1424 | | |
1402 | 1425 | | |
1403 | 1426 | | |
1404 | | - | |
1405 | | - | |
1406 | | - | |
1407 | | - | |
1408 | 1427 | | |
1409 | 1428 | | |
1410 | 1429 | | |
| |||
0 commit comments