Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib/test_hmm: reduce stack usage

The various test ioctl handlers use arrays of 64 integers that add up to
1KiB of stack data, which in turn leads to exceeding the warning limit in
some configurations:

lib/test_hmm.c:935:12: error: stack frame size (1408) exceeds limit (1280)
in 'dmirror_migrate_to_device' [-Werror,-Wframe-larger-than]

Use half the size for these arrays, in order to stay under the warning
limits. The code can already deal with arbitrary lengths, but this may be
a little less efficient.

Link: https://lkml.kernel.org/r/20250610092159.2639515-1-arnd@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Arnd Bergmann and committed by
Andrew Morton
6046a3be ba785855

+7 -7
+7 -7
lib/test_hmm.c
··· 330 330 { 331 331 struct mm_struct *mm = dmirror->notifier.mm; 332 332 unsigned long addr; 333 - unsigned long pfns[64]; 333 + unsigned long pfns[32]; 334 334 struct hmm_range range = { 335 335 .notifier = &dmirror->notifier, 336 336 .hmm_pfns = pfns, ··· 879 879 unsigned long size = cmd->npages << PAGE_SHIFT; 880 880 struct mm_struct *mm = dmirror->notifier.mm; 881 881 struct vm_area_struct *vma; 882 - unsigned long src_pfns[64] = { 0 }; 883 - unsigned long dst_pfns[64] = { 0 }; 882 + unsigned long src_pfns[32] = { 0 }; 883 + unsigned long dst_pfns[32] = { 0 }; 884 884 struct migrate_vma args = { 0 }; 885 885 unsigned long next; 886 886 int ret; ··· 939 939 unsigned long size = cmd->npages << PAGE_SHIFT; 940 940 struct mm_struct *mm = dmirror->notifier.mm; 941 941 struct vm_area_struct *vma; 942 - unsigned long src_pfns[64] = { 0 }; 943 - unsigned long dst_pfns[64] = { 0 }; 942 + unsigned long src_pfns[32] = { 0 }; 943 + unsigned long dst_pfns[32] = { 0 }; 944 944 struct dmirror_bounce bounce; 945 945 struct migrate_vma args = { 0 }; 946 946 unsigned long next; ··· 1144 1144 unsigned long size = cmd->npages << PAGE_SHIFT; 1145 1145 unsigned long addr; 1146 1146 unsigned long next; 1147 - unsigned long pfns[64]; 1148 - unsigned char perm[64]; 1147 + unsigned long pfns[32]; 1148 + unsigned char perm[32]; 1149 1149 char __user *uptr; 1150 1150 struct hmm_range range = { 1151 1151 .hmm_pfns = pfns,