From patchwork Thu Sep 7 02:29:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13376103 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 75FD0EE14D3 for ; Thu, 7 Sep 2023 02:30:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3262F28002F; Wed, 6 Sep 2023 22:29:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2AB7528002E; Wed, 6 Sep 2023 22:29:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14CA328002F; Wed, 6 Sep 2023 22:29:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id ECBE5280029 for ; Wed, 6 Sep 2023 22:29:46 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C761E1A0F66 for ; Thu, 7 Sep 2023 02:29:46 +0000 (UTC) X-FDA: 81208220772.08.CACFEFD Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id 2DB7BC0008 for ; Thu, 7 Sep 2023 02:29:44 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qlP28eTv; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694053785; a=rsa-sha256; cv=none; b=LFzDHAEGPs+mujtFDYVI4zlrPuF/lQ7BXmT6KPuc6ZVQ7MXcdEpGBe/g6OjMmy00kE1ifY QRH1ZoUh1j3ydyhr2u2jZ068L+vThWyTtAb02kKAwcvQWFKbCyxuxMsAx6m5KF91RduuD7 n/MPzFd2rX4dfieKSPVk2JS3EOOESSM= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qlP28eTv; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 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=1694053785; 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:in-reply-to:references:references:dkim-signature; bh=FqnAu9TiPE+mMxqOi7wi9wxvJKRcL57L5dZRyRQMI4g=; b=VTmn2C7mqJ/+FW+OA9RnjIZJDSwOn4xnjdHFJzy1bzqbvj9U9DQScgWR912FhCvIdR4TNF 4J7cTjT4AKl8Kx9knX32PXUiHCEIcEgjMozh8YCQHtu931cHzbX6Tg+iPAMA41M20CwokS xMoyI6tV9xl/DnfB9C7lR6WEgtoIxTg= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 79B31611E7; Thu, 7 Sep 2023 02:29:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86713C433CB; Thu, 7 Sep 2023 02:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694053783; bh=vRYmypXxVu4qyBFRsVgWGOXy10baQDAbK4q5Co5NXh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qlP28eTvxlZIfTv787ShyqGqsODexay16ibiTx1Diaxx+5FsRbtNpcWuURBIEOMiI MVGKGITV1obC+0nnb1wK5BP+LzyRRcd22VUneG4Do06WAlT3yR5Cd4F5A9REjPyqBs 37dj2ZaxtE7cCscAaXS3ulztigwpy2rxfNIB/MP1lbmzWgDIRBSYzFZ5uX3duR5pRS 34mSNwMpDpPDvZaq1aJb+hbu3YNtVwi4x9LJOwcXDyF89pA615ep4hmc4QbMa62sh/ HR+4gHtb2WSAAsdQ53ZSq8MRmZsVIpt6LNlSWFJHAhzOnHHSDJPv6qce6YRagf/g2j OkLTbEuTqmVSA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/11] mm/damon/core: add more comments for nr_accesses Date: Thu, 7 Sep 2023 02:29:27 +0000 Message-Id: <20230907022929.91361-10-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230907022929.91361-1-sj@kernel.org> References: <20230907022929.91361-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 2DB7BC0008 X-Stat-Signature: 49fzwdp6db7czqrx93ttotpn48wgrwir X-HE-Tag: 1694053784-527587 X-HE-Meta: U2FsdGVkX18rdMTGLIoY6GjGDfbm7VahSKHq1LIQcCyrwtt6uTvTot6R/9H5wfqPrHfrm1TAuOMsG2hkYZsvTh6a5NJUI2UPSs5q4kPxLo/fAlHD1x1cDdOXQe0M5X03YDBl8ntVRALwXo8PEjyXQv0rwCS0TrVLE00TM8hdK/YzeqDF7hJNgpY/e4o9F2/+vnHgGRlzbnuXWOwlGZ2euBrkHGQ0GsqmrKF8e6UmzQc75pGcwZAIvfh5tyJaFB/xepYTZZ7X0jajwXu6XP13dCQKyIw8PCUJUHOHoJZlMNCb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ngl0/CB 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: The comment on struct damon_region about nr_accesses field looks not sufficient. Many people actually used to ask what nr_accesses mean. There is more detailed explanation of the mechanism on the comment for struct damon_attrs, but it is also ambiguous, as it doesn't specify the name of the counter for aggregating the access check results. Make those more detailed. Signed-off-by: SeongJae Park --- include/linux/damon.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index ae2664d1d5f1..266f92b34dd2 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -43,6 +43,10 @@ struct damon_addr_range { * @list: List head for siblings. * @age: Age of this region. * + * @nr_accesses is reset to zero for every &damon_attrs->aggr_interval and be + * increased for every &damon_attrs->sample_interval if an access to the region + * during the last sampling interval is found. + * * @age is initially zero, increased for each aggregation interval, and reset * to zero again if the access frequency is significantly changed. If two * regions are merged into a new region, both @nr_accesses and @age of the new @@ -472,13 +476,14 @@ struct damon_callback { * regions. * * For each @sample_interval, DAMON checks whether each region is accessed or - * not. It aggregates and keeps the access information (number of accesses to - * each region) for @aggr_interval time. DAMON also checks whether the target - * memory regions need update (e.g., by ``mmap()`` calls from the application, - * in case of virtual memory monitoring) and applies the changes for each - * @ops_update_interval. All time intervals are in micro-seconds. - * Please refer to &struct damon_operations and &struct damon_callback for more - * detail. + * not during the last @sample_interval. If such access is found, DAMON + * aggregates the information by increasing &damon_region->nr_accesses for + * @aggr_interval time. For each @aggr_interval, the count is reset. DAMON + * also checks whether the target memory regions need update (e.g., by + * ``mmap()`` calls from the application, in case of virtual memory monitoring) + * and applies the changes for each @ops_update_interval. All time intervals + * are in micro-seconds. Please refer to &struct damon_operations and &struct + * damon_callback for more detail. */ struct damon_attrs { unsigned long sample_interval;