On 3/11/24, Pasha Tatashin <pasha.tatashin@xxxxxxxxxx> wrote: > This is follow-up to the LSF/MM proposal [1]. Please provide your > thoughts and comments about dynamic kernel stacks feature. This is a WIP > has not been tested beside booting on some machines, and running LKDTM > thread exhaust tests. The series also lacks selftests, and > documentations. > > This feature allows to grow kernel stack dynamically, from 4KiB and up > to the THREAD_SIZE. The intend is to save memory on fleet machines. From > the initial experiments it shows to save on average 70-75% of the kernel > stack memory. > Can you please elaborate how this works? I have trouble figuring it out from cursory reading of the patchset and commit messages, that aside I would argue this should have been explained in the cover letter. For example, say a thread takes a bunch of random locks (most notably spinlocks) and/or disables preemption, then pushes some stuff onto the stack which now faults. That is to say the fault can happen in rather arbitrary context. If any of the conditions described below are prevented in the first place it really needs to be described how. That said, from top of my head: 1. what about faults when the thread holds a bunch of arbitrary locks or has preemption disabled? is the allocation lockless? 2. what happens if there is no memory from which to map extra pages in the first place? you may be in position where you can't go off cpu -- Mateusz Guzik <mjguzik gmail.com>