On Wed, Nov 14, 2018 at 08:31:05AM +0800, Qu Wenruo wrote: > Hi, > > Is there any (easy) method for a fstests test case to limit the page > cache usage? > > I triggered btrfs/139 failure with 2G vRAM VM, and located the root > cause of the problem. > > However it's only really reproducible for small ram VM, since it could > trigger dirty page writeback due to memory pressure. > > So I'm wondering if we could do such thing even for large RAM test machine. src/usemem.c can currently be used to consume up to 2GB of RAM. Update it to deal with amounts of more than 2^31 bytes, and then calculate how much ram you want to lock away as unusable in the test and call usemem to prevent the kernel from using than memory. It's an easy way to drive the kernel into severe memory shortages and trigger dirty page writeback from memory reclaim.... Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx