• David Woodhouse's avatar
    firmware: speed up request_firmware(), v3 · 6e03a201
    David Woodhouse authored
    Rather than calling vmalloc() repeatedly to grow the firmware image as
    we receive data from userspace, just allocate and fill individual pages.
    Then vmap() the whole lot in one go when we're done.
    
    A quick test with a 337KiB iwlagn firmware shows the time taken for
    request_firmware() going from ~32ms to ~5ms after I apply this patch.
    
    [v2: define PAGE_KERNEL_RO as PAGE_KERNEL where necessary, use min_t()]
    [v3: kunmap() takes the struct page *, not the virtual address]
    Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
    Tested-by: default avatarSachin Sant <sachinp@in.ibm.com>
    6e03a201
firmware_class.c 16.5 KB