> +extern void *kvrealloc_noprof(const void *p, size_t size, gfp_t flags) __realloc_size(2); Please drop the extern while you're at it and move the __realloc_size attribute to a separate line. > +static gfp_t to_kmalloc_flags(gfp_t flags, size_t size) > +{ > + if (size > PAGE_SIZE) { > + flags |= __GFP_NOWARN; > + > + if (!(flags & __GFP_RETRY_MAYFAIL)) > + flags |= __GFP_NORETRY; > + > + /* nofail semantic is implemented by the vmalloc fallback */ > + flags &= ~__GFP_NOFAIL; > + } > + > + return flags; The name for this function sounds a bit odd. Maybe kmalloc_gfp_adjust instead? Also the comment explaining these flags tweaks should move from the caller to this function.