From: Wenjie Qi exFAT uses filemap for buffered reads and iomap for buffered writes and writeback. These paths already handle IOCB_DONTCACHE, including marking new folios for dropbehind and completing writeback bios in task context when needed. Advertise FOP_DONTCACHE so preadv2() and pwritev2() callers can request that newly instantiated page-cache folios be dropped after I/O. This is useful for one-pass reads and streaming writes to removable media. On an NVMe-backed exFAT image with 128-KiB clusters in QEMU with two vCPUs and 2 GiB RAM, disable KASAN, lockdep and tracing for measurement. Compare normal and dontcache I/O in three pairs with alternating order. Read a 4-GiB file using 1-MiB calls. Write new 1-GiB files using 8-KiB and 1-MiB calls in a memcg with memory.max=255852544 and no swap. Write throughput includes fdatasync(). Median throughput and peak cgroup memory were, with percentage changes relative to normal I/O: MiB/s Peak memory, MiB normal/dontcache change normal/dontcache change read, 1 MiB 5788.4/5124.9 -11.5% 1353.3/18.9 -98.6% write, 8 KiB 2924.6/3400.9 +16.3% 244.0/106.7 -56.3% write, 1 MiB 3534.1/3985.0 +12.8% 244.0/188.3 -22.8% Dontcache reduced peak memory and recorded no reclaim scans or steals in any profile. Normal reads and writes scanned and reclaimed about 710,000 and 200,000 pages per run, respectively. The memory-limited writes gained throughput. Reads reduced peak memory by 98.6%, to just 18.9 MiB, at a modest 11.5% throughput cost. This smaller cache footprint can help reduce memory pressure on concurrent workloads on memory-constrained mobile devices. Signed-off-by: Wenjie Qi --- fs/exfat/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/exfat/file.c b/fs/exfat/file.c index db000001c..5b67bbf81 100644 --- a/fs/exfat/file.c +++ b/fs/exfat/file.c @@ -1107,6 +1107,7 @@ const struct file_operations exfat_file_operations = { .splice_write = iter_file_splice_write, .fallocate = exfat_fallocate, .setlease = generic_setlease, + .fop_flags = FOP_DONTCACHE, }; const struct inode_operations exfat_file_inode_operations = { base-commit: 79130348ec29b74950e925e06c26f1a4eecea5ae -- 2.43.0