From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28FE738F23C for ; Tue, 13 Jan 2026 12:17:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768306642; cv=none; b=Dv+t9JmoLF2kOHpAvRU6Z/Jld9q0zoGOgBPElBbLE2A0zdJAEzYv9wbAoV/zT3/wSftM4HmjP+h6h+mxREM7TZPXPBI9oNuXt8+t0BV69hK9lfLvcek4arOX1qyQ/NVtrIR17rfXdIR6GgV02NJvDP7PD3h9+HVSbUyzV19oOuQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768306642; c=relaxed/simple; bh=9OmQe1fMKYYA4SinN8SIb2wYoDcsKDcc/wBBSjRQZQM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nAJifJQ80TaY8qe0wxNu5N3+hFGJ1plkkEqWGK8wpXY1IUm59pvFoNzf1cVuuszWxkgGWO67Qr6W2c0K4Aqot65M7u/ChmVPJMAvgzRTlwjZkq7Dsgdih1eKJCmV2olNqFQ8AVQ21RoRXLM/1R/Qb2g6jyMPLDJVV7VDjNXU6k4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PUATTsO5; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PUATTsO5" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-bc0d7255434so3353515a12.0 for ; Tue, 13 Jan 2026 04:17:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768306640; x=1768911440; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=DabuHi3K9u7UKNn7EoClhxIBJInkjBMtz9wL6ThmFfQ=; b=PUATTsO5xNdpwQzk9QcvzgCIxneq8cIFAYIzWfS4Ocghcpla6E9NoTS/cYuNjLNTcN SJUNPt/865nuUYcyFlBH5WsDS2e9aIDuC0odT9Mf1o1UGi6nEZdXP69DrBP8xn6KFOB9 3Uiw19m2bhv6cGK7RJ5/xvoIc4wyS5iTOHuv5YpWhvQZFTNRbYeq5RV37jwx/xqJubTT C2gnLeCTA42E4sWyXqp2m2+DgT3OSbA6skYjsphME9aEubZIwmeU/CVGxbFVVfiot77z F9v4WdJpcd+6wB5yfbPbcuTOT3JYSJeu17FFVfb5rb5+2EOzu8cGS+p+/IFzTpVGlIPF zT6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768306640; x=1768911440; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DabuHi3K9u7UKNn7EoClhxIBJInkjBMtz9wL6ThmFfQ=; b=wOIadW+x4Jh8EoC1Q5orIPHxXD91g/Or8V7Um1skwO6yKCGLNYAyd5zFAope/bGepv dSugsIO5i496nERtg4QUF79HLYj2J5tsWGt1jnFDfY79pG+oQvj5s5lM57/FgjybCWSV fQAyrJKOKShOvRxZLSvF0lvGj5fdjFFIT32X4E9ixNB8o/vUn5/4un8IRlZfuNX9lFL7 9mjxbYHN6ukVrL6NQ4H5LdQMkMSZs8aaNHBwk9EORYxGMyvUOBv9ebesc36Ru5PCPTbm ukasppG7ntog6vunXO/0ck/BcY8WtIvuxB9hHBdgTcB6ghZi6tAMDECshBPnYlArG8GW cCzg== X-Forwarded-Encrypted: i=1; AJvYcCWdp4i5qr6tqi64LFSOxIZ6I4VfamJ1apRjAeAzqbmW3oNIqej2GPHK+BDvcE+0xrUf9ZIm/JVuA+Ezel4=@vger.kernel.org X-Gm-Message-State: AOJu0YwYkAvWcJnsPs2/Je0MnFwc808pPqMwdGoaW30VWs/rSzPGJ3ZK DYWoxhfG34e9llLO665qmMoN3xuniTlJPzp3XDc5P956lmKrLaVXcv1XJcMEX3PL X-Gm-Gg: AY/fxX5ED5B9Zu4fZg8/SIDpmPDhGJunGxISZjf8R9/JMAlO4XmbRaL62Pr9OQhbcfV D+7awUX5W38WdXF1hzW1YeWl8/vJf3p3Jo4pqHCMFjqYodfo1a9JDLRFbYRL4pfGNmmZW+GfE0u uZlC1scRL/9YwILYfpcV+tk3BKP+qIeh3Mkp/DA+yCfd4aLjxgJ47lkFJEIPDuzJ3YcGPu2qNLe +0ClPbyiki52bc+YIvdhJoNR8eyr1VfD/P8r63X+0nlzglC3v4FXjPton22GCHYsK3Nz0EiIVsL CxtXwF7iBzkmbVFBsJwRSoBP23WL6Xyav0fmluk+sazGSNpPuFsHhkAEQHsKsQCnSmClW6VBaXU sNNJYoUpOuU4AV0mqarbgN93tPVuNwQyKMIJgt2Twtf8WZdv60ytBzChTcNONXdlErKP21AWQNo 2PFjjwkaLEa7UA X-Google-Smtp-Source: AGHT+IHcMGs8PoLCswC0jcVFT7uA/GxGBxuYPiLqvqoQfhZ141q5O7/FTfDa2atu+Qn3ppbT66iemg== X-Received: by 2002:a05:6a21:3286:b0:34e:865e:8a65 with SMTP id adf61e73a8af0-3898f9cd677mr23369587637.52.1768306640111; Tue, 13 Jan 2026 04:17:20 -0800 (PST) Received: from HP-Note-Host.. ([222.234.91.137]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-c4cbf28faf8sm20775186a12.7.2026.01.13.04.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jan 2026 04:17:19 -0800 (PST) From: JaeJoon Jung To: sj@kernel.org Cc: JaeJoon Jung , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, rgbi3307@nate.com Subject: [PATCH 1/2] mm/damon/core: modified and tunning damon_split_regions_of() Date: Tue, 13 Jan 2026 21:16:42 +0900 Message-ID: <20260113121646.31441-1-rgbi3307@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Before modification: sz_region |--------|--------|--------||--------|--------|--------|--------| nr_subs: 1 2 3 4 5 9 split random: <----------- (*] randmon LOST --------------> When dividing sz_region at rand, the random value may be small, such as 1 or 2. At this time, there is a problem that only the front areas corresponding to 1 and 2 are divided, and the remaining back area becomes too wide. If the area is too wide, there will be many missed address access judgments. After modification: sz_region |--------|--------|--------|--------|--------|--------|--------|| nr_subs: 1 2 3 4 5 9 split from <------------ (sz_region / nr_subs) ------------------> It is recommended to divide sz_region evenly in the ratio (sz_region / nr_subs) rather than using rand. In this way, if you decide nr_subs well, you can logically match the number of divisions and their sizes. Signed-off-by: JaeJoon Jung --- mm/damon/core.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index f9fc0375890a..ff9af9d6a788 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2394,27 +2394,18 @@ static void damon_split_regions_of(struct damon_target *t, int nr_subs, unsigned long min_sz_region) { struct damon_region *r, *next; - unsigned long sz_region, sz_sub = 0; + unsigned long sz_region, sz_sub; int i; damon_for_each_region_safe(r, next, t) { sz_region = damon_sz_region(r); + sz_sub = ALIGN_DOWN(sz_region / nr_subs, min_sz_region); - for (i = 0; i < nr_subs - 1 && - sz_region > 2 * min_sz_region; i++) { - /* - * Randomly select size of left sub-region to be at - * least 10 percent and at most 90% of original region - */ - sz_sub = ALIGN_DOWN(damon_rand(1, 10) * - sz_region / 10, min_sz_region); - /* Do not allow blank region */ - if (sz_sub == 0 || sz_sub >= sz_region) - continue; + if (sz_sub < min_sz_region) + continue; - damon_split_region_at(t, r, sz_sub); - sz_region = sz_sub; - } + for (i = 1; i < nr_subs; i++) + damon_split_region_at(t, r, sz_region - sz_sub * i); } } -- 2.43.0