From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796489406; b=u0oJ/GWzcxeo9h0h5a9adqhrZBghGNjYLNynKRR83UAZgY6sHHW1LPui0zt/D1iA9YUL meLM0admDV+I0i6a5Y+dkizUxVMoSr/2s8EGEaRpzWMZ6WP+PFW3P7/krt4BT6C2fdbvT zM9GKyNo02ghF7NNFdLrNB3odaFHJt2QO9rCCoVK+juIlYpusLwDoi4kM2cdcTWOpG5fv x+az43Clecj5r5XNKe3Yg+16OUbp/arYHp1TNehjMEx/YJbzyvp7VKB9c3Iufa9I/uUli oTVIRD2z3GxZOmue02CSUQfGoSj4TOv4W22Vum8l1xj7DCjMxaqSEfw97hLmDDyOL2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796489406; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=0H9LyHUEfpPYKBxIBw8WA/zW8c+ReOtyQFbhxRU3nvs=; b=QyeN4IHiXvBk6SucaDGU9kZkpg1UBzfsoS8hPWIw0DCMLscZK4n8JbuZxbeBC2Vg4sFN S35Krf9pFfzcOjAE3nJr/jgAblJ19zv4RT8zetVh1ATJaoZNtaFIUktigQn+Wb/Mo40eA xhd5MkQlQU/PFATN6nB9pMuDEhEIDl7ab1VAmjyZnhjbc7zOO4XSd4MFOkzgZ1sJwl7DU d/AQvjnASDOPkbdDazZ/VofVnT2byDTQtGz83zkjFhsQtcOo592NL0dejDj+iwt1Nh1Mr pB4P6VPQ1QAo1vL/AcbgEBUfpT3Zk69DGuSm8NeORPZL+1jZhzVj51J+z8ZNMyJqT5A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kJUEjr51; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 321D8606A31F; Sat, 5 Dec 2026 16:50:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kJUEjr51 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CCC91F00936; Sat, 5 Dec 2026 16:50:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796489405; bh=0H9LyHUEfpPYKBxIBw8WA/zW8c+ReOtyQFbhxRU3nvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kJUEjr517KDEM/SdmpRjfmGw7lieHyFVHmZqzbubnvG9H9W2F+FuM0LnVeFkmGPbz G+//rDuz2UI9mC2Xf5RWrGqfWbVhlDHvO+jJ4yXvhikNiC7Ow9wbAZpVQUZbCFoSSu ZLVVIPV1FRx0ppVB1wd/lMTq8BzRE+PJCKllsHQvEGdgEJzRpYXoTObdca1W21NlJL VeI9LhqFoRmlYpwsVptNOO+R4uPz0oG7dRgstYc8W4DZsuKCzd8UKvtSpeYb0Ws0ok ZcomVuiMlJ/2alk5Ek7lOzWw4IvNjfaUZrCgk+qQsaouumrVKYceKo1lvw7JRE1CVP LGQjjctXKT2pQ== From: SJ Park To: Enze Li Cc: SJ Park , shuah@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH] selftests/damon/access_memory: disable THP for deterministic access pattern Date: Sat, 5 Dec 2026 08:49:58 -0800 Message-ID: <20261205164958.92701-1-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261205145917.875356-1-lienze@kylinos.cn> References: X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello Enze, On Sat, 5 Dec 2026 22:59:17 +0800 Enze Li wrote: > The WSS estimation selftest always reports zero with a 100% error when > the system runs with THP='always'. The reason is that DAMON clears the > page table Accessed bits but does not flush the TLB. If the TLB still > covers the whole workload, the CPU never walks the page table again, so > DAMON sees no accesses at all. > > Commit 891d206e27dc ("selftests/damon/wss_estimation: test for up to 160 > MiB working set size") tried to fix this by making the workload bigger. > That only works with base pages, though. With THP='always', khugepage > turns the workload into 2MB pages, so even a big working set fits in > just a few TLB entries. TLB sizes also differ a lot between CPUs, so > there is no single working set size that works everywhere. > > On a 4 vCPU / 8 GB x86_64 VM, the test fails with THP='always': > > 50-th percentile error 1.000000 (expect 10485760, result 0) > > Setting THP to 'never' makes it pass at 20MB: > > 50-th percentile error 0.001758 (expect 20971520, result 20934656) > 75-th percentile error 0.002734 (expect 20971520, result 21028864) > > So make the workload itself predictable: turn off THP for access_memory > with prctl(PR_SET_THP_DISABLE). Then it only uses base pages and DAMON > can see the accesses no matter how the system is configured. It is a > process-wide setting, so one call before the allocations is enough. Awesome, thank you for this patch. > > Signed-off-by: Enze Li Reviewed-by: SJ Park This patch is applied to damon/next [1] tree. I will repost it soon (~1 week) as an mm.git merge request. So, no action from your side is needed for now. [1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees Thanks, SJ [...]