Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp636439pxb; Wed, 16 Feb 2022 00:33:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrCCg8QFZeypp/LskYLYWCbixKQi8YQb/wLSvV1FlMy7tR5YQGBTDc1ZJ1QVvbLW8qlVxP X-Received: by 2002:a17:90b:1bc2:b0:1b2:eaa7:b718 with SMTP id oa2-20020a17090b1bc200b001b2eaa7b718mr493924pjb.115.1645000418554; Wed, 16 Feb 2022 00:33:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645000418; cv=none; d=google.com; s=arc-20160816; b=g5oakMebgXq2G67NFYjw2A+qeoR+VH0aGK8WrEvVfYWWoTTzcc4pafGZAajnJUK/If Ecai7uPaB44hcBFfA1XIEvO/TZWglbyvcLHNbkfy8xFbPgZn8qv5EgEWnaumV/+B+hAK OxJ+NOORLxdz5owvbjVQPNI0I2GgodnzKPnxiRhvpRZ3Rt0PVi0n9pD8WyJnxytbx+PL mbItgrPCOr3k7m3YoqxD9XCSJZ+l/EYInzutjQUqiwa3jMJ6pZqim2ymqZWQcqGoc/sl 6PnOc94ukq/Ua9/u2cw5HWs6rDMoY0mf3MGyI+1N+8WCtj/YbEP1ROSU/h2yDTO+QHRX qPMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=HbCbrPRLFc0wt2KWsv1JDW/nEfvRpFrZyzActwKD8/E=; b=aLTrMkkDKP1viVnmzboVblmJxk/sZ4KOgIBmI7ZKQR2/yqa9ndagulg3McyZBYqlzG unJFSWt1VE/0YHqCvI6M5QFJbHw7FgXnJ2rB+PeUUqRcIQobkYsTI0QB0v4sW4L82HmZ /FY2gQpM/oSs19KcwDOHPtnbRJdild9UZmFmsSnxRXmv5r9k6QR2r10qmJfFrV0Ehptg 7XFolts4PahdX1tDACFd7yqeug/T0aT0L05RPkLJpl/JcmT/nibJgdATRB+SwVtmQocw vO0FL6IIw9c2KRl/729ZjgIWDVf7F64CkuXh8yaTUTap1kTCBhrwwSw0Ne9A0caUF70z WaVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k12si5223658pgt.445.2022.02.16.00.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 00:33:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0C3862A417A; Wed, 16 Feb 2022 00:30:59 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229836AbiBPIbC (ORCPT + 99 others); Wed, 16 Feb 2022 03:31:02 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:34846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbiBPIa7 (ORCPT ); Wed, 16 Feb 2022 03:30:59 -0500 Received: from out30-42.freemail.mail.aliyun.com (out30-42.freemail.mail.aliyun.com [115.124.30.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC9AA22BF7 for ; Wed, 16 Feb 2022 00:30:47 -0800 (PST) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- 2.27.0