* [kees:dev/next-20240618/kmem_buckets-v5 3/6] mm/util.c:614: warning: Excess function parameter 'size' description in '__kvmalloc_node'
@ 2024-06-20 6:17 kernel test robot
2024-06-20 19:17 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2024-06-20 6:17 UTC (permalink / raw)
To: Kees Cook; +Cc: oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git dev/next-20240618/kmem_buckets-v5
head: c823e15736071e9b694fc62be0c80cbda6a4e344
commit: c69b01349ace4e0a92fc0f019668cd696776bbce [3/6] mm/slab: Introduce kvmalloc_buckets_node() that can take kmem_buckets argument
config: m68k-randconfig-r081-20240620 (https://download.01.org/0day-ci/archive/20240620/202406201631.5E0Dfzma-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240620/202406201631.5E0Dfzma-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406201631.5E0Dfzma-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> mm/util.c:614: warning: Excess function parameter 'size' description in '__kvmalloc_node'
vim +614 mm/util.c
eb36c5873b96e8c Al Viro 2012-05-30 595
a7c3e901a46ff54 Michal Hocko 2017-05-08 596 /**
c69b01349ace4e0 Kees Cook 2024-05-31 597 * __kvmalloc_node - attempt to allocate physically contiguous memory, but upon
a7c3e901a46ff54 Michal Hocko 2017-05-08 598 * failure, fall back to non-contiguous (vmalloc) allocation.
a7c3e901a46ff54 Michal Hocko 2017-05-08 599 * @size: size of the request.
c69b01349ace4e0 Kees Cook 2024-05-31 600 * @b: which set of kmalloc buckets to allocate from.
a7c3e901a46ff54 Michal Hocko 2017-05-08 601 * @flags: gfp mask for the allocation - must be compatible (superset) with GFP_KERNEL.
a7c3e901a46ff54 Michal Hocko 2017-05-08 602 * @node: numa node to allocate from
a7c3e901a46ff54 Michal Hocko 2017-05-08 603 *
a7c3e901a46ff54 Michal Hocko 2017-05-08 604 * Uses kmalloc to get the memory but if the allocation fails then falls back
a7c3e901a46ff54 Michal Hocko 2017-05-08 605 * to the vmalloc allocator. Use kvfree for freeing the memory.
a7c3e901a46ff54 Michal Hocko 2017-05-08 606 *
a421ef303008b0c Michal Hocko 2022-01-14 607 * GFP_NOWAIT and GFP_ATOMIC are not supported, neither is the __GFP_NORETRY modifier.
cc965a29db172c2 Michal Hocko 2017-07-12 608 * __GFP_RETRY_MAYFAIL is supported, and it should be used only if kmalloc is
cc965a29db172c2 Michal Hocko 2017-07-12 609 * preferable to the vmalloc fallback, due to visible performance drawbacks.
a7c3e901a46ff54 Michal Hocko 2017-05-08 610 *
a862f68a8b36008 Mike Rapoport 2019-03-05 611 * Return: pointer to the allocated memory of %NULL in case of failure
a7c3e901a46ff54 Michal Hocko 2017-05-08 612 */
c69b01349ace4e0 Kees Cook 2024-05-31 613 void *__kvmalloc_node_noprof(DECL_BUCKET_PARAMS(size, b), gfp_t flags, int node)
a7c3e901a46ff54 Michal Hocko 2017-05-08 @614 {
a7c3e901a46ff54 Michal Hocko 2017-05-08 615 gfp_t kmalloc_flags = flags;
a7c3e901a46ff54 Michal Hocko 2017-05-08 616 void *ret;
a7c3e901a46ff54 Michal Hocko 2017-05-08 617
a7c3e901a46ff54 Michal Hocko 2017-05-08 618 /*
4f4f2ba9c531b3d Michal Hocko 2017-06-02 619 * We want to attempt a large physically contiguous block first because
4f4f2ba9c531b3d Michal Hocko 2017-06-02 620 * it is less likely to fragment multiple larger blocks and therefore
4f4f2ba9c531b3d Michal Hocko 2017-06-02 621 * contribute to a long term fragmentation less than vmalloc fallback.
4f4f2ba9c531b3d Michal Hocko 2017-06-02 622 * However make sure that larger requests are not too disruptive - no
4f4f2ba9c531b3d Michal Hocko 2017-06-02 623 * OOM killer and no allocation failure warnings as we have a fallback.
a7c3e901a46ff54 Michal Hocko 2017-05-08 624 */
6c5ab6511f718c3 Michal Hocko 2017-05-08 625 if (size > PAGE_SIZE) {
6c5ab6511f718c3 Michal Hocko 2017-05-08 626 kmalloc_flags |= __GFP_NOWARN;
6c5ab6511f718c3 Michal Hocko 2017-05-08 627
cc965a29db172c2 Michal Hocko 2017-07-12 628 if (!(kmalloc_flags & __GFP_RETRY_MAYFAIL))
6c5ab6511f718c3 Michal Hocko 2017-05-08 629 kmalloc_flags |= __GFP_NORETRY;
a421ef303008b0c Michal Hocko 2022-01-14 630
a421ef303008b0c Michal Hocko 2022-01-14 631 /* nofail semantic is implemented by the vmalloc fallback */
a421ef303008b0c Michal Hocko 2022-01-14 632 kmalloc_flags &= ~__GFP_NOFAIL;
6c5ab6511f718c3 Michal Hocko 2017-05-08 633 }
a7c3e901a46ff54 Michal Hocko 2017-05-08 634
c69b01349ace4e0 Kees Cook 2024-05-31 635 ret = __kmalloc_node_noprof(PASS_BUCKET_PARAMS(size, b), kmalloc_flags, node);
a7c3e901a46ff54 Michal Hocko 2017-05-08 636
a7c3e901a46ff54 Michal Hocko 2017-05-08 637 /*
a7c3e901a46ff54 Michal Hocko 2017-05-08 638 * It doesn't really make sense to fallback to vmalloc for sub page
a7c3e901a46ff54 Michal Hocko 2017-05-08 639 * requests
a7c3e901a46ff54 Michal Hocko 2017-05-08 640 */
a7c3e901a46ff54 Michal Hocko 2017-05-08 641 if (ret || size <= PAGE_SIZE)
a7c3e901a46ff54 Michal Hocko 2017-05-08 642 return ret;
a7c3e901a46ff54 Michal Hocko 2017-05-08 643
30c19366636f725 Florian Westphal 2022-09-26 644 /* non-sleeping allocations are not supported by vmalloc */
30c19366636f725 Florian Westphal 2022-09-26 645 if (!gfpflags_allow_blocking(flags))
30c19366636f725 Florian Westphal 2022-09-26 646 return NULL;
30c19366636f725 Florian Westphal 2022-09-26 647
7661809d493b426 Linus Torvalds 2021-07-14 648 /* Don't even allow crazy sizes */
0708a0afe291bdf Daniel Borkmann 2022-03-04 649 if (unlikely(size > INT_MAX)) {
0708a0afe291bdf Daniel Borkmann 2022-03-04 650 WARN_ON_ONCE(!(flags & __GFP_NOWARN));
7661809d493b426 Linus Torvalds 2021-07-14 651 return NULL;
0708a0afe291bdf Daniel Borkmann 2022-03-04 652 }
7661809d493b426 Linus Torvalds 2021-07-14 653
9becb6889130231 Linus Torvalds 2022-04-22 654 /*
9becb6889130231 Linus Torvalds 2022-04-22 655 * kvmalloc() can always use VM_ALLOW_HUGE_VMAP,
9becb6889130231 Linus Torvalds 2022-04-22 656 * since the callers already cannot assume anything
9becb6889130231 Linus Torvalds 2022-04-22 657 * about the resulting pointer, and cannot play
9becb6889130231 Linus Torvalds 2022-04-22 658 * protection games.
9becb6889130231 Linus Torvalds 2022-04-22 659 */
88ae5fb755b0d45 Kent Overstreet 2024-03-21 660 return __vmalloc_node_range_noprof(size, 1, VMALLOC_START, VMALLOC_END,
9becb6889130231 Linus Torvalds 2022-04-22 661 flags, PAGE_KERNEL, VM_ALLOW_HUGE_VMAP,
9becb6889130231 Linus Torvalds 2022-04-22 662 node, __builtin_return_address(0));
a7c3e901a46ff54 Michal Hocko 2017-05-08 663 }
c69b01349ace4e0 Kees Cook 2024-05-31 664 EXPORT_SYMBOL(__kvmalloc_node_noprof);
a7c3e901a46ff54 Michal Hocko 2017-05-08 665
:::::: The code at line 614 was first introduced by commit
:::::: a7c3e901a46ff54c016d040847eda598a9e3e653 mm: introduce kv[mz]alloc helpers
:::::: TO: Michal Hocko <mhocko@suse.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [kees:dev/next-20240618/kmem_buckets-v5 3/6] mm/util.c:614: warning: Excess function parameter 'size' description in '__kvmalloc_node'
2024-06-20 6:17 [kees:dev/next-20240618/kmem_buckets-v5 3/6] mm/util.c:614: warning: Excess function parameter 'size' description in '__kvmalloc_node' kernel test robot
@ 2024-06-20 19:17 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2024-06-20 19:17 UTC (permalink / raw)
To: kernel test robot; +Cc: oe-kbuild-all, Vlastimil Babka
On Thu, Jun 20, 2024 at 02:17:50PM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git dev/next-20240618/kmem_buckets-v5
> head: c823e15736071e9b694fc62be0c80cbda6a4e344
> commit: c69b01349ace4e0a92fc0f019668cd696776bbce [3/6] mm/slab: Introduce kvmalloc_buckets_node() that can take kmem_buckets argument
> config: m68k-randconfig-r081-20240620 (https://download.01.org/0day-ci/archive/20240620/202406201631.5E0Dfzma-lkp@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240620/202406201631.5E0Dfzma-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202406201631.5E0Dfzma-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> mm/util.c:614: warning: Excess function parameter 'size' description in '__kvmalloc_node'
Ah yes, the argument macro was confusing kern-doc. I've squashed this
fix for v6:
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 95a59ac78f82..2791f8195203 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1729,6 +1729,7 @@ sub dump_function($$) {
$prototype =~ s/__printf\s*\(\s*\d*\s*,\s*\d*\s*\) +//;
$prototype =~ s/__(?:re)?alloc_size\s*\(\s*\d+\s*(?:,\s*\d+\s*)?\) +//;
$prototype =~ s/__diagnose_as\s*\(\s*\S+\s*(?:,\s*\d+\s*)*\) +//;
+ $prototype =~ s/DECL_BUCKET_PARAMS\s*\(\s*(\S+)\s*,\s*(\S+)\s*\)/$1, $2/;
my $define = $prototype =~ s/^#\s*define\s+//; #ak added
$prototype =~ s/__attribute_const__ +//;
$prototype =~ s/__attribute__\s*\(\(
Thanks!
-Kees
--
Kees Cook
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-20 19:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20 6:17 [kees:dev/next-20240618/kmem_buckets-v5 3/6] mm/util.c:614: warning: Excess function parameter 'size' description in '__kvmalloc_node' kernel test robot
2024-06-20 19:17 ` Kees Cook
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.