From: Alexandre Chartre > Sent: 16 November 2020 18:10 > > On 11/16/20 5:57 PM, Andy Lutomirski wrote: > > On Mon, Nov 16, 2020 at 6:47 AM Alexandre Chartre > > <alexandre.char...@oracle.com> wrote: > >> > >> When entering the kernel from userland, use the per-task PTI stack > >> instead of the per-cpu trampoline stack. Like the trampoline stack, > >> the PTI stack is mapped both in the kernel and in the user page-table. > >> Using a per-task stack which is mapped into the kernel and the user > >> page-table instead of a per-cpu stack will allow executing more code > >> before switching to the kernel stack and to the kernel page-table. > > > > Why? > > When executing more code in the kernel, we are likely to reach a point > where we need to sleep while we are using the user page-table, so we need > to be using a per-thread stack.
Isn't that going to allocate a lot more kernel memory? ISTR some thoughts about using dynamically allocated kernel stacks when (at least some) wakeups are done by directly restarting the system call - so that the sleeping thread doesn't even need a kernel stack. (I can't remember if that was linux or one of the BSDs) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)