Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3089245pxb; Tue, 19 Jan 2021 13:32:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3xAM4xR9IO6hGh/6AYW9Z+JL+RrYWxId1PzHgXLTMtlsXMqlL5SGwkepn1AA8Z3hRtTJF X-Received: by 2002:a05:6402:4382:: with SMTP id o2mr5072839edc.371.1611091929380; Tue, 19 Jan 2021 13:32:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611091929; cv=none; d=google.com; s=arc-20160816; b=BRa6+IpDiEcUUgUx+cKQMtjtull+VYxVLvnbXI0mfr8/KMzd+bO7Wx+Ybywh8l//jR AJDDh63DLU6m5jXb0dbNe9RXhUiA/XRIjE5v2Qm+HyS8XCTo++AyNGbfv/FMOz8LlohQ zKEad0ceCHK1gp76IbsOe/Gj7GrF3cvqwdzzPuB4UMh0H8j4sn2Iq3HS5ZNM+GVwn26t AS45rmuVGUMmGzK5+OXoz846Jqoyg8eBVgzhniAJ2JNVh2GRlqfHz3LKVvm8QAJSiOrp XYNZ5sEImGlOSWDLc5rha2L0q6Pha6coVgS8+qrLqaBLId9GlRVjiX3odrLZyPiUj63b 1b6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=KZM1YrJFzekGYZS1Tr/APAkkwA1kXNN/k2pjtWwyQc8=; b=YYPAnCEs8TzfqM7k9Q877DbZXP5FfrYAQ0hkVGf/qyN4Z8nejQF3P8xTytykpPBvlX CHR/T0Se30mo8UxHRxrwI7YkYSJS/VO5qB9VLjKLKAdi051/KLcAa5+6AgCgFx0EynkD 373UtNyGTtbTP8q2iu41XZLRuyOVXO/dRutDmRktTgQHju6sH+A2uMpn/EsFVPByrs+Z Ycek+W11fY06C5P+oOm3CefBbk7n6UJQrXob9rfiGDd9KFApBSAqGoJdogB//ipjsiLz Hd3xBCqvSv1vygUcj1hunZaEUbCmp3tprohvOHM0T8boylR2dEaHLDc7uCrQvc3U8/9U H1Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=sDx1KMnW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n5si28647eda.301.2021.01.19.13.31.43; Tue, 19 Jan 2021 13:32:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=sDx1KMnW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728080AbhASSns (ORCPT + 99 others); Tue, 19 Jan 2021 13:43:48 -0500 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]:51850 "EHLO smtp-fw-9102.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389596AbhASSiO (ORCPT ); Tue, 19 Jan 2021 13:38:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1611081493; x=1642617493; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=KZM1YrJFzekGYZS1Tr/APAkkwA1kXNN/k2pjtWwyQc8=; b=sDx1KMnWXAl7B0DGAbhFIwH5Ww8eaoMdVFGjzdF59GWxcFsZlzF/kIp6 Qp0MwsX/l4uWxhLU895MzHkwY/FOwEFZWwXl/KA6XTXd26Isv+ctkSz+D UJwa8V/51K8UPkVkAz4KJCfOkCKtfA8oc2LSicb2vjPesc6xqeFqK9QYx g=; X-IronPort-AV: E=Sophos;i="5.79,359,1602547200"; d="scan'208";a="113266096" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP; 19 Jan 2021 18:37:11 +0000 Received: from EX13D31EUA004.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com (Postfix) with ESMTPS id 3A176A248E; Tue, 19 Jan 2021 18:37:08 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.161.203) by EX13D31EUA004.ant.amazon.com (10.43.165.161) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 19 Jan 2021 18:36:51 +0000 From: SeongJae Park To: SeongJae Park CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v23 03/15] mm/damon: Adaptively adjust regions Date: Tue, 19 Jan 2021 19:36:36 +0100 Message-ID: <20210119183636.327-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201215115448.25633-4-sjpark@amazon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.203] X-ClientProxiedBy: EX13D20UWA002.ant.amazon.com (10.43.160.176) To EX13D31EUA004.ant.amazon.com (10.43.165.161) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Dec 2020 12:54:36 +0100 SeongJae Park wrote: > From: SeongJae Park > > Even somehow the initial monitoring target regions are well constructed > to fulfill the assumption (pages in same region have similar access > frequencies), the data access pattern can be dynamically changed. This > will result in low monitoring quality. To keep the assumption as much > as possible, DAMON adaptively merges and splits each region based on > their access frequency. > > For each ``aggregation interval``, it compares the access frequencies of > adjacent regions and merges those if the frequency difference is small. > Then, after it reports and clears the aggregated access frequency of > each region, it splits each region into two or three regions if the > total number of regions will not exceed the user-specified maximum > number of regions after the split. > > In this way, DAMON provides its best-effort quality and minimal overhead > while keeping the upper-bound overhead that users set. > > Signed-off-by: SeongJae Park > Reviewed-by: Leonard Foerster > --- > include/linux/damon.h | 41 +++++--- > mm/damon/core.c | 220 ++++++++++++++++++++++++++++++++++++++++-- > 2 files changed, 240 insertions(+), 21 deletions(-) > [...] > diff --git a/mm/damon/core.c b/mm/damon/core.c > index 167487e75737..0f9beb60d9dd 100644 > --- a/mm/damon/core.c > +++ b/mm/damon/core.c [...] > + > +/* > + * Split a region in two > + * > + * r the region to be split > + * sz_r size of the first sub-region that will be made > + */ > +static void damon_split_region_at(struct damon_ctx *ctx, > + struct damon_region *r, unsigned long sz_r) > +{ > + struct damon_region *new; > + > + new = damon_new_region(r->ar.start + sz_r, r->ar.end); Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. found that 'damon_new_region()' could return NULL in case of memory allocation failure, but NULL check for 'new' is missed here. I will add the check in the next version. > + r->ar.end = new->ar.start; > + > + damon_insert_region(new, r, damon_next_region(r)); > +} [...] Thanks, SeongJae Park