From patchwork Tue Nov 19 03:30:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13879397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D12FD60D15 for ; Tue, 19 Nov 2024 03:36:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A8F06B0098; Mon, 18 Nov 2024 22:36:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 531836B009A; Mon, 18 Nov 2024 22:36:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D24F6B009B; Mon, 18 Nov 2024 22:36:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1AEC76B0098 for ; Mon, 18 Nov 2024 22:36:52 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id BB000160113 for ; Tue, 19 Nov 2024 03:36:51 +0000 (UTC) X-FDA: 82801431846.15.A39DAE0 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf01.hostedemail.com (Postfix) with ESMTP id 6864A40009 for ; Tue, 19 Nov 2024 03:36:10 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731987166; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=ughjZcwuLjLHFEelIUuwA5X0CPygutUXK/bjLFkWRnE=; b=doC2Pxj7O/6OMZht5eV55nOUotbfp9h2KTAFWM40guV+2ywfx8971Or4JTKb964+uFxqAt wW2TpBZOcw/JgLr97T/98POxtu4jhInkQF3T+zO5BI7UG9PuoxikxI6AewLOwZCTFT/pAN YLJ5jUqfzaTugIun22XCHuEG2HVJwFw= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731987166; a=rsa-sha256; cv=none; b=cmPobi4cZ5uhfKZ8EuuR4tJenop0V7BZwv7/YrQD/d9Qz890Rn9nDweyWf4lXW/votDyY1 MP3FWPQbmpvuD7DP1pm8VpVKJG2KPl82gN8BP7Tc+wAHrLKE/5W2kdtI2cSf0ywKliyNph fQCsoiiAKNKfmBTQ4beYjKwbKeSgMq8= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4XsqmV6Yx8z1JCXn; Tue, 19 Nov 2024 11:31:54 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id D4CB414010C; Tue, 19 Nov 2024 11:36:44 +0800 (CST) Received: from localhost.localdomain (10.90.30.45) by dggpemf200006.china.huawei.com (7.185.36.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 19 Nov 2024 11:36:44 +0800 From: Yunsheng Lin To: , , CC: , Yunsheng Lin , Andrew Morton , Alexander Duyck , Linux-MM , Mark Brown , Shuah Khan , , Subject: [PATCH net-next v2] mm: page_frag: fix a compile error when kernel is not compiled Date: Tue, 19 Nov 2024 11:30:11 +0800 Message-ID: <20241119033012.257525-1-linyunsheng@huawei.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 X-Originating-IP: [10.90.30.45] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemf200006.china.huawei.com (7.185.36.61) X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6864A40009 X-Stat-Signature: tqoinjnmcyj3g6h111ku9a7jshoymj9x X-Rspam-User: X-HE-Tag: 1731987370-280841 X-HE-Meta: U2FsdGVkX1+EWXT8pl6ZG84UbncQsMp5dBYOscegp0wDoMg1BzAuddIOb3lSnxH5QXcNyEheMnxg/q20rgGwKWnkbW+vVrBiL3saUD/jeiuYyOHXdLnxLzPR5Luagr4uNC2W3fvdomyFdnYjSESiifIR6lcv88TmuJhdHn1rwm0btQaO43SDqNdIHKNj94sMVRemr19RDQ7qrdfA4MmBL9zdb3kTJXKMfGPxMi9rtnKs3Shtc/W41zeGTyjWQCx0FgTqjWhO4w+WNOZciNVjfbu+1i9NpNKk1XiLWPa75pfpd7e5yQ/GQPVenfq/C/fF0Twci7BzAl3IHHsT67BWa1mEWo736BgsEyyMI4EhkiTcPOGcvDzxJF682rYKSPaZqnGCN4JbUlfaXKyStGmrdOHwMrlLGpD5fIXnAO2Ks5nCcRE6JcAfQzTaeW9RvwDkZWgMvB+sQhDKXxdRtw9nNO/GsgFGxYQc+ecGv13ikpB0NFJLPVSPMJAvC9riMG98M1+8w5osKuV57W5J0YJW9dVxuFBXgu2NZ4cxE7npxRWU9CnEBOtq5SNgwo1zc36K9QQJo4befWjFJHCzC1G4VUAgbnshxjoabcqQdKLg+uxqUPbRUFRiVE+PMHzrXsd8fFvF4aVsZWJ8ZM4f7wOQ+fWrSDq8bnwaWcSuSxAgr9znqsOHeG5VuraKnh7Id/rjwczj+TGXCUlZQWSn8pNxIdVbITDkYlR6HfSiGIph8hblG+teIoGimUOrETjCx++PAJSgu8+XkpHxr2brZsY+vu50yK7j3/p+2KEhrUcEyvwWo6mlGHtJyEIUM6LdDX06JnZMK4Za/ZZ6pB+Sjalzo+HaXKGxnrvuOUQ9U+QgG3mtefP67DtfcgzPaGU0bVIVzEH3XcjFAHZ+/53zh/ANoEmUGUvIwXQ62OfWXa6+N5Z+MU94QjLbQ3W+cZijZ6HIY+xsOYPH5ZxXltaTdD6 f3OtAaBe MoMIbMO46O+v/ey3ik8m0eOrinP95+3SHTJ97KS1qyJOx9lr4/QmOPk81kx8dguKyW5Z73sgZJtO9CEzu2NJNMyKu76Wdu9ANjVcYklxT7d1bb9fPnCsGOxO45+vsMPnRmhz772PrczKemhtohGUTRVQGM1HeUwgHaG1HrWuH/9e3/ufm+VsiLS+oTE5y4APNNGM0xc0rGFB+iXTQT08EzU2B7a2BzrSvI6sftVzG13palElgkgSFfH0+iN0Uf0rkUJMjt5LNRNEjmxrzcwW1rAKiRRQya/v8brJN4rKzUIre34vFZMgCR+sHvB4sZiIFvy6xt1YbNAItzPy0+s61uA/wE70swH6wmM51q5ppUVpmN+9sXjVl7jqMQEU3viGqXgxS0PHVMlsgyU8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 CC: Alexander Duyck CC: Linux-MM Fixes: 7fef0dec415c ("mm: page_frag: add a test module for page_frag") Fixes: 65941f10caf2 ("mm: move the page fragment allocator from page_alloc into its own file") Reported-by: Mark Brown Signed-off-by: Yunsheng Lin Tested-by: Mark Brown --- V2: Repost by adding net-next ML. Note, page_frag test module is only in the net-next tree for now, so target the net-next tree. --- tools/testing/selftests/mm/Makefile | 18 ++++++++++++++++++ tools/testing/selftests/mm/page_frag/Makefile | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index acec529baaca..04e04733fc8a 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -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 diff --git a/tools/testing/selftests/mm/page_frag/Makefile b/tools/testing/selftests/mm/page_frag/Makefile index 58dda74d50a3..8c8bb39ffa28 100644 --- a/tools/testing/selftests/mm/page_frag/Makefile +++ b/tools/testing/selftests/mm/page_frag/Makefile @@ -1,5 +1,5 @@ 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 =