On Wed, Oct 31, 2018 at 7:21 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > 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); > I can drop the vmalloc() patches (unless someone else thinks we should proceed with a kvmalloc() version). I discussed them with my colleagues, and the consensus on our end is we shouldn't let these structs bloat so big. Thanks for everyone's help to reduce them by 2x the fpu struct! I'll be sending out another version of the patch series, with the two fpu patches and minus the vmalloc() patches, after I hear back from Dave on a question I just sent.