Skip to contentSkip to conversation

selftests/mm: link with thp_settings when necessary

PATCH In review Wei Yang 3 participants 5 messages Aug 1, 2025 – Aug 2, 2025

Subsystems (3)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 selftests/mm: link with thp_settings when necessary

Currently all test cases are linked with thp_settings, while only 6 out of 50+ targets rely on it.

Instead of making thp_settings as a common dependency, link it only when necessary.

Cc Ryan Roberts <[email protected]>
---
 tools/testing/selftests/mm/Makefile | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
tools/testing/selftests/mm/Makefile +8 -3
index d4f19f87053b..eea4881c918a 100644
@@ -158,14 +158,19 @@ TEST_FILES += write_hugetlb_memory.sh
 
 include ../lib.mk
 
-$(TEST_GEN_PROGS): vm_util.c thp_settings.c
-$(TEST_GEN_FILES): vm_util.c thp_settings.c
+$(TEST_GEN_PROGS): vm_util.c
+$(TEST_GEN_FILES): vm_util.c
 
 $(OUTPUT)/uffd-stress: uffd-common.c
 $(OUTPUT)/uffd-unit-tests: uffd-common.c
-$(OUTPUT)/uffd-wp-mremap: uffd-common.c
+$(OUTPUT)/uffd-wp-mremap: uffd-common.c thp_settings.c
 $(OUTPUT)/protection_keys: pkey_util.c
 $(OUTPUT)/pkey_sighandler_tests: pkey_util.c
+$(OUTPUT)/cow: thp_settings.c
+$(OUTPUT)/migration: thp_settings.c
+$(OUTPUT)/khugepaged: thp_settings.c
+$(OUTPUT)/ksm_tests: thp_settings.c
+$(OUTPUT)/soft-dirty: thp_settings.c
 
 ifeq ($(ARCH),x86_64)
 BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32))
Signature · 1 line
2.34.1
#1 lore raw
Quoted 5 lines · Wei Yang

Currently all test cases are linked with thp_settings, while only 6 out of 50+ targets rely on it.

Instead of making thp_settings as a common dependency, link it only when necessary.

You don't state why we should care about that? I don't see how binary size is a problem, why do you think it is?

Signature · 3 lines
Cheers,

David / dhildenb
#2 lore raw
Quoted 10 lines · David Hildenbrand
Quoted 5 lines · Wei Yang

Currently all test cases are linked with thp_settings, while only 6 out of 50+ targets rely on it.

Instead of making thp_settings as a common dependency, link it only when necessary.

You don't state why we should care about that? I don't see how binary size is a problem, why do you think it is?

Yeah overall I'm with David on this, I'd rather we keep things simple (so you don't need to remember to link against this file) and just plonk all the stuff you need to link to together in the Makefile.

It's not really a big deal when it comes to test stuff I don't think.

Cheers, Lorenzo

author
#3 lore raw
Quoted 9 lines · Lorenzo Stoakes
Quoted 8 lines · David Hildenbrand
Quoted 5 lines · Wei Yang

Currently all test cases are linked with thp_settings, while only 6 out of 50+ targets rely on it.

Instead of making thp_settings as a common dependency, link it only when necessary.

Quoted 6 lines
Quoted 2 lines

You don't state why we should care about that? I don't see how binary size is a problem, why do you think it is?

Yeah overall I'm with David on this, I'd rather we keep things simple (so you don't need to remember to link against this file) and just plonk all the stuff you need to link to together in the Makefile.

I have thought about this, while current implementation do specify its necessary dependency for some target like uffd-common.c/pkey_util.c.

So I thought we may keep the same style.

Quoted 3 lines

It's not really a big deal when it comes to test stuff I don't think.

Yes, this is not a big deal in general. I come up with this idea because my test machine is too old. This change could same me some time during coding/debugging.

Quoted 1 line

Cheers, Lorenzo

Signature · 2 lines
Wei Yang
Help you, Help me
author
#4 lore raw
In reply to David Hildenbrand
Quoted 11 lines · David Hildenbrand
Quoted 5 lines · Wei Yang

Currently all test cases are linked with thp_settings, while only 6 out of 50+ targets rely on it.

Instead of making thp_settings as a common dependency, link it only when necessary.

You don't state why we should care about that? I don't see how binary size is a problem, why do you think it is?

Yes, it doesn't help on the binary size perspective.

I come up with this when doing some test. Each time a change in thp_settings would rebuild all the tests. My intent is to speed up the build during coding.

Not sure it worth a change.

Quoted 3 lines

Cheers,

David / dhildenb

Signature · 2 lines
Wei Yang
Help you, Help me