On Wed, Mar 25, 2020 at 07:03:32PM +0100, Alexander Potapenko wrote: > > I would suggest using bits in the section labelled: > > > > /* Unserialized, strictly 'current' */ > > The main problem is that |current| is unavailable in the interrupt > context, so we'll also need to: > - disable interrupts when preparing for a KMSAN internal memory > allocation - sounds costly, huh? > - store the context flag in a per-cpu variable in the case |current| > is unavailable. It's not /unavailable/ ... it's whatever task happens to be running at the time the interrupt is triggered. You can borrow its task_struct. You'll have to save off the current value of the flag before setting it, just like memalloc_nofs_save() does. But this does rather call into question whether Michal's advice to use task_struct is good advice to begin with. For memalloc_nofs/noio, it works well this way because allocations in interrupt context are inherently at a more restrictive context than task level. It's not clear to me what this kmsan GFP flag is being used for, and whether allocations that happen in interrupt context should inherit the kmsan setting. I will have to read these patches more carefully to determine that; I was really just responding to the "where can I find some free bits" part of the question.