linux-hardened/fs/cachefiles
David Howells a5b3a80b89 CacheFiles: Provide read-and-reset release counters for cachefilesd
Provide read-and-reset objects- and blocks-released counters for cachefilesd
to use to work out whether there's anything new that can be culled.

One of the problems cachefilesd has is that if all the objects in the cache
are pinned by inodes lying dormant in the kernel inode cache, there isn't
anything for it to cull.  In such a case, it just spins around walking the
filesystem tree and scanning for something to cull.  This eats up a lot of
CPU time.

By telling cachefilesd if there have been any releases, the daemon can
sleep until there is the possibility of something to do.

cachefilesd finds this information by the following means:

 (1) When the control fd is read, the kernel presents a list of values of
     interest.  "freleased=N" and "breleased=N" are added to this list to
     indicate the number of files released and number of blocks released
     since the last read call.  At this point the counters are reset.

 (2) POLLIN is signalled if the number of files released becomes greater
     than 0.

Note that by 'released' it just means that the kernel has released its
interest in those files for the moment, not necessarily that the files
should be deleted from the cache.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2016-02-01 12:30:10 -05:00
..
bind.c VFS: fs/cachefiles: d_backing_inode() annotations 2015-04-15 15:06:59 -04:00
daemon.c CacheFiles: Provide read-and-reset release counters for cachefilesd 2016-02-01 12:30:10 -05:00
interface.c CacheFiles: Provide read-and-reset release counters for cachefilesd 2016-02-01 12:30:10 -05:00
internal.h CacheFiles: Provide read-and-reset release counters for cachefilesd 2016-02-01 12:30:10 -05:00
Kconfig CacheFiles: A cache that backs onto a mounted filesystem 2009-04-03 16:42:41 +01:00
key.c CacheFiles: Downgrade the requirements passed to the allocator 2012-12-20 21:58:25 +00:00
main.c fs/cachefiles: add missing \n to kerror conversions 2014-09-26 08:10:35 -07:00
Makefile CacheFiles: A cache that backs onto a mounted filesystem 2009-04-03 16:42:41 +01:00
namei.c CacheFiles: Provide read-and-reset release counters for cachefilesd 2016-02-01 12:30:10 -05:00
proc.c CacheFiles: A cache that backs onto a mounted filesystem 2009-04-03 16:42:41 +01:00
rdwr.c FS-Cache: Add missing initialization of ret in cachefiles_write_page() 2015-11-16 20:38:43 -05:00
security.c VFS: fs/cachefiles: d_backing_inode() annotations 2015-04-15 15:06:59 -04:00
xattr.c VFS: fs/cachefiles: d_backing_inode() annotations 2015-04-15 15:06:59 -04:00