From mboxrd@z Thu Jan 1 00:00:00 1970 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 63800C433F5 for ; Fri, 14 Jan 2022 22:10:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA6426B018F; Fri, 14 Jan 2022 17:10:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E55A06B0191; Fri, 14 Jan 2022 17:10:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1E4E6B0192; Fri, 14 Jan 2022 17:10:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id C04276B018F for ; Fri, 14 Jan 2022 17:10:25 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8449F998C6 for ; Fri, 14 Jan 2022 22:10:25 +0000 (UTC) X-FDA: 79030287210.22.816AC7A Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf10.hostedemail.com (Postfix) with ESMTP id E5146C0006 for ; Fri, 14 Jan 2022 22:10:24 +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 sin.source.kernel.org (Postfix) with ESMTPS id B8D58CE2497; Fri, 14 Jan 2022 22:10:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A0B9C36AE9; Fri, 14 Jan 2022 22:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1642198221; bh=CVm+MwUZ4sjp+DltbKcOTE15F9vbCL+4dpAHq0TNcEk=; h=Date:From:To:Subject:In-Reply-To:From; b=t+JaDgjN4UbDdpbSbe9Kh4GrlJBfkEUUOPabyr6CvTBL+DF4PN5pe/tV5lStwXa18 32IzEVjkaY3YTwUUuAlW2lp6cwYG970sDu9lVJQh/Cy7td9PEciOoUNvOiLup6M6P7 3+UvW1SUi1k1VXlp9yCNwesmKCSG8zGgDV6tY6as= Date: Fri, 14 Jan 2022 14:10:20 -0800 From: Andrew Morton To: akpm@linux-foundation.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, sj@kernel.org, torvalds@linux-foundation.org Subject: [patch 136/146] mm/damon/schemes: account how many times quota limit has exceeded Message-ID: <20220114221020.IMbqpzsPF%akpm@linux-foundation.org> In-Reply-To: <20220114140222.6b14f0061194d3200000c52d@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: E5146C0006 X-Stat-Signature: icfyaa1c5j7moo1q58j15h598aioin5d Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=t+JaDgjN; dmarc=none; spf=pass (imf10.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1642198224-856081 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: From: SeongJae Park Subject: mm/damon/schemes: account how many times quota limit has exceeded 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. Link: https://lkml.kernel.org/r/20211210150016.35349-3-sj@kernel.org Signed-off-by: SeongJae Park Signed-off-by: Andrew Morton --- include/linux/damon.h | 2 ++ mm/damon/core.c | 2 ++ 2 files changed, 4 insertions(+) --- a/include/linux/damon.h~mm-damon-schemes-account-how-many-times-quota-limit-has-exceeded +++ a/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; }; /** --- a/mm/damon/core.c~mm-damon-schemes-account-how-many-times-quota-limit-has-exceeded +++ a/mm/damon/core.c @@ -693,6 +693,8 @@ static void kdamond_apply_schemes(struct 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; _