Circular scanning of free sectors in kv_alloc()#111
Circular scanning of free sectors in kv_alloc()#111rpc-fw wants to merge 2 commits intoarmink:masterfrom
Conversation
|
I will need some time to review it. Do you have some test data before and after the patch? |
|
I have some logs from a test program that was writing 2 kb values in 4 kb sectors. The log captured shows the progress between two GC runs. The test randomly picks one out of 4 KVs, and each KV is first read, then written. For each read and write I logged the number of CPU cycles it took, the number of sectors read, and the number of sectors written. You can see the number of accessed sectors grow as more sectors are taken into use. After GC the writes are fast again. default_without_circular_fix_.txt In another test I write small values in the kvdb and observe that alloc_kv returns with my patch addresses that do not reset to 0 after the GC run (when sectors get full) but instead continue increasing until the end of the flash, after which they return back to zero. Log the value of empty_kv at the end of alloc_kv to see it. |
|
OK, Thx. I' ll test it in this weekend. |
|
Did you have a chance to try it? Any thoughts? |
|
hi, @rpc-fw , I have reviewed your PR. There are a lot of changes in this PR. I'm trying a simpler way to modify. Please wait some time for me. Thx. ;> |
With this patch alloc_kv() will scan sectors in a circular fashion, instead of starting from the first sector every time. Alloc_kv will check the sectors in sector cache first, and then continue scanning from the sector it found during the previous alloc. This improves write performance when total number of sectors is large, as fully used sectors no longer need to be inspected.
The improvement should be clearly noticeable when writing to the last sectors of a large kvdb. I used it on a 512 kb flash region, with each sector 4 kb in size.