* [PATCH v4 0/2] selftests/mm: use pattern matching in .gitignore
@ 2026-08-03 22:17 pratmal
2026-08-03 22:17 ` [PATCH v4 1/2] selftests/mm: rename local_config.h to local_config.h_gen pratmal
2026-08-03 22:17 ` [PATCH v4 2/2] selftests/mm: use pattern matching in .gitignore pratmal
0 siblings, 2 replies; 7+ messages in thread
From: pratmal @ 2026-08-03 22:17 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan
Cc: SeongJae Park, Sarthak Sharma, Yosry Ahmed, David Hildenbrand,
Lorenzo Stoakes, Liam R . Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
Peter Xu, linux-mm, linux-kselftest, linux-kernel,
Pratyush Mallick
From: Pratyush Mallick <pratmal@google.com>
The current selftests/mm/.gitignore hardcodes each generated test binary
by name, which requires manual updates every time a new test is added.
This series switches to a pattern-matching approach (similar to KVM
selftests), ignoring everything by default and allowing specific source
extensions. To accommodate this without tracking generated headers,
local_config.h is renamed to local_config.h_gen.
Changelog since v3 [3]:
- Reordered the patches so that local_config.h is renamed before
updating .gitignore, preventing local_config.h from temporarily
showing up as an untracked file in git status (SeongJae Park).
Changelog since v2 [2]:
- Split the changes into two separate patches (header rename and
.gitignore update).
- Added Suggested-by for David Hildenbrand for the header rename approach.
- Dropped David's and Yosry's Reviewed-by tags.
- Kept Lorenzo Stoakes's Reviewed-by and added Mike Rapoport's Acked-by.
Changelog since v1 (RFC) [1]:
- Renamed local_config.h to local_config.h_gen to avoid conflict with !*.h.
- Updated Makefile, check_config.sh, and affected .c files for the rename.
- Removed *.mod.c as it was unnecessary.
Links:
[1] RFC: https://lore.kernel.org/linux-mm/afnMAaz1jY94db2n@lucifer/
[2] v2: https://lore.kernel.org/linux-mm/b6717dee-486b-4c61-8ec8-0e4269959469@kernel.org/
[3] v3: https://lore.kernel.org/linux-mm/20260511173411.267628-1-pratmal@google.com/
Pratyush Mallick (2):
selftests/mm: rename local_config.h to local_config.h_gen
selftests/mm: use pattern matching in .gitignore
tools/testing/selftests/mm/.gitignore | 71 +++-------------------
tools/testing/selftests/mm/Makefile | 6 +-
tools/testing/selftests/mm/check_config.sh | 2 +-
tools/testing/selftests/mm/cow.c | 2 +-
tools/testing/selftests/mm/gup_longterm.c | 2 +-
5 files changed, 15 insertions(+), 68 deletions(-)
--
2.55.0.571.g244d577d93-goog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 1/2] selftests/mm: rename local_config.h to local_config.h_gen
2026-08-03 22:17 [PATCH v4 0/2] selftests/mm: use pattern matching in .gitignore pratmal
@ 2026-08-03 22:17 ` pratmal
2026-08-03 23:57 ` SJ Park
2026-08-03 22:17 ` [PATCH v4 2/2] selftests/mm: use pattern matching in .gitignore pratmal
1 sibling, 1 reply; 7+ messages in thread
From: pratmal @ 2026-08-03 22:17 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan
Cc: SeongJae Park, Sarthak Sharma, Yosry Ahmed, David Hildenbrand,
Lorenzo Stoakes, Liam R . Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
Peter Xu, linux-mm, linux-kselftest, linux-kernel,
Pratyush Mallick
From: Pratyush Mallick <pratmal@google.com>
Because local_config.h is a generated build artifact, un-ignoring all
.h files in .gitignore causes it to incorrectly show up as an untracked
file in git status.
Rename it to local_config.h_gen so it no longer matches the !*.h
inclusion rule, preparing for a subsequent patch that switches
.gitignore to a pattern-matching approach.
Update Makefile, check_config.sh, and affected test sources (cow.c,
gup_longterm.c) accordingly.
Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Suggested-by: David Hildenbrand <david@kernel.org>
Signed-off-by: Pratyush Mallick <pratmal@google.com>
---
tools/testing/selftests/mm/Makefile | 6 +++---
tools/testing/selftests/mm/check_config.sh | 2 +-
tools/testing/selftests/mm/cow.c | 2 +-
tools/testing/selftests/mm/gup_longterm.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index 7a5de4e9bf52..32f4b016b74f 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -5,7 +5,7 @@
# script so kunit knows to run it, and add it to the list below.
# If you do not YOUR TESTS WILL NOT RUN IN THE CI.
-LOCAL_HDRS += $(selfdir)/mm/local_config.h $(top_srcdir)/mm/gup_test.h
+LOCAL_HDRS += $(selfdir)/mm/local_config.h_gen $(top_srcdir)/mm/gup_test.h
LOCAL_HDRS += $(selfdir)/mm/mseal_helpers.h
include local_config.mk
@@ -259,10 +259,10 @@ $(OUTPUT)/migration: LDLIBS += -lnuma
$(OUTPUT)/rmap: LDLIBS += -lnuma
-local_config.mk local_config.h: check_config.sh
+local_config.mk local_config.h_gen: check_config.sh
CC="$(CC)" CFLAGS="$(CFLAGS)" ./check_config.sh
-EXTRA_CLEAN += local_config.mk local_config.h
+EXTRA_CLEAN += local_config.mk local_config.h_gen
ifeq ($(IOURING_EXTRA_LIBS),)
all: warn_missing_liburing
diff --git a/tools/testing/selftests/mm/check_config.sh b/tools/testing/selftests/mm/check_config.sh
index b84c82bbf875..b46bf2d2e7f8 100755
--- a/tools/testing/selftests/mm/check_config.sh
+++ b/tools/testing/selftests/mm/check_config.sh
@@ -4,7 +4,7 @@
# Probe for libraries and create header files to record the results. Both C
# header files and Makefile include fragments are created.
-OUTPUT_H_FILE=local_config.h
+OUTPUT_H_FILE=local_config.h_gen
OUTPUT_MKFILE=local_config.mk
tmpname=$(mktemp)
diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
index d9c69c04b67d..87710c5a2d3c 100644
--- a/tools/testing/selftests/mm/cow.c
+++ b/tools/testing/selftests/mm/cow.c
@@ -21,7 +21,7 @@
#include <sys/wait.h>
#include <linux/memfd.h>
-#include "local_config.h"
+#include "local_config.h_gen"
#ifdef LOCAL_CONFIG_HAVE_LIBURING
#include <liburing.h>
#endif /* LOCAL_CONFIG_HAVE_LIBURING */
diff --git a/tools/testing/selftests/mm/gup_longterm.c b/tools/testing/selftests/mm/gup_longterm.c
index f61150d28eb2..00ea0dd2f655 100644
--- a/tools/testing/selftests/mm/gup_longterm.c
+++ b/tools/testing/selftests/mm/gup_longterm.c
@@ -21,7 +21,7 @@
#include <linux/magic.h>
#include <linux/memfd.h>
-#include "local_config.h"
+#include "local_config.h_gen"
#ifdef LOCAL_CONFIG_HAVE_LIBURING
#include <liburing.h>
#endif /* LOCAL_CONFIG_HAVE_LIBURING */
--
2.55.0.571.g244d577d93-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] selftests/mm: rename local_config.h to local_config.h_gen
2026-08-03 22:17 ` [PATCH v4 1/2] selftests/mm: rename local_config.h to local_config.h_gen pratmal
@ 2026-08-03 23:57 ` SJ Park
2026-08-04 0:02 ` SJ Park
0 siblings, 1 reply; 7+ messages in thread
From: SJ Park @ 2026-08-03 23:57 UTC (permalink / raw)
To: pratmal
Cc: SJ Park, Andrew Morton, Shuah Khan, Sarthak Sharma, Yosry Ahmed,
David Hildenbrand, Lorenzo Stoakes, Liam R . Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jason Gunthorpe, John Hubbard, Peter Xu, linux-mm,
linux-kselftest, linux-kernel, Liam R. Howlett
Hell Pratyush,
My recipients checker found you are using the old email address of Liam, so
added Liam's updated email to the recipients list.
On Mon, 3 Aug 2026 22:17:31 +0000 pratmal@google.com wrote:
> From: Pratyush Mallick <pratmal@google.com>
>
> Because local_config.h is a generated build artifact, un-ignoring all
> .h files in .gitignore causes it to incorrectly show up as an untracked
> file in git status.
>
> Rename it to local_config.h_gen so it no longer matches the !*.h
> inclusion rule, preparing for a subsequent patch that switches
> .gitignore to a pattern-matching approach.
>
> Update Makefile, check_config.sh, and affected test sources (cow.c,
> gup_longterm.c) accordingly.
Looks good to me. Thank you for accepting my humble suggestion or reordering.
I found this patch cannot cleanly 'git am'-ed on mm-new, mm-unstable and even
mm-stable. Maybe rebasing will be nice?
>
> Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> Suggested-by: David Hildenbrand <david@kernel.org>
> Signed-off-by: Pratyush Mallick <pratmal@google.com>
Reviewed-by: SJ Park <sj@kernel.org>
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] selftests/mm: rename local_config.h to local_config.h_gen
2026-08-03 23:57 ` SJ Park
@ 2026-08-04 0:02 ` SJ Park
0 siblings, 0 replies; 7+ messages in thread
From: SJ Park @ 2026-08-04 0:02 UTC (permalink / raw)
To: SJ Park
Cc: pratmal, Andrew Morton, Shuah Khan, Sarthak Sharma, Yosry Ahmed,
David Hildenbrand, Lorenzo Stoakes, Liam R . Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jason Gunthorpe, John Hubbard, Peter Xu, linux-mm,
linux-kselftest, linux-kernel, Liam R. Howlett
On Mon, 03 Aug 2026 16:57:51 -0700 SJ Park <sj@kernel.org> wrote:
[...]
> I found this patch cannot cleanly 'git am'-ed on mm-new, mm-unstable and even
> mm-stable. Maybe rebasing will be nice?
Never mind, I just found Andrew already added this to mm-new.
[1] https://lore.kernel.org/20260803230818.437641F000E9@smtp.kernel.org
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 2/2] selftests/mm: use pattern matching in .gitignore
2026-08-03 22:17 [PATCH v4 0/2] selftests/mm: use pattern matching in .gitignore pratmal
2026-08-03 22:17 ` [PATCH v4 1/2] selftests/mm: rename local_config.h to local_config.h_gen pratmal
@ 2026-08-03 22:17 ` pratmal
2026-08-04 0:01 ` SJ Park
2026-08-04 9:12 ` David Hildenbrand (Arm)
1 sibling, 2 replies; 7+ messages in thread
From: pratmal @ 2026-08-03 22:17 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan
Cc: SeongJae Park, Sarthak Sharma, Yosry Ahmed, David Hildenbrand,
Lorenzo Stoakes, Liam R . Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
Peter Xu, linux-mm, linux-kselftest, linux-kernel,
Pratyush Mallick
From: Pratyush Mallick <pratmal@google.com>
The current .gitignore hardcodes each generated test binary by name,
requiring updates every time a new test is added.
Switch to the pattern-matching approach similar to KVM:selftests.
Ignore everything by default and then allow source extensions (.c, .h, .sh)
and tracked non-source files.
Note that local_config.h was renamed to local_config.h_gen in a previous
patch so that un-ignoring *.h files does not cause generated build
artifacts to become untracked.
Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Suggested-by: Yosry Ahmed <yosry@kernel.org>
Signed-off-by: Pratyush Mallick <pratmal@google.com>
---
tools/testing/selftests/mm/.gitignore | 71 ++++-----------------------
1 file changed, 9 insertions(+), 62 deletions(-)
diff --git a/tools/testing/selftests/mm/.gitignore b/tools/testing/selftests/mm/.gitignore
index 83ad9454dd9d..fcd892ed21e3 100644
--- a/tools/testing/selftests/mm/.gitignore
+++ b/tools/testing/selftests/mm/.gitignore
@@ -1,63 +1,10 @@
# SPDX-License-Identifier: GPL-2.0-only
-cow
-hugepage-mmap
-hugepage-mremap
-hugepage-shm
-hugepage-vmemmap
-hugetlb-madvise
-hugetlb-read-hwpoison
-hugetlb-soft-offline
-khugepaged
-map_hugetlb
-map_populate
-thuge-gen
-compaction_test
-memory-failure
-migration
-mlock2-tests
-mrelease_test
-mremap_dontunmap
-mremap_test
-on-fault-limit
-transhuge-stress
-pagemap_ioctl
-pfnmap
-process_madv
-*.tmp*
-protection_keys
-protection_keys_32
-protection_keys_64
-madv_populate
-uffd-stress
-uffd-unit-tests
-uffd-wp-mremap
-mlock-intersect-test
-mlock-random-test
-virtual_address_range
-gup_test
-va_128TBswitch
-map_fixed_noreplace
-write_to_hugetlbfs
-hmm-tests
-memfd_secret
-soft-dirty
-split_huge_page_test
-ksm_tests
-local_config.h
-local_config.mk
-ksm_functional_tests
-mdwe_test
-gup_longterm
-mkdirty
-va_high_addr_switch
-hugetlb_fault_after_madv
-hugetlb_madv_vs_map
-mseal_test
-droppable
-hugetlb_dio
-pkey_sighandler_tests_32
-pkey_sighandler_tests_64
-guard-regions
-merge
-prctl_thp_disable
-rmap
+*
+!/**/
+!*.c
+!*.h
+!*.sh
+!.gitignore
+!Makefile
+!config
+!settings
--
2.55.0.571.g244d577d93-goog
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] selftests/mm: use pattern matching in .gitignore
2026-08-03 22:17 ` [PATCH v4 2/2] selftests/mm: use pattern matching in .gitignore pratmal
@ 2026-08-04 0:01 ` SJ Park
2026-08-04 9:12 ` David Hildenbrand (Arm)
1 sibling, 0 replies; 7+ messages in thread
From: SJ Park @ 2026-08-04 0:01 UTC (permalink / raw)
To: pratmal
Cc: SJ Park, Andrew Morton, Shuah Khan, Sarthak Sharma, Yosry Ahmed,
David Hildenbrand, Lorenzo Stoakes, Liam R . Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jason Gunthorpe, John Hubbard, Peter Xu, linux-mm,
linux-kselftest, linux-kernel, Liam R. Howlett
Cc-ed Liam's up-to-date email address.
On Mon, 3 Aug 2026 22:17:32 +0000 pratmal@google.com wrote:
> From: Pratyush Mallick <pratmal@google.com>
>
> The current .gitignore hardcodes each generated test binary by name,
> requiring updates every time a new test is added.
>
> Switch to the pattern-matching approach similar to KVM:selftests.
> Ignore everything by default and then allow source extensions (.c, .h, .sh)
> and tracked non-source files.
>
> Note that local_config.h was renamed to local_config.h_gen in a previous
> patch so that un-ignoring *.h files does not cause generated build
> artifacts to become untracked.
Looks nice and smart to me!
>
> Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> Suggested-by: Yosry Ahmed <yosry@kernel.org>
> Signed-off-by: Pratyush Mallick <pratmal@google.com>
Reviewed-by: SJ Park <sj@kernel.org>
> ---
> tools/testing/selftests/mm/.gitignore | 71 ++++-----------------------
> 1 file changed, 9 insertions(+), 62 deletions(-)
What a lovely diffstat. :)
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] selftests/mm: use pattern matching in .gitignore
2026-08-03 22:17 ` [PATCH v4 2/2] selftests/mm: use pattern matching in .gitignore pratmal
2026-08-04 0:01 ` SJ Park
@ 2026-08-04 9:12 ` David Hildenbrand (Arm)
1 sibling, 0 replies; 7+ messages in thread
From: David Hildenbrand (Arm) @ 2026-08-04 9:12 UTC (permalink / raw)
To: pratmal, Andrew Morton, Shuah Khan
Cc: SeongJae Park, Sarthak Sharma, Yosry Ahmed, Lorenzo Stoakes,
Liam R . Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jason Gunthorpe, John Hubbard,
Peter Xu, linux-mm, linux-kselftest, linux-kernel
On 8/4/26 00:17, pratmal@google.com wrote:
> From: Pratyush Mallick <pratmal@google.com>
>
> The current .gitignore hardcodes each generated test binary by name,
> requiring updates every time a new test is added.
>
> Switch to the pattern-matching approach similar to KVM:selftests.
> Ignore everything by default and then allow source extensions (.c, .h, .sh)
> and tracked non-source files.
>
> Note that local_config.h was renamed to local_config.h_gen in a previous
> patch so that un-ignoring *.h files does not cause generated build
> artifacts to become untracked.
>
> Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> Suggested-by: Yosry Ahmed <yosry@kernel.org>
> Signed-off-by: Pratyush Mallick <pratmal@google.com>
> ---
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-08-04 9:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 22:17 [PATCH v4 0/2] selftests/mm: use pattern matching in .gitignore pratmal
2026-08-03 22:17 ` [PATCH v4 1/2] selftests/mm: rename local_config.h to local_config.h_gen pratmal
2026-08-03 23:57 ` SJ Park
2026-08-04 0:02 ` SJ Park
2026-08-03 22:17 ` [PATCH v4 2/2] selftests/mm: use pattern matching in .gitignore pratmal
2026-08-04 0:01 ` SJ Park
2026-08-04 9:12 ` David Hildenbrand (Arm)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox