Skip to content

Commit 54dba9d

Browse files
kevin-brodsky-armgregkh
authored andcommitted
selftests/mm: build with -O2
commit 4603618 upstream. The mm kselftests are currently built with no optimisation (-O0). It's unclear why, and besides being obviously suboptimal, this also prevents the pkeys tests from working as intended. Let's build all the tests with -O2. [[email protected]: silence unused-result warnings] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Kevin Brodsky <[email protected]> Cc: Aruna Ramakrishna <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Joey Gouly <[email protected]> Cc: Keith Lucas <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> [ Yifei: This commit also fix the failure of pkey_sighandler_tests_64, which is also in linux-6.12.y, thus backport this commit. ] Signed-off-by: Yifei Liu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2799d16 commit 54dba9d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/testing/selftests/mm/Makefile

+8-1
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,16 @@ endif
3333
# LDLIBS.
3434
MAKEFLAGS += --no-builtin-rules
3535

36-
CFLAGS = -Wall -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
36+
CFLAGS = -Wall -O2 -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
3737
LDLIBS = -lrt -lpthread -lm
3838

39+
# Some distributions (such as Ubuntu) configure GCC so that _FORTIFY_SOURCE is
40+
# automatically enabled at -O1 or above. This triggers various unused-result
41+
# warnings where functions such as read() or write() are called and their
42+
# return value is not checked. Disable _FORTIFY_SOURCE to silence those
43+
# warnings.
44+
CFLAGS += -U_FORTIFY_SOURCE
45+
3946
TEST_GEN_FILES = cow
4047
TEST_GEN_FILES += compaction_test
4148
TEST_GEN_FILES += gup_longterm

0 commit comments

Comments
 (0)