However, my immediate goal is to provide a generic way to increase kernel thread memory on demand, specifically when needed. If certain architectures are capable of in-kernel fault handling, they could potentially leverage my framework to further enhance their dynamic stack fault handling support. > > > > > we will have other metrics that > > > show the total number of pages allocated for stacks. > > > > Don't we already have a metric for that i.e. KernelStack in meminfo > > which is in kB unit? If we had true dynamic kernel stack support, then the metric in meminfo would be enough to estimate the average stack size, it would still not show the histogram of how large stacks get. > > > > One more question: Is there any concern in making > > CONFIG_DEBUG_STACK_USAGE not a debug feature i.e. enable in default > > kernels instead of just debug kernels? We enabled it in Google ProdKernel. There is some overhead when threads are exiting, because we are looking for the first non-zero byte, but that is minimal. We haven't observed any performance impact on our fleet. Pasha