]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
cache: don't use cache_purge_negative when renaming
authorMateusz Guzik <mjg@FreeBSD.org>
Thu, 20 Aug 2020 10:06:50 +0000 (10:06 +0000)
committerMateusz Guzik <mjg@FreeBSD.org>
Thu, 20 Aug 2020 10:06:50 +0000 (10:06 +0000)
commit17838b5869369c0140723609526f9d81acb02c07
tree7fd903ef4fcb0425e9c33543f4a0c1b1bad560e1
parent39f88150705d4c30a477b22c1d8b18f1a138f231
cache: don't use cache_purge_negative when renaming

It avoidably scans (and evicts) unrelated entries. Instead take
advantage of passed componentname and perform a hash lookup
for the exact one.

Sample data from buildworld probed on cache_purge_negative extended
to count both scanned and evicted entries on each call are below.
At most it has to evict 1.

  evicted
           value  ------------- Distribution ------------- count
              -1 |                                         0
               0 |@@@@@@@@@@@@@@@                          19506
               1 |@@@@@                                    5820
               2 |@@@@@@                                   7751
               4 |@@@@@                                    6506
               8 |@@@@@                                    5996
              16 |@@@                                      4029
              32 |@                                        1489
              64 |                                         193
             128 |                                         109
             256 |                                         56
             512 |                                         16
            1024 |                                         7
            2048 |                                         3
            4096 |                                         1
            8192 |                                         1
           16384 |                                         0

  scanned
           value  ------------- Distribution ------------- count
              -1 |                                         0
               0 |@@                                       2456
               1 |@                                        1496
               2 |@@                                       2728
               4 |@@@                                      4171
               8 |@@@@                                     5122
              16 |@@@@                                     5335
              32 |@@@@@                                    6279
              64 |@@@@                                     5671
             128 |@@@@                                     4558
             256 |@@                                       3123
             512 |@@                                       2790
            1024 |@@                                       2449
            2048 |@@                                       3021
            4096 |@                                        1398
            8192 |@                                        886
           16384 |                                         0
sys/kern/vfs_cache.c