Advertisement
Guest User

[PATCH] mm, slab_common: add 'unlikely' to size check of kma

a guest
Sep 2nd, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Size is usually below than KMALLOC_MAX_SIZE.
  2. If we add a 'unlikely' macro, compiler can make better code.
  3.  
  4. Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
  5.  
  6. diff --git a/mm/slab_common.c b/mm/slab_common.c
  7. index 538bade..f0410eb 100644
  8. --- a/mm/slab_common.c
  9. +++ b/mm/slab_common.c
  10. @@ -373,7 +373,7 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
  11. {
  12. int index;
  13.  
  14. - if (size > KMALLOC_MAX_SIZE) {
  15. + if (unlikely(size > KMALLOC_MAX_SIZE)) {
  16. WARN_ON_ONCE(!(flags & __GFP_NOWARN));
  17. return NULL;
  18. }
  19. --
  20. 1.7.9.5
  21.  
  22. --
  23. To unsubscribe, send a message with 'unsubscribe linux-mm' in
  24. the body to majordomo@kvack.org. For more info on Linux MM,
  25. see: http://www.linux-mm.org/ .
  26. Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement