Re: [PATCH v2 07/22] mm: KUnit tests for the mermap

From: kernel test robot

Date: Tue Mar 24 2026 - 04:09:44 EST


Hi Brendan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on b5d083a3ed1e2798396d5e491432e887da8d4a06]

url: https://github.com/intel-lab-lkp/linux/commits/Brendan-Jackman/x86-mm-split-out-preallocate_sub_pgd/20260321-042521
base: b5d083a3ed1e2798396d5e491432e887da8d4a06
patch link: https://lore.kernel.org/r/20260320-page_alloc-unmapped-v2-7-28bf1bd54f41%40google.com
patch subject: [PATCH v2 07/22] mm: KUnit tests for the mermap
config: x86_64-randconfig-101-20260324 (https://download.01.org/0day-ci/archive/20260324/202603241512.3kG43FzT-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603241512.3kG43FzT-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> mm/tests/mermap_kunit.c:156:2-3: Unneeded semicolon

vim +156 mm/tests/mermap_kunit.c

131
132 static void test_multiple_allocs(struct kunit *test)
133 {
134 struct __mermap_put_args *argss[NR_NORMAL_ALLOCS] = { };
135 struct page *pages[NR_NORMAL_ALLOCS + 1];
136 struct mermap_alloc *reserved_alloc;
137 struct mm_struct *mm = get_mm(test);
138 int magic = 0xE4A4;
139
140 for (int i = 0; i < ARRAY_SIZE(pages); i++) {
141 pages[i] = alloc_page_wrapper(test, GFP_KERNEL);
142 WRITE_ONCE(*(int *)page_to_virt(pages[i]), magic + i);
143 }
144
145 for (int i = 0; i < ARRAY_SIZE(argss); i++) {
146 unsigned long base = mermap_cpu_base(raw_smp_processor_id());
147 unsigned long end = mermap_cpu_end(raw_smp_processor_id());
148 unsigned long addr;
149
150 argss[i] = __mermap_get_wrapper(test, mm, pages[i], PAGE_SIZE, PAGE_KERNEL);
151 KUNIT_ASSERT_NOT_NULL_MSG(test, argss[i], "alloc %d failed", i);
152
153 addr = (unsigned long) mermap_addr(argss[i]->alloc);
154 KUNIT_EXPECT_GE_MSG(test, addr, base, "alloc %d out of range", i);
155 KUNIT_EXPECT_LT_MSG(test, addr, end, "alloc %d out of range", i);
> 156 };
157
158 /*
159 * Read through the mappings to try and detect if they point to the
160 * pages we wrote earlier.
161 */
162 kthread_use_mm(mm);
163 for (int i = 0; i < ARRAY_SIZE(pages) - 1; i++) {
164 int *ptr = (int *)mermap_addr(argss[i]->alloc);
165
166 KUNIT_EXPECT_EQ(test, *ptr, magic + i);
167 }
168
169 /* Run out of alloc structures, only reserved allocs should succeed now. */
170 KUNIT_ASSERT_NULL(test, __mermap_get(mm, pages[NR_NORMAL_ALLOCS],
171 PAGE_SIZE, PAGE_KERNEL, false));
172 preempt_disable();
173 reserved_alloc = __mermap_get(mm, pages[NR_NORMAL_ALLOCS],
174 PAGE_SIZE, PAGE_KERNEL, true);
175 KUNIT_EXPECT_NOT_NULL(test, reserved_alloc);
176 /* Also check if this mapping seems correct*/
177 if (reserved_alloc) {
178 int *ptr = (int *)mermap_addr(reserved_alloc);
179
180 KUNIT_EXPECT_EQ(test, *ptr, magic + NR_NORMAL_ALLOCS);
181
182 mermap_put(reserved_alloc);
183 }
184 preempt_enable();
185
186 kthread_unuse_mm(mm);
187 }
188

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki