From patchwork Fri Dec 10 15:00:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12669737 Return-Path: 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 6A721C433F5 for ; Fri, 10 Dec 2021 15:03:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1D0236B0078; Fri, 10 Dec 2021 10:00:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 17EA06B007B; Fri, 10 Dec 2021 10:00:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06C8A6B007D; Fri, 10 Dec 2021 10:00:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id EB0976B0078 for ; Fri, 10 Dec 2021 10:00:48 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id AD3DD84A31 for ; Fri, 10 Dec 2021 15:00:38 +0000 (UTC) X-FDA: 78902196156.21.A066D43 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf18.hostedemail.com (Postfix) with ESMTP id D9C6A1C001D for ; Fri, 10 Dec 2021 15:00:34 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 037CBB82879; Fri, 10 Dec 2021 15:00:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67EBDC341CB; Fri, 10 Dec 2021 15:00:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639148433; bh=C2qhY6YuvnwZQD5xmb0IYoRaBXExlfMZfsAc2y0PKK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GS2hX3w+lE7fcNOTyVglTF42x31DoN0vkwRQHi/ApqVwPrSX4dH3AtiCW1Y+qxBFq whwKGmAqCR5tRbgNqpJyVlBgwDbWGgMnPgGv2tIUBjGNnYKRX136NFFlMgK7YB4q9Q 1P29htK6lydrJacuP456jlVJS5k81QGBKPRwI0gz6/tcAg+pmpAz505UHK7Yvx+56B AzpfpR2f4dto5zTiz0zxW/9VdNyJyeoR50QrPeZSGNymUO748vUPi5yP0MtBVaGJiL tdWKmdjm4202Ru4T1eqy9XSziG1x/EYQ9QnxkY8S7kI9pd6x2GfwmOfMrtsoUqL2PR g8gshGOpJwyWA== From: SeongJae Park To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 2/6] mm/damon/schemes: Account how many times quota limit has exceeded Date: Fri, 10 Dec 2021 15:00:12 +0000 Message-Id: <20211210150016.35349-3-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211210150016.35349-1-sj@kernel.org> References: <20211210150016.35349-1-sj@kernel.org> X-Stat-Signature: wp64noniex6qkuebs8nom4cx3xm745r1 Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GS2hX3w+; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: D9C6A1C001D X-HE-Tag: 1639148434-267018 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: If the time/space quotas of a given DAMON-based operation scheme is too small, the scheme could show unexpectedly slow progress. However, there is no good way to notice the case in runtime. This commit extends the DAMOS stat to provide how many times the quota limits exceeded so that the users can easily notice the case and tune the scheme. Signed-off-by: SeongJae Park --- include/linux/damon.h | 2 ++ mm/damon/core.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index e0ad3d9aaeed..af648388e759 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -198,12 +198,14 @@ struct damos_watermarks { * @sz_tried: Total size of regions that the scheme is tried to be applied. * @nr_applied: Total number of regions that the scheme is applied. * @sz_applied: Total size of regions that the scheme is applied. + * @qt_exceeds: Total number of times the quota of the scheme has exceeded. */ struct damos_stat { unsigned long nr_tried; unsigned long sz_tried; unsigned long nr_applied; unsigned long sz_applied; + unsigned long qt_exceeds; }; /** diff --git a/mm/damon/core.c b/mm/damon/core.c index 6d59047b8923..30d4b6e1a434 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -731,6 +731,8 @@ static void kdamond_apply_schemes(struct damon_ctx *c) if (time_after_eq(jiffies, quota->charged_from + msecs_to_jiffies( quota->reset_interval))) { + if (quota->esz && quota->charged_sz >= quota->esz) + s->stat.qt_exceeds++; quota->total_charged_sz += quota->charged_sz; quota->charged_from = jiffies; quota->charged_sz = 0;