Why not? Its a realloc call and these are the classic semantics of
realloc. Otherwise realloc will always move the memory.
Check that both sizes fall into the same general cache. Do the following
at the beginning of the function
struct kmem_cache *cachep = page_get_slab(virt_to_page(object));
if (new_size && cachep == kmem_find_general_cachep(new_size,
cachep->gfpflags))
/*
* Old and new object size us the same general slab so we do not
* have to do anything
*/
return object;
-