Commit 96ed62ea authored by Yunsheng Lin's avatar Yunsheng Lin Committed by Paolo Abeni
Browse files

mm: page_frag: fix a compile error when kernel is not compiled



page_frag test module is an out of tree module, but built
using KDIR as the main kernel tree, the mm test suite is
just getting skipped if newly added page_frag test module
fails to compile due to kernel not yet compiled.

Fix the above problem by ensuring both kernel is built first
and a newer kernel which has page_frag_cache.h is used.

CC: Andrew Morton <akpm@linux-foundation.org>
CC: Alexander Duyck <alexanderduyck@fb.com>
CC: Linux-MM <linux-mm@kvack.org>
Fixes: 7fef0dec ("mm: page_frag: add a test module for page_frag")
Fixes: 65941f10 ("mm: move the page fragment allocator from page_alloc into its own file")
Reported-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
Tested-by: default avatarMark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/20241119033012.257525-1-linyunsheng@huawei.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent a202e601
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -36,7 +36,16 @@ MAKEFLAGS += --no-builtin-rules
CFLAGS = -Wall -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
LDLIBS = -lrt -lpthread -lm

KDIR ?= /lib/modules/$(shell uname -r)/build
ifneq (,$(wildcard $(KDIR)/Module.symvers))
ifneq (,$(wildcard $(KDIR)/include/linux/page_frag_cache.h))
TEST_GEN_MODS_DIR := page_frag
else
PAGE_FRAG_WARNING = "missing page_frag_cache.h, please use a newer kernel"
endif
else
PAGE_FRAG_WARNING = "missing Module.symvers, please have the kernel built first"
endif

TEST_GEN_FILES = cow
TEST_GEN_FILES += compaction_test
@@ -214,3 +223,12 @@ warn_missing_liburing:
	echo "Warning: missing liburing support. Some tests will be skipped." ; \
	echo
endif

ifneq ($(PAGE_FRAG_WARNING),)
all: warn_missing_page_frag

warn_missing_page_frag:
	@echo ; \
	echo "Warning: $(PAGE_FRAG_WARNING). page_frag test will be skipped." ; \
	echo
endif
+1 −1
Original line number Diff line number Diff line
PAGE_FRAG_TEST_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
KDIR ?= $(abspath $(PAGE_FRAG_TEST_DIR)/../../../../..)
KDIR ?= /lib/modules/$(shell uname -r)/build

ifeq ($(V),1)
Q =