]> git.baikalelectronics.ru Git - kernel.git/commit
mm/vmalloc.c: halve the number of comparisons performed in pcpu_get_vm_areas()
authorWei Yang <richard.weiyang@gmail.com>
Wed, 6 Sep 2017 23:24:09 +0000 (16:24 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Sep 2017 00:27:29 +0000 (17:27 -0700)
commit35a213f59c4384380563c69fb4acf7d48be8b723
tree5d64a076386bd15715c4c287edcd079a17640650
parentb333e2a61a5c711acfb84e48de98495f8ba80d01
mm/vmalloc.c: halve the number of comparisons performed in pcpu_get_vm_areas()

In pcpu_get_vm_areas(), it checks each range is not overlapped.  To make
sure it is, only (N^2)/2 comparison is necessary, while current code
does N^2 times.  By starting from the next range, it achieves the goal
and the continue could be removed.

Also,

 - the overlap check of two ranges could be done with one clause

 - one typo in comment is fixed.

Link: http://lkml.kernel.org/r/20170803063822.48702-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/vmalloc.c