On Wed, Oct 31, 2018 at 01:48:44PM +0000, Marc Orr wrote: > Thanks for the explanation. Is there a way to dynamically detect the > memory allocation done by kvmalloc() (i.e., kmalloc() or vmalloc())? > If so, we could use kvmalloc(), and add two code paths to do the > physical mapping, according to whether the underlying memory was > allocated with kmalloc() or vmalloc(). Yes -- it's used in the implementation of kvfree(): if (is_vmalloc_addr(addr)) vfree(addr); else kfree(addr);