Hi Wei, Thanks for testing and for your feedback.
Yeah, if you try to build inside a subdirectory, the top level export may not apply, so CFLAGS don't get updated, and even if they did, the path could be pointing to wrong location. As the docs recommend, building selftest using TARGETS, either from kernel source or "tools/testing/selftests/" works fine and doesn't fail. If you really want to build from selftests/mm/ directory then defining KSFT_INCLUDES with a fallback in the Makefile will resolve it, but there is no need of it if we stick with "TARGETS=mm". Thanks Bala Vignesh