Message ID | 20240627163153.75969-1-sj@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6840EC2BD09 for <linux-mm@archiver.kernel.org>; Thu, 27 Jun 2024 16:32:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CD1856B008C; Thu, 27 Jun 2024 12:32:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C81346B0092; Thu, 27 Jun 2024 12:32:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6F8F6B0095; Thu, 27 Jun 2024 12:32:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 98C1C6B008C for <linux-mm@kvack.org>; Thu, 27 Jun 2024 12:32:05 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1996F1406DD for <linux-mm@kvack.org>; Thu, 27 Jun 2024 16:32:05 +0000 (UTC) X-FDA: 82277210610.08.C213DA1 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf28.hostedemail.com (Postfix) with ESMTP id 30220C0023 for <linux-mm@kvack.org>; Thu, 27 Jun 2024 16:31:59 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CCfPgCWR; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719505901; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=oATHe394D0+Kr0C5wLUHsc1EBJyeX04I+umhZnaLzzg=; b=VjgaAIYSBWvUgLBd7rzEwHTfUlCM0YPPRBv+PXJnjiM0umBc1BXqjIEmd36nmjID9Fua9w VKJoMR27FRwXCqF40gkbnzMUbyfcrohOG7nktGK7JUlCUaHFpjjg3U9wdq6VB7edl9avll SaMA+mkIdBCwQuCKsDi69cSu3LsWwV4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719505901; a=rsa-sha256; cv=none; b=B70FkaexFE3RlgxrycJArG+oJjbJg5qWr/lvlU9oZcZFJCpVJzsM8EUMLsRTFFccDYfBl/ q/LHXVKK7VQpDCWw8Atip33ynH69LMeQffsG/2s0WZ7hwCY+3E8yRFbVv/9Kpa15cJRCvm rhSxMLUp1o2oWT9x5QwCcvPXZqqjtAs= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CCfPgCWR; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id B1CDECE0FFC; Thu, 27 Jun 2024 16:31:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B464C2BBFC; Thu, 27 Jun 2024 16:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719505916; bh=K7HK9pvJ3k/n+EBt+3nbqeH9P6nBJxh2AMU21utMS0M=; h=From:To:Cc:Subject:Date:From; b=CCfPgCWRg9G7mm//F0eKLYxF2rqm/LyFg20mnANA3CAlMbj25dA9JnxKn8pOrkJ4F M3r5ck+d5eZ03z7qwaZyd75hjxAdTnBqr+l11xl+HbdjCQPE/cpz6aBNh5vw74Mxqp wRUzXCKkXIXVtSNIYdrwpz786Eg7UUlDNc0s3eHTqe6WEAh/qnMHN87W6qJYUMFlpt DXSJr0h0dhmvgqVrskLZQ50Kn+D9gTYv7tNBMyTAjyD6Ne+kswu74QTkxa+AQuGEIH VYutq/mtj5ZGiIpXXK7rMsFU98Ti+3TBHORp7YEqNaNY2dJgLAaS3NRKFxJ885l8HE XD9pBRqBHHHGQ== From: SeongJae Park <sj@kernel.org> To: SeongJae Park <sj@kernel.org>, Andrew Morton <akpm@linux-foundation.org> Cc: damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH mm-unstable] mm/damon/core: ensure max threshold attempt for max_nr_regions violation Date: Thu, 27 Jun 2024 09:31:52 -0700 Message-Id: <20240627163153.75969-1-sj@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 30220C0023 X-Stat-Signature: btsioq9hkc4djgqd6cjkr78kfkc1pwjq X-Rspam-User: X-HE-Tag: 1719505919-509430 X-HE-Meta: U2FsdGVkX1+2SbogDpMLyjBNS4HhSnV//+AlFxcON9KOEv0WGtHXk6v++YDDdL4SEXXZSzMsaqwDlYBNVkDhH33xbbJVvBMK+FWTi0OMqs3RG2fZhqFxHrOcxj2fmglhb7qm6/ncoz2hyr6AGUMsVfBj/ox0tV2k0EE7eNiQKnrq5z0PwCI0V7uE6LyEO38LgPZKn/md9yGgGs08ZrZ8Mydjsc44ATF5aSm5qIOOWbsfSoU2R282TmLt6xKLAQYWYxUpXyEiMiTg5mwfB19g+PsJNZGWO1tlEIQ+Qb5DeRs73JKDRBnFtl66Je1dlfFB+O5ytlLCMq2EQpg3os29SFIE0qHD1Qof06TpF633XHpm4z4y+wdxHaU0NDRXMboNdPv5dgTJV9VURnT5+w4DIoIr5JUfO1269A+/ro2bs8NeFkTwrJhTME28QgVsdJYbxAyv8IzCMAhT+7mjTpSy7yX8DMF3dk0zW1vlV82RkK0xMv2d+AIo2gR/m0s4Bz7K+Q6mgKuJJiLUMOVbSyGdGVTx5YLY3zoa1QwvA+hN7MdMVBXIlUYmRxevM7D/et0pttj6mu/v8ofGD46Cy8NhfOZPE2E74ZuItcTyAduApZqgCZ98yyOsgDkNZnGjj/QkYwbbt6hX6mP4EB4ZPapNTjPEGfnwqC6iTZkiLPkoHPhtHkjlG02VkPGf78+85S3mwFBwfaDvSHi09MJxXEQmUL0iEIjljzPC8OOYBmUeRfPOQ76IFpuOgOtme5htoRwTcL9sQ/GC2KhJEjN8G/AfORBWS7foCc8ce5mWSIhwlI/RxVKh7P+i/aQUYLHQIHSciL48lcLV3JvZgo9h4jbg4xfMfRI2KqU93b2QLKYvzYWxjnWvtjA4UjFcNp62cI1ol2hCVXb1Um/1hAw1xEnD9wuVRddH52BG87Ij0XoyKSYi5cRF+v1nsL3TSos3JVhUHwH0jvZacA8WatzY9ts 6/mfAwvL JzzFiKXPGi/3wHufkxcdosnvhuKakiM20f8WsKrNDYTYv/VN1olKv2J6Z4LYt7gYoeKNZtrBOfY919nXUFvl/FrLoT0sICu8spQtP4V6HhxB1zJVW/8ILte1QpqA/SfTef3sxQjN+ejsS9cDgwKDA1MAfxdISsMkC/Rh0qLxRnFY9B2SOM1olEKPQg+X05x8Xxe96FxzdKzs5CsPCagGLLKlwzY69KpbMhOdwPNJYh/zNkv1wGvW77UgMTc6ujr0V6kCtkicfIcxan2aNoOBLpPss8Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
[mm-unstable] mm/damon/core: ensure max threshold attempt for max_nr_regions violation
|
expand
|
diff --git a/mm/damon/core.c b/mm/damon/core.c index dac27b949403..7a87628b76ab 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1718,7 +1718,7 @@ static void kdamond_merge_regions(struct damon_ctx *c, unsigned int threshold, } threshold = max(1, threshold * 2); } while (nr_regions > c->attrs.max_nr_regions && - threshold <= max_thres); + threshold / 2 < max_thres); } /*
Since commit ed6cb9d022c8 ("mm/damon/core: increase regions merge aggressiveness while respecting min_nr_regions") of mm-unstable, kdamond_merge_regions() stops the repeated merge attempts for meeting max_nr_regions if the merge threshold that increased for next iteration is higher than the possible maximum threshold. Hence, it can skip a merge attempt with the maximum threshold depending on the amount of the threshold increase, the maximum threshold, and the last-used threshold value. In extreme situations (e.g., region 1 has 100% access frequency, region 2 has 0% access frequency, so on), this can degrade the max_nr_regions violation recovery. Fix this by stopping the loop by comparing the last-used threshold instead of the to-be-used threshold, and if the last-used threshold is same to or higher than the maximum possible threshold. Fixes: ed6cb9d022c8 ("mm/damon/core: increase regions merge aggressiveness while respecting min_nr_regions") # mm-unstable Closes: https://lore.kernel.org/20240626214954.46143-1-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> --- mm/damon/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)