On Fri, Feb 23, 2024 at 1:56 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > On Fri, Feb 23, 2024 at 01:49:08PM -0800, Peter Collingbourne wrote: > > I wonder if this is another potential use case for bringing back > > cleancache, as proposed in [1]? The idea would be that all kernel > > stacks have 16KB allocations but only one page accessible and the rest > > available as cleancache. We can handle a fault on one of those pages > > by discarding the cleancache page and remapping it as r/w. > > That seems like the most complicated way to solve the problem. > Stack pages which have not been accessed contain no data, so do not > need swap or cleancache, they just need to be allocatable. And the > fault handler needs to be able to handle faults from interrupt context, > which I'm not sure all architectures can do. > > The "We need to be able to allocate memory from interrupt context" is > really not that hard to handle; just keep three pages in a per-cpu array. > Refill the array at return-to-process-context. Okay, if it doesn't really need that many pages allocated upfront, that seems like the best approach to me as well. Peter