nfsd: filecache: change garbage collection lists
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest7 patches 15 repliesIn review
Changes in this version from the cover letter
- no _bh locking
- add name for a magic constant
- remove unnecessary race-handling code
- give a more meaningfule name for a lock for /proc/lock_stat
- minor cleanups suggested by Jeff
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | nfsd: filecache: remove race handling.fs/ | +3 | 1 reply | |
| 2/7 | nfsd: filecache: use nfsd_file_dispose_list() in nfsd_file_close_inode_sync()fs/ | +1 | 0 replies | |
| 3/7 | nfsd: filecache: move globals nfsd_file_lru and nfsd_file_shrinker to be per-netfs/ | +72 | 0 replies | |
| 4/7 | nfsd: filecache: change garbage collection list management.fs/ fs/ fs/ | +107 | 1 reply | |
| 5/7 | nfsd: filecache: document the arbitrary limit on file-disposes-per-loopfs/ | +17 | 1 reply | |
| 6/7 | nfsd: filecache: change garbage collection to a timer.fs/ | +24 | 1 reply | |
| 7/7 | nfsd: filecache: give disposal lock a unique class name.fs/ | +3 | 2 replies |
Reviews trailers per patch
All 7 patches have a Reviewed-by or Acked-by.
| Patch | Jeff Layton |
|---|---|
| 1/7 | R-b |
| 2/7 | R-b |
| 3/7 | R-b |
| 4/7 | R-b |
| 5/7 | R-b |
| 6/7 | R-b |
| 7/7 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/7] nfsd: filecache: change garbage collection lists
[
davec added to cc incase I've said something incorrect about list_lru
Changes in this version:
- no _bh locking
- add name for a magic constant
- remove unnecessary race-handling code
- give a more meaningfule name for a lock for /proc/lock_stat
- minor cleanups suggested by Jeff
]
The nfsd filecache currently uses list_lru for tracking files recently used in NFSv3 requests which need to be "garbage collected" when they have becoming idle - unused for 2-4 seconds.
I do not believe list_lru is a good tool for this. It does not allow the timeout which filecache requires so we have to add a timeout mechanism which holds the list_lru lock while the whole list is scanned looking for entries that haven't been recently accessed. When the list is largish (even a few hundred) this can block new requests noticably which need the lock to remove a file to access it.
This patch removes the list_lru and instead uses 2 simple linked lists. When a file is accessed it is removed from whichever list it is on, then added to the tail of the first list. Every 2 seconds the second list is moved to the "freeme" list and the first list is moved to the second list. This avoids any need to walk a list to find old entries.
These lists are per-netns rather than global as the freeme list is per-netns as the actual freeing is done in nfsd threads which are per-netns.
Thanks,
NeilBrown
[PATCH 1/7] nfsd: filecache: remove race handling.
[PATCH 2/7] nfsd: filecache: use nfsd_file_dispose_list() in [PATCH 3/7] nfsd: filecache: move globals nfsd_file_lru and [PATCH 4/7] nfsd: filecache: change garbage collection list [PATCH 5/7] nfsd: filecache: document the arbitrary limit on [PATCH 6/7] nfsd: filecache: change garbage collection to a timer. [PATCH 7/7] nfsd: filecache: give disposal lock a unique class name.