From patchwork Sat Sep 9 03:37:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 137859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp1542836vqo; Sun, 10 Sep 2023 04:32:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhYdg7hHNopsY8FvkGs0SrM+Wz8MaKHbu3iQQ8l5lE9FE2WAfyG3H61i5FLk1JJPTp0QO6 X-Received: by 2002:a2e:95c4:0:b0:2bc:ed75:1ba with SMTP id y4-20020a2e95c4000000b002bced7501bamr5551736ljh.16.1694345525941; Sun, 10 Sep 2023 04:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694345525; cv=none; d=google.com; s=arc-20160816; b=nK/l6A2Zl+W6f+If0iHzLW7Smddo017JPO4QDCG1xF0NTDHPGUP0om/chEu67XXEwm rGAXl9m68wWDxe0qyXg1cByn98XK75BlKCMygJQtelOjC4re7B57jyLdM38qRXmY6Y1k /z6TJisY+UHKHXLWjSbhke7aUCqjYr0ccRH2FBhxJFmB2VWOSW9c2eDsXlOX22GxepK/ Z82rRRwbb/e42lpmG00YK0Y1jQAGQXq7DyNbfDo5QkLDuQO8GK8YD7DMDi/jZ4vdWgFw XpyBRk3f173e48qkyyqYX84XEnZ38LEt3ohm4Ezm6GMvOqJO2t17J9Rkkf4OkvSW5/2C k2tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=xlq3E3DVQjLA3U4TLTkT3nYNLUiEsTpudJTXACXcv8w=; fh=vqNpWvtrgKyqgLywmXrl7l1d0QUXOIwW93A3X4awQbI=; b=IZ06hGXp4H5d9wWRTCggoYMkfgQvRWF6e+HWxBlAl29E3xaAxgSfcsYaxtJkFuO40A leZGhSKFPBWxLAaYOI35/H56ON4/0GyixncfToqRVBxioE/yfqp9XDpv7sRGBUN2Vn2b 9A9ytMtZdQz93e56/7LbH0soahOwTXW+2sjy1Q7cvZMDMEbOZ49NcP8VdyFGhF2K3yVs 8WDhHgs17MhCdLTsHwKkYO7aLRpLvfGR5hw7eNAYlSoZiEjdpmf0WRl3itwLPacouq+6 bO/J5PDNPWzEwpPsPApphkhudfJWRld168x2Do4XAtyYV8fnFFcBNZo5Wh+rv/TWQ9/E qMug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=G4g9Ika5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m21-20020a1709060d9500b009a9f00bdf87si4910557eji.775.2023.09.10.04.32.02; Sun, 10 Sep 2023 04:32:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=G4g9Ika5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239284AbjIIDha (ORCPT + 11 others); Fri, 8 Sep 2023 23:37:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237769AbjIIDh3 (ORCPT ); Fri, 8 Sep 2023 23:37:29 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1927E1FE9 for ; Fri, 8 Sep 2023 20:37:25 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55D1CC433C9; Sat, 9 Sep 2023 03:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694230644; bh=CWWNXIT/Dwd1+BhRyAHtcclmBn8xtMZ9uwzWWOesbz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G4g9Ika5VasJRZpdNkehsQGg8kmNgm1qwLM5nZc1OQ3bp6R4DT1lFH3+zQDyEhyuv mefns1GVzCJtq+OvVa44z8SXvojBkwZ34RpBCIV1f5cCrtu/W7gTjDfqjXKyttEonk /4N1vy0njVJ9mulokK5u9jis8z2OUzLntqRp8t07GX2o24Kwfc2nr74r5yzPoYtRRp XHMGOcsoRuAex+MbtNun2Ggn/Y+i1aTbNVuNSbMvQjpAERbfaphUfeGRNyJ6Yd1iAj OuFS/cHAejFEM+RrL/gstTaIoFQXWfmO+6ELklli6wCU9/VV+c6IGRUfZJGWdtfprd faNCXU0uVKbnA== From: SeongJae Park Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC 1/8] mm/damon/core: define and use a dedicated function for region access rate update Date: Sat, 9 Sep 2023 03:37:04 +0000 Message-Id: <20230909033711.55794-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230909033711.55794-1-sj@kernel.org> References: <20230909033711.55794-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776650054156799887 X-GMAIL-MSGID: 1776650054156799887 Each DAMON operarions set is updating nr_accesses field of each damon_region for each of their access check results, from the check_accesses() callback. Directly accessing the field could make things complex to manage and change in future. Define and use a dedicated function for the purpose. Signed-off-by: SeongJae Park --- include/linux/damon.h | 5 ++++- mm/damon/core.c | 16 ++++++++++++++++ mm/damon/paddr.c | 6 ++---- mm/damon/vaddr.c | 6 ++---- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 9a32b8fd0bd3..17c504d236b9 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -45,7 +45,9 @@ struct damon_addr_range { * * @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. + * during the last sampling interval is found. The update of this field should + * not be done with direct access but with the helper function, + * damon_update_region_access_rate(). * * @age is initially zero, increased for each aggregation interval, and reset * to zero again if the access frequency is significantly changed. If two @@ -620,6 +622,7 @@ void damon_add_region(struct damon_region *r, struct damon_target *t); void damon_destroy_region(struct damon_region *r, struct damon_target *t); int damon_set_regions(struct damon_target *t, struct damon_addr_range *ranges, unsigned int nr_ranges); +void damon_update_region_access_rate(struct damon_region *r, bool accessed); struct damos_filter *damos_new_filter(enum damos_filter_type type, bool matching); diff --git a/mm/damon/core.c b/mm/damon/core.c index 6f37997afc54..3d51a1dfe104 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1589,6 +1589,22 @@ int damon_set_region_biggest_system_ram_default(struct damon_target *t, return damon_set_regions(t, &addr_range, 1); } +/** + * damon_update_region_access_rate() - Update the access rate of a region. + * @r: The DAMON region to update for its access check result. + * @accessed: Whether the region has accessed during last sampling interval. + * + * Update the access rate of a region with the region's last sampling interval + * access check result. + * + * Usually this will be called by &damon_operations->check_accesses callback. + */ +void damon_update_region_access_rate(struct damon_region *r, bool accessed) +{ + if (accessed) + r->nr_accesses++; +} + static int __init damon_init(void) { damon_region_cache = KMEM_CACHE(damon_region, 0); diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 909db25efb35..44f21860b555 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -157,14 +157,12 @@ static void __damon_pa_check_access(struct damon_region *r) /* If the region is in the last checked page, reuse the result */ if (ALIGN_DOWN(last_addr, last_folio_sz) == ALIGN_DOWN(r->sampling_addr, last_folio_sz)) { - if (last_accessed) - r->nr_accesses++; + damon_update_region_access_rate(r, last_accessed); return; } last_accessed = damon_pa_young(r->sampling_addr, &last_folio_sz); - if (last_accessed) - r->nr_accesses++; + damon_update_region_access_rate(r, last_accessed); last_addr = r->sampling_addr; } diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c index 4c81a9dbd044..7fc0bda73b4c 100644 --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -566,14 +566,12 @@ static void __damon_va_check_access(struct mm_struct *mm, /* If the region is in the last checked page, reuse the result */ if (same_target && (ALIGN_DOWN(last_addr, last_folio_sz) == ALIGN_DOWN(r->sampling_addr, last_folio_sz))) { - if (last_accessed) - r->nr_accesses++; + damon_update_region_access_rate(r, last_accessed); return; } last_accessed = damon_va_young(mm, r->sampling_addr, &last_folio_sz); - if (last_accessed) - r->nr_accesses++; + damon_update_region_access_rate(r, last_accessed); last_addr = r->sampling_addr; } From patchwork Sat Sep 9 03:37:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 137841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp1315472vqo; Sat, 9 Sep 2023 14:28:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG5dSsoZ5X9gXPzZ1IeLc30DL2Gza8ugFJMm6xX9lHz/adD8VvJhK06WKf3i9hpQDVIoK5E X-Received: by 2002:a05:620a:2996:b0:76d:b7fe:6b2e with SMTP id r22-20020a05620a299600b0076db7fe6b2emr7381289qkp.29.1694294895493; Sat, 09 Sep 2023 14:28:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694294895; cv=none; d=google.com; s=arc-20160816; b=vN71h3tmKEv3GIlVGNFVx0xd26FZOttcgnNeBTZFUtapE3f3OM0EBe+f5Wa14Z+yRN QHjqAkvlq9gAg76Ac+f8sGIVZfoL6rYIIAtIWGAebBUoSB3w771LX3wv3telwomJwC0y 2k6246HVFdMlwnRGRZMCJ6NKjBRQqPwAT+o0p+Vr+DmWMgmx9MKAZdARZQGRIhSvXxNW uBAGK+6ggh7oaP/fcsuCN33j/J5shc7oKQYcSX3iSZP1DWUtkWx58BYN/La8TeOr0v3q XMSZceYTbD9YBfheAhtejGraUrQ6bq06Rftepm3AO70tw45qTH1wqUk/9ZyqcpKNu7qn yJsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=ah0N2wcnfsJahuzxk5G28ObKAJFHz+yeGpKpeyogRrc=; fh=vqNpWvtrgKyqgLywmXrl7l1d0QUXOIwW93A3X4awQbI=; b=qrCQCBGXDivR6lQwgKEziy3Xp106/3W9ykEDyCTp9anNSloGvHSJj6rHog/QDxmiaX MzQ0vje+jdDJOsSPBilrMD15dXNgf+LfwPSOH44vXn9hQcmBBuYUaLamEqJxamNHwigd oCW/131QVjs7oO2duldyE7hXWuU2/ERHtKLXy94T38hMpMltQkqGmrzSpiJk/tDUYV+s xrX9tZ9GP1GTBXzMJpm4d/t7hWDKbe/FlJ0pNyeSN2RpUTkMzsq+AORcbFmM7iAlEoIt qxKn5Q0bBZGjexjmQgUjHjEfZdlZ0t0Dka+PDKZwAQpbrvzfjVxtML+HvooDcxymTUB5 jx9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=rusog3te; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay30-20020a056a00301e00b0067bc790ce11si3755983pfb.161.2023.09.09.14.28.13; Sat, 09 Sep 2023 14:28:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=rusog3te; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241196AbjIIDhe (ORCPT + 11 others); Fri, 8 Sep 2023 23:37:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236207AbjIIDha (ORCPT ); Fri, 8 Sep 2023 23:37:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 482BC1FE3 for ; Fri, 8 Sep 2023 20:37:26 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8618BC433CD; Sat, 9 Sep 2023 03:37:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694230645; bh=1JPnDKE1W//tJKT6oD5avrUOMToQr068Qq2WbN1Xk+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rusog3teG9hcnEOtFyrYq2Kl4tI6tcDkZHp8n1Y4H16VjWB/4DsOGZfuLTLsJm8nS /KC1kgaBiz/iwm9Mr+LOZkYK+jSgGPPIWvD+2zxifQDAR46fduvL1wLbxmfj2msgTQ pN/SHQdgeA2UmefHF2RbIODyciN8YusgRbTKifrDqmCndCNyUO66LeDAEmPihhRw9T 837t6pOuHXZ4rYjplr0cE5XHFi7BnwTZs4HC4CQl6RKBSfh3FuScz6o/+wAcle06Xz YZ1V1VZ2DLJma6bJ/qucOOstW6arYNziXh8dDPJl00i1FKQEKo70rgEhWHM1nRFZpX tjCjSSs1RtP5w== From: SeongJae Park Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC 3/8] mm/damon/core: implement a pseudo-moving sum function Date: Sat, 9 Sep 2023 03:37:06 +0000 Message-Id: <20230909033711.55794-4-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230909033711.55794-1-sj@kernel.org> References: <20230909033711.55794-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776596964249237272 X-GMAIL-MSGID: 1776596964249237272 For values that continuously change, moving average or sum are good ways to provide fast updates while handling temporal and errorneous variability of the value. For example, the access rate counter (nr_accesses) is calculated as a sum of the number of positive sampled access check results that collected during a discrete time window (aggregation interval), and hence it handles temporal and errorneous access check results, but provides the update only for every aggregation interval. Using a moving sum method for that could allow providing the value for every sampling interval. That could be useful for getting monitoring results snapshot or running DAMOS in fine-grained timing. However, supporting the moving sum for cases that number of samples in the time window is arbirary could impose high overhead, since the number of past values that it needs to keep could be too high. The nr_accesses would also be one of the cases. To mitigate the overhead, implement a pseudo-moving sum function that only provides an estimated pseudo-moving sum. It assumes there was no error in last discrete time window and subtract constant portion of last discrete time window sum. Note that the function is not strictly implementing the moving sum, but it keeps a property of moving sum, which makes the value same to the dsicrete-window based sum for each time window-aligned timing. Hence, people collecting the value in the old timings would show no difference. Signed-off-by: SeongJae Park --- include/linux/damon.h | 2 ++ mm/damon/core.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index 17c504d236b9..487a545a11b4 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -622,6 +622,8 @@ void damon_add_region(struct damon_region *r, struct damon_target *t); void damon_destroy_region(struct damon_region *r, struct damon_target *t); int damon_set_regions(struct damon_target *t, struct damon_addr_range *ranges, unsigned int nr_ranges); +unsigned int damon_moving_sum(unsigned int mvsum, unsigned int nomvsum, + unsigned int len_window, unsigned int new_value); void damon_update_region_access_rate(struct damon_region *r, bool accessed); struct damos_filter *damos_new_filter(enum damos_filter_type type, diff --git a/mm/damon/core.c b/mm/damon/core.c index 3d51a1dfe104..5bc0544b9f50 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1589,6 +1589,46 @@ int damon_set_region_biggest_system_ram_default(struct damon_target *t, return damon_set_regions(t, &addr_range, 1); } +/* + * damon_moving_sum() - Calculate an inferred moving sum value. + * @mvsum: Inferred sum of the last @len_window values. + * @nomvsum: Non-moving sum of the last discrete @len_window window values. + * @len_window: The number of last values to take care of. + * @new_value: New value that will be added to the pseudo moving sum. + * + * Moving sum (moving average * window size) is good for handling noise, but + * the cost of keeping past values can be high for arbitrary window size. This + * function implements a lightweight pseudo moving sum function that doesn't + * keep the past window values. + * + * It simply assumes there was no noise in the past, and get the no-noise + * assumed past value to drop from @nomvsum and @len_window. @nomvsum is a + * non-moving sum of the last window. For example, if @len_window is 10 and we + * have 25 values, @nomvsum is the sum of the 11th to 20th values of the 25 + * values. Hence, this function simply drops @nomvsum / @len_window from + * given @mvsum and add @new_value. + * + * For example, if @len_window is 10 and @nomvsum is 50, the last 10 values for + * the last window could be vary, e.g., 0, 10, 0, 10, 0, 10, 0, 0, 0, 20. For + * calculating next moving sum with a new value, we should drop 0 from 50 and + * add the new value. However, this function assumes it got value 5 for each + * of the last ten times. Based on the assumption, when the next value is + * measured, it drops the assumed past value, 5 from the current sum, and add + * the new value to get the updated pseduo-moving average. + * + * This means the value could have errors, but the errors will be disappeared + * for every @len_window aligned calls. For example, if @len_window is 10, the + * pseudo moving sum with 11th value to 19th value would have an error. But + * the sum with 20th value will not have the error. + * + * Return: Pseudo-moving average after getting the @new_value. + */ +unsigned int damon_moving_sum(unsigned int mvsum, unsigned int nomvsum, + unsigned int len_window, unsigned int new_value) +{ + return mvsum - nomvsum / len_window + new_value; +} + /** * damon_update_region_access_rate() - Update the access rate of a region. * @r: The DAMON region to update for its access check result. From patchwork Sat Sep 9 03:37:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 137860 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ab0a:0:b0:3f2:4152:657d with SMTP id m10csp1597436vqo; Sun, 10 Sep 2023 06:51:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZ+XOjLKxnNAUkENcqjAibO6GNYe6IoNPiXsggLIywHdxrBTmEISsbWg2MVsvKBUARNOfr X-Received: by 2002:a17:906:300f:b0:9a5:9305:8402 with SMTP id 15-20020a170906300f00b009a593058402mr7066318ejz.51.1694353888464; Sun, 10 Sep 2023 06:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694353888; cv=none; d=google.com; s=arc-20160816; b=zd5yJaXVPMMbwKgV3oZUXhc8UrC2DUPYfn8zwgrYF7g7XGyz31sBbV0qGbLlSyYQvI CAetZcqwrr0bblc/hql2tQrVr3qWkvT8J7jjWZlA+g96KgWpJwUtehjnqKp+X7aRlyf/ /pdHkkzybpBkAX+YnyPZkewNQ+P4i0nlk3qSNWoVScOLJ6rZnZSQoOO4b3mDBLOfERQj Yct6Fic62xLl7CCifYCFUuxai2IgzhtBXFGZPAZYrz1NC9K/0c9fxqny8fH+7kX0SMSl IVjlnAHp18higAUlqIlimLUa2ny5D31jlBK/geY97NmFB7TDnRa2KLxaJtHQ++Y7hALJ TVCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=I15fcCiftstjDJhtda4bP9yIA9qbFxpP8S+UhQRu3rE=; fh=vqNpWvtrgKyqgLywmXrl7l1d0QUXOIwW93A3X4awQbI=; b=mIhC2FD04kfW7JBDMzlZYJStbVLv2hl4iHFTDHMq1GlLV/ZEIoZO0yh1SWd11ToX8u r4CH8SjRV7HnP3ioa7MnYq8xbpKb6Fnremn52LWBv/UZmL6/JzJDcczNZd1Kbxm8iDUW FNptxbvtZAeZ3x9I/NROVFmp+/sQ8oma4uEr3hcAJSUs99w6/00hWns6LcfXyJP9CO1W V23ZDqwPZ8kj4oxvAG16E/pWA3AcQo18aZm1PoneDg6Q2NnU3i+UTYix9zSYtEUfJN8a VMwGMUdHNFXQxfhs3V/PmnfJ2iSHYeGv8AEdsnoFoBh1oaY1giWlxTx5TcjYaj4iBdSd z+Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=Izsy8M9g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u1-20020a1709064ac100b0099e04cdb98dsi5127446ejt.310.2023.09.10.06.51.24; Sun, 10 Sep 2023 06:51:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=Izsy8M9g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244692AbjIIDhq (ORCPT + 11 others); Fri, 8 Sep 2023 23:37:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240919AbjIIDhd (ORCPT ); Fri, 8 Sep 2023 23:37:33 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 314591FEA for ; Fri, 8 Sep 2023 20:37:29 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A803BC433CD; Sat, 9 Sep 2023 03:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694230649; bh=u4g+CGjCZbG2QHJKasID6b5E2s2G6qeOdsap6ruSGmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Izsy8M9gmHRZoYcw3BIdjHqk4Bh4D39q8DOc/nlB1dcLYYvpMQGZxHev79ESz2uns WEu/9IXL70k9mccElhHgYBm8RqMZJk6rScKpW7vnlzL/IY3fsrVG5lAuul/mz7MdGn UJrGFRmo4XD9g1Q33/kCg0C+GCVOWZwGsjdlE5Q+MBBRu8xG/fnutSXgquG1SjGdnp b+iZW54q/5eZ9jpWecrLxzyz4UXNo3+AXEljpMjsI66zhNXb+aGUk22Q2BQx6qJJ/3 jT/ulxnTRocN/Vg5EAkvTeirS7OtTYYuLlQwTDc/RZrHcbr/aRpVaxBD2hrKfcwSJu Fp0dVQBatu+iw== From: SeongJae Park Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC 8/8] mm/damon/core: mark damon_moving_sum() as a static function Date: Sat, 9 Sep 2023 03:37:11 +0000 Message-Id: <20230909033711.55794-9-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230909033711.55794-1-sj@kernel.org> References: <20230909033711.55794-1-sj@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776658822912526152 X-GMAIL-MSGID: 1776658822912526152 The function is used by only mm/damon/core.c. Mark it as a static function. Signed-off-by: SeongJae Park --- include/linux/damon.h | 2 -- mm/damon/core.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 0fe13482df63..491fdd3e4c76 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -632,8 +632,6 @@ void damon_add_region(struct damon_region *r, struct damon_target *t); void damon_destroy_region(struct damon_region *r, struct damon_target *t); int damon_set_regions(struct damon_target *t, struct damon_addr_range *ranges, unsigned int nr_ranges); -unsigned int damon_moving_sum(unsigned int mvsum, unsigned int nomvsum, - unsigned int len_window, unsigned int new_value); void damon_update_region_access_rate(struct damon_region *r, bool accessed, struct damon_attrs *attrs); diff --git a/mm/damon/core.c b/mm/damon/core.c index 1ba7c4669263..83b0cd329e84 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1627,7 +1627,7 @@ int damon_set_region_biggest_system_ram_default(struct damon_target *t, * * Return: Pseudo-moving average after getting the @new_value. */ -unsigned int damon_moving_sum(unsigned int mvsum, unsigned int nomvsum, +static unsigned int damon_moving_sum(unsigned int mvsum, unsigned int nomvsum, unsigned int len_window, unsigned int new_value) { return mvsum - nomvsum / len_window + new_value;