Skip to content

Commit

Permalink
mm/slab_common: use helper function is_power_of_2()
Browse files Browse the repository at this point in the history
Use helper function is_power_of_2() to check if KMALLOC_MIN_SIZE is power
of two. Minor readability improvement.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Link: https://lore.kernel.org/r/20220217091609.8214-1-linmiaohe@huawei.com
  • Loading branch information
Miaohe Lin authored and Vlastimil Babka committed Feb 21, 2022
1 parent bd53ce4 commit 7d6b6cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/slab_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ void __init setup_kmalloc_cache_index_table(void)
unsigned int i;

BUILD_BUG_ON(KMALLOC_MIN_SIZE > 256 ||
(KMALLOC_MIN_SIZE & (KMALLOC_MIN_SIZE - 1)));
!is_power_of_2(KMALLOC_MIN_SIZE));

for (i = 8; i < KMALLOC_MIN_SIZE; i += 8) {
unsigned int elem = size_index_elem(i);
Expand Down

0 comments on commit 7d6b6cc

Please sign in to comment.