lkml.org 
[lkml]   [2018]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 08/19] vmw_balloon: refactor change size from vmballoon_work
Hi Nadav,

I love your patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on v4.19-rc4 next-20180918]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Nadav-Amit/vmw_balloon-compaction-shrinker-64-bit-etc/20180918-152302
config: x86_64-randconfig-x015-201837 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All warnings (new ones prefixed by >>):

Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read
Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_write
Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
Cyclomatic Complexity 1 include/linux/list.h:__list_del
Cyclomatic Complexity 2 arch/x86/include/asm/page_64.h:__phys_addr_nodebug
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_read
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_set
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_read
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_set
Cyclomatic Complexity 1 include/linux/jump_label.h:static_key_count
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 arch/x86/include/asm/topology.h:numa_node_id
Cyclomatic Complexity 1 arch/x86/include/asm/io.h:virt_to_phys
Cyclomatic Complexity 1 include/linux/topology.h:numa_mem_id
Cyclomatic Complexity 1 include/linux/mm.h:lowmem_page_address
Cyclomatic Complexity 3 include/linux/vmw_vmci_defs.h:vmci_handle_is_equal
Cyclomatic Complexity 1 include/linux/vmw_vmci_defs.h:vmci_handle_is_invalid
Cyclomatic Complexity 1 drivers//misc/vmw_balloon.c:vmballoon_cmd
Cyclomatic Complexity 2 drivers//misc/vmw_balloon.c:vmballoon_send_guest_id
Cyclomatic Complexity 2 drivers//misc/vmw_balloon.c:vmballoon_page_size
Cyclomatic Complexity 2 drivers//misc/vmw_balloon.c:vmballoon_add_page
Cyclomatic Complexity 7 drivers//misc/vmw_balloon.c:vmballoon_lock_op
Cyclomatic Complexity 2 drivers//misc/vmw_balloon.c:vmballoon_status_page
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 8 drivers//misc/vmw_balloon.c:__vmballoon_cmd
Cyclomatic Complexity 4 drivers//misc/vmw_balloon.c:vmballoon_send_start
Cyclomatic Complexity 2 include/linux/workqueue.h:to_delayed_work
Cyclomatic Complexity 2 drivers//misc/vmw_balloon.c:vmballoon_vmci_cleanup
Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
Cyclomatic Complexity 1 include/linux/list.h:list_del
Cyclomatic Complexity 2 drivers//misc/vmw_balloon.c:vmballoon_free_page
Cyclomatic Complexity 6 drivers//misc/vmw_balloon.c:vmballoon_pop
Cyclomatic Complexity 1 include/linux/gfp.h:__alloc_pages
Cyclomatic Complexity 1 include/linux/gfp.h:__alloc_pages_node
Cyclomatic Complexity 2 include/linux/gfp.h:alloc_pages_node
Cyclomatic Complexity 4 include/linux/jump_label.h:static_key_enable
Cyclomatic Complexity 2 drivers//misc/vmw_balloon.c:vmballoon_init_batching
Cyclomatic Complexity 4 include/linux/jump_label.h:static_key_disable
Cyclomatic Complexity 1 drivers//misc/vmw_balloon.c:vmballoon_deinit_batching
Cyclomatic Complexity 4 drivers//misc/vmw_balloon.c:vmballoon_vmci_init
Cyclomatic Complexity 7 drivers//misc/vmw_balloon.c:vmballoon_reset
Cyclomatic Complexity 1 include/linux/workqueue.h:mod_delayed_work
Cyclomatic Complexity 1 drivers//misc/vmw_balloon.c:vmballoon_doorbell
Cyclomatic Complexity 3 drivers//misc/vmw_balloon.c:vmballoon_send_get_target
Cyclomatic Complexity 6 drivers//misc/vmw_balloon.c:vmballoon_change
Cyclomatic Complexity 3 drivers//misc/vmw_balloon.c:vmballoon_alloc_page
Cyclomatic Complexity 2 include/linux/list.h:__list_add
Cyclomatic Complexity 1 include/linux/list.h:list_add
Cyclomatic Complexity 5 drivers//misc/vmw_balloon.c:vmballoon_lock
Cyclomatic Complexity 5 drivers//misc/vmw_balloon.c:vmballoon_unlock
Cyclomatic Complexity 5 drivers//misc/vmw_balloon.c:vmballoon_release_refused_pages
Cyclomatic Complexity 9 drivers//misc/vmw_balloon.c:vmballoon_inflate
Cyclomatic Complexity 10 drivers//misc/vmw_balloon.c:vmballoon_deflate
Cyclomatic Complexity 2 drivers//misc/vmw_balloon.c:vmballoon_debugfs_init
Cyclomatic Complexity 1 drivers//misc/vmw_balloon.c:vmballoon_debug_open
Cyclomatic Complexity 4 drivers//misc/vmw_balloon.c:vmballoon_debug_show
Cyclomatic Complexity 1 include/linux/workqueue.h:queue_delayed_work
Cyclomatic Complexity 4 drivers//misc/vmw_balloon.c:vmballoon_init
Cyclomatic Complexity 7 drivers//misc/vmw_balloon.c:vmballoon_work
Cyclomatic Complexity 1 drivers//misc/vmw_balloon.c:vmballoon_debugfs_exit
Cyclomatic Complexity 1 drivers//misc/vmw_balloon.c:vmballoon_exit
In file included from include/linux/export.h:45:0,
from include/linux/linkage.h:7,
from include/linux/kernel.h:7,
from drivers//misc/vmw_balloon.c:20:
drivers//misc/vmw_balloon.c: In function 'vmballoon_change':
include/linux/compiler.h:358:38: error: call to '__compiletime_assert_659' declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:338:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:358:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:45:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:79:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
include/linux/huge_mm.h:250:28: note: in expansion of macro 'BUILD_BUG'
#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
^~~~~~~~~
include/linux/huge_mm.h:80:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
^~~~~~~~~~~~~~~
>> include/linux/huge_mm.h:81:26: note: in expansion of macro 'HPAGE_PMD_ORDER'
#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
^~~~~~~~~~~~~~~
>> drivers//misc/vmw_balloon.c:659:39: note: in expansion of macro 'HPAGE_PMD_NR'
if (target < size && size - target < HPAGE_PMD_NR && target != 0)
^~~~~~~~~~~~
In file included from include/linux/mm.h:10:0,
from drivers//misc/vmw_balloon.c:21:
In function 'vmballoon_alloc_page',
inlined from 'vmballoon_inflate' at drivers//misc/vmw_balloon.c:702:8,
inlined from 'vmballoon_work' at drivers//misc/vmw_balloon.c:971:4:
include/linux/compiler.h:358:38: error: call to '__compiletime_assert_389' declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/gfp.h:518:46: note: in definition of macro 'alloc_pages'
alloc_pages_node(numa_node_id(), gfp_mask, order)
^~~~~
include/linux/compiler.h:346:2: note: in expansion of macro '__compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:358:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:45:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:79:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
include/linux/huge_mm.h:250:28: note: in expansion of macro 'BUILD_BUG'
#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
^~~~~~~~~
include/linux/huge_mm.h:80:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
^~~~~~~~~~~~~~~
drivers//misc/vmw_balloon.c:389:49: note: in expansion of macro 'HPAGE_PMD_ORDER'
return alloc_pages(VMW_HUGE_PAGE_ALLOC_FLAGS, HPAGE_PMD_ORDER);
^~~~~~~~~~~~~~~
--
Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read
Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_write
Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
Cyclomatic Complexity 1 include/linux/list.h:__list_del
Cyclomatic Complexity 2 arch/x86/include/asm/page_64.h:__phys_addr_nodebug
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_read
Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_set
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_read
Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_set
Cyclomatic Complexity 1 include/linux/jump_label.h:static_key_count
Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
Cyclomatic Complexity 1 arch/x86/include/asm/topology.h:numa_node_id
Cyclomatic Complexity 1 arch/x86/include/asm/io.h:virt_to_phys
Cyclomatic Complexity 1 include/linux/topology.h:numa_mem_id
Cyclomatic Complexity 1 include/linux/mm.h:lowmem_page_address
Cyclomatic Complexity 3 include/linux/vmw_vmci_defs.h:vmci_handle_is_equal
Cyclomatic Complexity 1 include/linux/vmw_vmci_defs.h:vmci_handle_is_invalid
Cyclomatic Complexity 1 drivers/misc/vmw_balloon.c:vmballoon_cmd
Cyclomatic Complexity 2 drivers/misc/vmw_balloon.c:vmballoon_send_guest_id
Cyclomatic Complexity 2 drivers/misc/vmw_balloon.c:vmballoon_page_size
Cyclomatic Complexity 2 drivers/misc/vmw_balloon.c:vmballoon_add_page
Cyclomatic Complexity 7 drivers/misc/vmw_balloon.c:vmballoon_lock_op
Cyclomatic Complexity 2 drivers/misc/vmw_balloon.c:vmballoon_status_page
Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
Cyclomatic Complexity 8 drivers/misc/vmw_balloon.c:__vmballoon_cmd
Cyclomatic Complexity 4 drivers/misc/vmw_balloon.c:vmballoon_send_start
Cyclomatic Complexity 2 include/linux/workqueue.h:to_delayed_work
Cyclomatic Complexity 2 drivers/misc/vmw_balloon.c:vmballoon_vmci_cleanup
Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
Cyclomatic Complexity 1 include/linux/list.h:list_del
Cyclomatic Complexity 2 drivers/misc/vmw_balloon.c:vmballoon_free_page
Cyclomatic Complexity 6 drivers/misc/vmw_balloon.c:vmballoon_pop
Cyclomatic Complexity 1 include/linux/gfp.h:__alloc_pages
Cyclomatic Complexity 1 include/linux/gfp.h:__alloc_pages_node
Cyclomatic Complexity 2 include/linux/gfp.h:alloc_pages_node
Cyclomatic Complexity 4 include/linux/jump_label.h:static_key_enable
Cyclomatic Complexity 2 drivers/misc/vmw_balloon.c:vmballoon_init_batching
Cyclomatic Complexity 4 include/linux/jump_label.h:static_key_disable
Cyclomatic Complexity 1 drivers/misc/vmw_balloon.c:vmballoon_deinit_batching
Cyclomatic Complexity 4 drivers/misc/vmw_balloon.c:vmballoon_vmci_init
Cyclomatic Complexity 7 drivers/misc/vmw_balloon.c:vmballoon_reset
Cyclomatic Complexity 1 include/linux/workqueue.h:mod_delayed_work
Cyclomatic Complexity 1 drivers/misc/vmw_balloon.c:vmballoon_doorbell
Cyclomatic Complexity 3 drivers/misc/vmw_balloon.c:vmballoon_send_get_target
Cyclomatic Complexity 6 drivers/misc/vmw_balloon.c:vmballoon_change
Cyclomatic Complexity 3 drivers/misc/vmw_balloon.c:vmballoon_alloc_page
Cyclomatic Complexity 2 include/linux/list.h:__list_add
Cyclomatic Complexity 1 include/linux/list.h:list_add
Cyclomatic Complexity 5 drivers/misc/vmw_balloon.c:vmballoon_lock
Cyclomatic Complexity 5 drivers/misc/vmw_balloon.c:vmballoon_unlock
Cyclomatic Complexity 5 drivers/misc/vmw_balloon.c:vmballoon_release_refused_pages
Cyclomatic Complexity 9 drivers/misc/vmw_balloon.c:vmballoon_inflate
Cyclomatic Complexity 10 drivers/misc/vmw_balloon.c:vmballoon_deflate
Cyclomatic Complexity 2 drivers/misc/vmw_balloon.c:vmballoon_debugfs_init
Cyclomatic Complexity 1 drivers/misc/vmw_balloon.c:vmballoon_debug_open
Cyclomatic Complexity 4 drivers/misc/vmw_balloon.c:vmballoon_debug_show
Cyclomatic Complexity 1 include/linux/workqueue.h:queue_delayed_work
Cyclomatic Complexity 4 drivers/misc/vmw_balloon.c:vmballoon_init
Cyclomatic Complexity 7 drivers/misc/vmw_balloon.c:vmballoon_work
Cyclomatic Complexity 1 drivers/misc/vmw_balloon.c:vmballoon_debugfs_exit
Cyclomatic Complexity 1 drivers/misc/vmw_balloon.c:vmballoon_exit
In file included from include/linux/export.h:45:0,
from include/linux/linkage.h:7,
from include/linux/kernel.h:7,
from drivers/misc/vmw_balloon.c:20:
drivers/misc/vmw_balloon.c: In function 'vmballoon_change':
include/linux/compiler.h:358:38: error: call to '__compiletime_assert_659' declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:338:4: note: in definition of macro '__compiletime_assert'
prefix ## suffix(); \
^~~~~~
include/linux/compiler.h:358:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:45:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:79:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
include/linux/huge_mm.h:250:28: note: in expansion of macro 'BUILD_BUG'
#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
^~~~~~~~~
include/linux/huge_mm.h:80:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
^~~~~~~~~~~~~~~
>> include/linux/huge_mm.h:81:26: note: in expansion of macro 'HPAGE_PMD_ORDER'
#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
^~~~~~~~~~~~~~~
drivers/misc/vmw_balloon.c:659:39: note: in expansion of macro 'HPAGE_PMD_NR'
if (target < size && size - target < HPAGE_PMD_NR && target != 0)
^~~~~~~~~~~~
In file included from include/linux/mm.h:10:0,
from drivers/misc/vmw_balloon.c:21:
In function 'vmballoon_alloc_page',
inlined from 'vmballoon_inflate' at drivers/misc/vmw_balloon.c:702:8,
inlined from 'vmballoon_work' at drivers/misc/vmw_balloon.c:971:4:
include/linux/compiler.h:358:38: error: call to '__compiletime_assert_389' declared with attribute error: BUILD_BUG failed
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/gfp.h:518:46: note: in definition of macro 'alloc_pages'
alloc_pages_node(numa_node_id(), gfp_mask, order)
^~~~~
include/linux/compiler.h:346:2: note: in expansion of macro '__compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:358:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:45:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:79:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
^~~~~~~~~~~~~~~~
include/linux/huge_mm.h:250:28: note: in expansion of macro 'BUILD_BUG'
#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
^~~~~~~~~
include/linux/huge_mm.h:80:26: note: in expansion of macro 'HPAGE_PMD_SHIFT'
#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
^~~~~~~~~~~~~~~
drivers/misc/vmw_balloon.c:389:49: note: in expansion of macro 'HPAGE_PMD_ORDER'
return alloc_pages(VMW_HUGE_PAGE_ALLOC_FLAGS, HPAGE_PMD_ORDER);
^~~~~~~~~~~~~~~

vim +/HPAGE_PMD_NR +659 drivers//misc/vmw_balloon.c

634
635 /**
636 * vmballoon_change - retrieve the required balloon change
637 *
638 * @b: pointer for the balloon.
639 *
640 * Return: the required change for the balloon size. A positive number
641 * indicates inflation, a negative number indicates a deflation.
642 */
643 static int64_t vmballoon_change(struct vmballoon *b)
644 {
645 int64_t size, target;
646
647 size = b->size;
648 target = b->target;
649
650 /*
651 * We must cast first because of int sizes
652 * Otherwise we might get huge positives instead of negatives
653 */
654
655 if (b->reset_required)
656 return 0;
657
658 /* consider a 2MB slack on deflate, unless the balloon is emptied */
> 659 if (target < size && size - target < HPAGE_PMD_NR && target != 0)
660 return 0;
661
662 return target - size;
663 }
664

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2018-09-18 14:21    [W:0.305 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site