Copy-on-write filesystem such as btrfs (or reflinks in XFS/OCFS2) have files which share extents on disk. Multiple files can have extents pointing to same physical disk location. When mutliple files share a common extent and these files are read(), each file will have it's own copy of the content in the page cache. The problem is this leads to wastage of memory since multiple copies of the same content is in memory. The proposal is to have a common cache which would be used *for reads only* (excluding read before writes for non page aligned writes). I would like to discuss the problems which will arise to implement this: - strategies to maintain such a shared cache - location of the shared cache: device inode or separate inode? - all reads go through shared cache OR only shared extents should be in shared cache - actions to perform if write occurs at offsets of shared extents - should it be CoW'd in memory? OR - move the pages from shared cache to inode's cache? - what should be done to the pages after writeback. Should they be dropped, so further reads are read into shared cache? - Shrinking in case of system memory pressure An initial RFC patch was posted here: https://lore.kernel.org/all/YXNoxZqKPkxZvr3E@xxxxxxxxxxxxxxxxxxxx/t/ -- Goldwyn