From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C903C433DB for ; Tue, 19 Jan 2021 18:37:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1343020706 for ; Tue, 19 Jan 2021 18:37:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1343020706 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A2EC76B0006; Tue, 19 Jan 2021 13:37:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DCF06B0012; Tue, 19 Jan 2021 13:37:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 855E96B0024; Tue, 19 Jan 2021 13:37:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 6A1BF6B0006 for ; Tue, 19 Jan 2021 13:37:44 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6E8D7181AEF31 for ; Tue, 19 Jan 2021 18:37:43 +0000 (UTC) X-FDA: 77723383206.23.pear42_480b31727554 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id 451A737604 for ; Tue, 19 Jan 2021 18:37:43 +0000 (UTC) X-HE-Tag: pear42_480b31727554 X-Filterd-Recvd-Size: 6769 Received: from smtprelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Jan 2021 18:37:42 +0000 (UTC) Received: from forelay.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 1D8FE1802EB3C for ; Tue, 19 Jan 2021 18:37:41 +0000 (UTC) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E5B19181AEF31 for ; Tue, 19 Jan 2021 18:37:40 +0000 (UTC) X-FDA: 77723383080.02.pear93_0b0b05627554 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id BFD0E10097AA1 for ; Tue, 19 Jan 2021 18:37:40 +0000 (UTC) X-HE-Tag: pear93_0b0b05627554 X-Filterd-Recvd-Size: 5293 Received: from smtp-fw-9102.amazon.com (smtp-fw-9102.amazon.com [207.171.184.29]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Jan 2021 18:37:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1611081458; x=1642617458; h=from:to:cc:subject:date:message-id:in-reply-to: mime-version; bh=KZM1YrJFzekGYZS1Tr/APAkkwA1kXNN/k2pjtWwyQc8=; b=ImaVtVC1TFeBDeoZR0J7srxuljpWZhAw2C8sgFLFybhbzrOsENaa8+1M Pkb1FWYDEKvBrHirvfFXTcvwBOGQ6VxzE7gBENXmusVYSU9WowTaU0FlW sfvZ4a0a7xreWFLijEQTbhDcJAVqqDf1xj1/93V3iyzX/cZJ7z5e0MBF2 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) 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: 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