On Wed, Apr 03, 2019 at 08:51:13AM -0400, Steven Sistare wrote: > On 4/2/2019 4:41 PM, Daniel Jordan wrote: > > [1] https://lore.kernel.org/linux-mm/20190211224437.25267-1-daniel.m.jordan@xxxxxxxxxx/ > > You could clean all 6 patches up nicely with a common subroutine that > increases locked_vm subject to the rlimit. Pass a bool arg that is true if > the limit should be enforced, !dma->lock_cap for one call site, and > !capable(CAP_IPC_LOCK) for the rest. Push the warnings and debug statements > to the subroutine as well. One patch could refactor, and a second could > change the locking method. Yes, I tried writing, but didn't end up including, such a subroutine for [1]. The devil was in the details, but with the cmpxchg business, it's more worthwhile to iron all those out. I'll give it a try.