The patch titled Subject: selftest/damon: add a test for duplicate context dirs creation has been added to the -mm mm-unstable branch. Its filename is selftest-damon-add-a-test-for-duplicate-context-dirs-creation.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftest-damon-add-a-test-for-duplicate-context-dirs-creation.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: SeongJae Park <sj@xxxxxxxxxx> Subject: selftest/damon: add a test for duplicate context dirs creation Date: Fri, 9 Sep 2022 20:28:55 +0000 Patch series "mm/damon: minor fixes and cleanups". This patchset contains minor fixes and cleanups for DAMON including - selftest for a bug we found before (Patch 1), - fix of region holes in vaddr corner case and a kunit test for it (Patches 2 and 3), and - documents/Kconfig updates for title wordsmithing (Patch 4) and more aggressive DAMON debugfs interface deprecation announcement (Patches 5-7). This patch (of 7): Commit d26f60703606 ("mm/damon/dbgfs: avoid duplicate context directory creation") fixes a bug which could result in memory leak and DAMON disablement. This commit adds a selftest for verifying the fix and avoid regression. Link: https://lkml.kernel.org/r/20220909202901.57977-1-sj@xxxxxxxxxx Link: https://lkml.kernel.org/r/20220909202901.57977-2-sj@xxxxxxxxxx Signed-off-by: SeongJae Park <sj@xxxxxxxxxx> Cc: Brendan Higgins <brendanhiggins@xxxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Shuah Khan <shuah@xxxxxxxxxx> Cc: Yun Levi <ppbuk5246@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/damon/Makefile | 1 tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh | 27 ++++++++++ 2 files changed, 28 insertions(+) --- /dev/null +++ a/tools/testing/selftests/damon/debugfs_duplicate_context_creation.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +source _debugfs_common.sh + +# Test duplicated context creation +# ================================ + +if ! echo foo > "$DBGFS/mk_contexts" +then + echo "context creation failed" + exit 1 +fi + +if echo foo > "$DBGFS/mk_contexts" +then + echo "duplicate context creation success" + exit 1 +fi + +if ! echo foo > "$DBGFS/rm_contexts" +then + echo "context deletion failed" + exit 1 +fi + +exit 0 --- a/tools/testing/selftests/damon/Makefile~selftest-damon-add-a-test-for-duplicate-context-dirs-creation +++ a/tools/testing/selftests/damon/Makefile @@ -6,6 +6,7 @@ TEST_GEN_FILES += huge_count_read_write TEST_FILES = _chk_dependency.sh _debugfs_common.sh TEST_PROGS = debugfs_attrs.sh debugfs_schemes.sh debugfs_target_ids.sh TEST_PROGS += debugfs_empty_targets.sh debugfs_huge_count_read_write.sh +TEST_PROGS += debugfs_duplicate_context_creation.sh TEST_PROGS += sysfs.sh include ../lib.mk _ Patches currently in -mm which might be from sj@xxxxxxxxxx are mm-demotion-update-node_is_toptier-to-work-with-memory-tiers-fix.patch selftest-damon-add-a-test-for-duplicate-context-dirs-creation.patch mm-damon-core-avoid-holes-in-newly-set-monitoring-target-ranges.patch mm-damon-core-test-test-damon_set_regions.patch docs-admin-guide-mm-damon-rename-the-title-of-the-document.patch mm-damon-kconfig-notify-debugfs-deprecation-plan.patch docs-admin-guide-mm-damon-start-mention-the-dependency-as-sysfs-instead-of-debugfs.patch docs-admin-guide-mm-damon-usage-note-damon-debugfs-interface-deprecation-plan.patch