From patchwork Wed Feb 16 08:30:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: haoxin X-Patchwork-Id: 12748181 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 6316AC433EF for ; Wed, 16 Feb 2022 08:30:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 22D2D6B0071; Wed, 16 Feb 2022 03:30:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 11F916B0078; Wed, 16 Feb 2022 03:30:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3AE16B0073; Wed, 16 Feb 2022 03:30:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id C264D6B0078 for ; Wed, 16 Feb 2022 03:30:49 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6FC0E93688 for ; Wed, 16 Feb 2022 08:30:49 +0000 (UTC) X-FDA: 79147972218.19.327DAF4 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by imf14.hostedemail.com (Postfix) with ESMTP id 8D7EC100004 for ; Wed, 16 Feb 2022 08:30:48 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=xhao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0V4cXjyS_1645000244; Received: from localhost.localdomain(mailfrom:xhao@linux.alibaba.com fp:SMTPD_---0V4cXjyS_1645000244) by smtp.aliyun-inc.com(127.0.0.1); Wed, 16 Feb 2022 16:30:45 +0800 From: Xin Hao To: sj@kernel.org Cc: xhao@linux.alibaba.com, rongwei.wang@linux.alibaba.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH V1 1/5] mm/damon: Add NUMA local and remote variables in 'damon_region' Date: Wed, 16 Feb 2022 16:30:37 +0800 Message-Id: <2fb03665b39d7e3b222955ff690d73fe8e201c24.1645024354.git.xhao@linux.alibaba.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: 6ic9sazrcn7qb8za1r4khifgk5tfq66w X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 8D7EC100004 Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf14.hostedemail.com: domain of xhao@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=xhao@linux.alibaba.com X-Rspam-User: X-HE-Tag: 1645000248-16962 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000701, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The purpose of adding these two variables 'local' & 'remote' is to obtain the struct 'damon_region' numa access status. Signed-off-by: Xin Hao Signed-off-by: Rongwei Wang --- include/linux/damon.h | 4 ++++ mm/damon/core.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index 5e1e3a128b77..77d0937dcab5 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -41,6 +41,8 @@ struct damon_addr_range { * @nr_accesses: Access frequency of this region. * @list: List head for siblings. * @age: Age of this region. + * @local: Local numa node accesses. + * @remote: Remote numa node accesses. * * @age is initially zero, increased for each aggregation interval, and reset * to zero again if the access frequency is significantly changed. If two @@ -56,6 +58,8 @@ struct damon_region { unsigned int age; /* private: Internal value for age calculation. */ unsigned int last_nr_accesses; + unsigned long local; + unsigned long remote; }; /** diff --git a/mm/damon/core.c b/mm/damon/core.c index 1dd153c31c9e..933ef51afa71 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -45,6 +45,8 @@ struct damon_region *damon_new_region(unsigned long start, unsigned long end) region->age = 0; region->last_nr_accesses = 0; + region->local = 0; + region->remote = 0; return region; } @@ -740,6 +742,8 @@ static void damon_merge_two_regions(struct damon_target *t, l->nr_accesses = (l->nr_accesses * sz_l + r->nr_accesses * sz_r) / (sz_l + sz_r); + l->remote = (l->remote * sz_l + r->remote * sz_r) / (sz_l + sz_r); + l->local = (l->local * sz_l + r->local * sz_r) / (sz_l + sz_r); l->age = (l->age * sz_l + r->age * sz_r) / (sz_l + sz_r); l->ar.end = r->ar.end; damon_destroy_region(r, t); @@ -812,6 +816,8 @@ static void damon_split_region_at(struct damon_ctx *ctx, new->age = r->age; new->last_nr_accesses = r->last_nr_accesses; + new->local = r->local; + new->remote = r->remote; damon_insert_region(new, r, damon_next_region(r), t); }