mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
{slub, slob}: use unlikely() for kfree(ZERO_OR_NULL_PTR) check
Considering kfree(NULL) would normally occur only in error paths and kfree(ZERO_SIZE_PTR) is uncommon as well, so let's use unlikely() for the condition check in SLUB's and SLOB's kfree() to optimize for the common case. SLAB has this already. Signed-off-by: Satyam Sharma <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: Christoph Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
c92ff1bde0
commit
2408c55037
2 changed files with 7 additions and 7 deletions
|
|
@ -360,7 +360,7 @@ static void slob_free(void *block, int size)
|
|||
slobidx_t units;
|
||||
unsigned long flags;
|
||||
|
||||
if (ZERO_OR_NULL_PTR(block))
|
||||
if (unlikely(ZERO_OR_NULL_PTR(block)))
|
||||
return;
|
||||
BUG_ON(!size);
|
||||
|
||||
|
|
@ -466,7 +466,7 @@ void kfree(const void *block)
|
|||
{
|
||||
struct slob_page *sp;
|
||||
|
||||
if (ZERO_OR_NULL_PTR(block))
|
||||
if (unlikely(ZERO_OR_NULL_PTR(block)))
|
||||
return;
|
||||
|
||||
sp = (struct slob_page *)virt_to_page(block);
|
||||
|
|
@ -484,7 +484,7 @@ size_t ksize(const void *block)
|
|||
{
|
||||
struct slob_page *sp;
|
||||
|
||||
if (ZERO_OR_NULL_PTR(block))
|
||||
if (unlikely(ZERO_OR_NULL_PTR(block)))
|
||||
return 0;
|
||||
|
||||
sp = (struct slob_page *)virt_to_page(block);
|
||||
|
|
|
|||
Loading…
Reference in a new issue