On Fri, May 16, 2025 at 02:21:04PM +0200, David Hildenbrand wrote: > On 16.05.25 12:10, Pankaj Raghav wrote: > > Introduce LARGE_ZERO_PAGE of size 2M as an alternative to ZERO_PAGE of > > size PAGE_SIZE. > > > > There are many places in the kernel where we need to zeroout larger > > chunks but the maximum segment we can zeroout at a time is limited by > > PAGE_SIZE. > > > > This is especially annoying in block devices and filesystems where we > > attach multiple ZERO_PAGEs to the bio in different bvecs. With multipage > > bvec support in block layer, it is much more efficient to send out > > larger zero pages as a part of single bvec. > > > > While there are other options such as huge_zero_page, they can fail > > based on the system memory pressure requiring a fallback to ZERO_PAGE[3]. > > Instead of adding another one, why not have a config option that will always > allocate the huge zeropage, and never free it? > > I mean, the whole thing about dynamically allocating/freeing it was for > memory-constrained systems. For large systems, we just don't care. That sounds like a good idea. I was just worried about wasting too much memory with a huge page in systems with 64k page size. But it can always be disabled by putting it behind a config. Thanks, David. I will wait to see what others think but what you suggested sounds like a good idea on how to proceed. -- Pankaj Raghav