NFS: Add an ACCESS cache memory shrinker

A pinned inode may in theory end up filling memory with cached ACCESS
calls. This patch ensures that the VM may shrink away the cache in these
particular cases.
The shrinker works by iterating through the list of inodes on the global
nfs_access_lru_list, and removing the least recently used access
cache entry until it is done (or until the entire cache is empty).

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Trond Myklebust
2006-07-25 11:28:19 -04:00
parent cfcea3e8c6
commit 979df72e6f
3 changed files with 52 additions and 0 deletions

View File

@@ -221,6 +221,8 @@ module_param_call(idmap_cache_timeout, param_set_idmap_timeout, param_get_int,
&nfs_idmap_cache_timeout, 0644);
#endif
static struct shrinker *acl_shrinker;
/*
* Register the NFS filesystems
*/
@@ -240,6 +242,7 @@ int __init register_nfs_fs(void)
if (ret < 0)
goto error_2;
#endif
acl_shrinker = set_shrinker(DEFAULT_SEEKS, nfs_access_cache_shrinker);
return 0;
#ifdef CONFIG_NFS_V4
@@ -257,6 +260,8 @@ error_0:
*/
void __exit unregister_nfs_fs(void)
{
if (acl_shrinker != NULL)
remove_shrinker(acl_shrinker);
#ifdef CONFIG_NFS_V4
unregister_filesystem(&nfs4_fs_type);
nfs_unregister_sysctl();