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=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,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 2CB78C48BDF for ; Thu, 24 Jun 2021 10:26:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CF1FB61248 for ; Thu, 24 Jun 2021 10:26:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF1FB61248 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D528B6B005D; Thu, 24 Jun 2021 06:26:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D298C6B006C; Thu, 24 Jun 2021 06:26:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCA876B0070; Thu, 24 Jun 2021 06:26:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0154.hostedemail.com [216.40.44.154]) by kanga.kvack.org (Postfix) with ESMTP id 8FD086B005D for ; Thu, 24 Jun 2021 06:26:39 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B7DCB18155603 for ; Thu, 24 Jun 2021 10:26:39 +0000 (UTC) X-FDA: 78288238518.26.D62BCF5 Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) by imf28.hostedemail.com (Postfix) with ESMTP id 5D31B2000BEF for ; Thu, 24 Jun 2021 10:26:39 +0000 (UTC) Received: by mail-qv1-f51.google.com with SMTP id y4so2985027qvs.10 for ; Thu, 24 Jun 2021 03:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to; bh=aYxEESGYd+nGspsnDUf9V/geC8TjcsBr5faZa+wAtFE=; b=n9332Kyljg+bQ1InWHjSaOf0m9gf3rTgTFgm5k+drGmtNO3PQiPF1r9NMqgk2AXMMQ RDIgan1nerVcawH0Ckn9m3xuLFmklqx2ofXnt5daFr4KEwvkii/ockvzVEAaioWTbUQp thvR56eg5DywSPDD0ShiJ4E9Yl4aJjM/DimbPvX5H8PJJrGAd2vwbNMhTGrosnc/PcRc gxtSnCVCnjf7t5lXUY21QuGdlpjBmLQaea4Vbj+MP4PT3qc5yxoGGgw2WF2xa2hnyItZ /bbYyxXB4LQ6zwDv3C/+EAR/NO7QDTWNn/OtzUr/cF8ZJeOWFuiDpeCQKur/8oaVwfAY mZDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to; bh=aYxEESGYd+nGspsnDUf9V/geC8TjcsBr5faZa+wAtFE=; b=A/czTWw6x6wbR2QlTmiRgH+z/TnfVnEYjkVJuhxb1MzhaxIyfq2JG2DkRZK05vZGx1 jjQlrx2j8/jgLY860MMxMc62AO7BWtkCT8kuHDqEq+msRyp3uBfWkl2uXIH33OOU0jv2 O01oUMJ8PGHKScU8PnbJPRvI7bnAcx70Zf4Zd7kSypzieisAzrt6yqDyJH9+em5bgeRt aH43HUlPA5CwuOePlACT4MgYn68gzkoqThhakSRb16bq4+E9Pn21OBGitmRyTPVcRxED tz6Nn862RVxS6jikZXd5GKxTYqekCLbNXeNTXaH1wji4TAmxymphvrMBwHZ+Y7c/hrZR 6GpQ== X-Gm-Message-State: AOAM5324RO3VZAePc2rmVYuXdK5Ry27qPa/xiBXaxLJhosOgjvm6FBTa CeUFr3uyYL+ltCeUz7biteE= X-Google-Smtp-Source: ABdhPJyU5LD8rG7vCa9ttZlMnPgh8R+WCpKy60nE6cbt7hIJmsntdRw97EyHr2g0jg+/gmrzTrQ53Q== X-Received: by 2002:a0c:fdc5:: with SMTP id g5mr4263859qvs.15.1624530398844; Thu, 24 Jun 2021 03:26:38 -0700 (PDT) Received: from localhost.localdomain (ec2-35-169-212-159.compute-1.amazonaws.com. [35.169.212.159]) by smtp.gmail.com with ESMTPSA id w195sm2132842qkb.127.2021.06.24.03.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 03:26:38 -0700 (PDT) From: SeongJae Park X-Google-Original-From: SeongJae Park To: Shakeel Butt Cc: SeongJae Park , SeongJae Park , Jonathan.Cameron@huawei.com, acme@kernel.org, alexander.shishkin@linux.intel.com, amit@kernel.org, benh@kernel.crashing.org, Brendan Higgins , Jonathan Corbet , David Hildenbrand , dwmw@amazon.com, Marco Elver , "Du, Fan" , foersleo@amazon.de, greg@kroah.com, Greg Thelen , guoju.fgj@alibaba-inc.com, jgowans@amazon.com, Mel Gorman , mheyne@amazon.de, Minchan Kim , Ingo Molnar , namhyung@kernel.org, "Peter Zijlstra (Intel)" , Rik van Riel , David Rientjes , Steven Rostedt , Mike Rapoport , Shuah Khan , sieberf@amazon.com, snu@zelle79.org, Vlastimil Babka , Vladimir Davydov , zgf574564920@gmail.com, linux-damon@amazon.com, Linux MM , linux-doc@vger.kernel.org, LKML Subject: Re: [PATCH v31 03/13] mm/damon: Adaptively adjust regions Date: Thu, 24 Jun 2021 10:26:20 +0000 Message-Id: <20210624102623.24563-2-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210624102623.24563-1-sjpark@amazon.de> References: <20210624102623.24563-1-sjpark@amazon.de> In-Reply-To: Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=n9332Kyl; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of sj38park@gmail.com designates 209.85.219.51 as permitted sender) smtp.mailfrom=sj38park@gmail.com X-Stat-Signature: ee5bf5cehr5htooffr37zk96hnwxbquu X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5D31B2000BEF X-HE-Tag: 1624530399-813880 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: From: SeongJae Park On Tue, 22 Jun 2021 07:59:35 -0700 Shakeel Butt wrote: > On Mon, Jun 21, 2021 at 1:31 AM 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 > > Reviewed-by: Fernand Sieber > [...] > > > > +unsigned int damon_nr_regions(struct damon_target *t) > > +{ > > + struct damon_region *r; > > + unsigned int nr_regions = 0; > > + > > + damon_for_each_region(r, t) > > + nr_regions++; > > This bugs me everytime. Please just have nr_regions field in the > damon_target instead of traversing the list to count the number of > regions. Ok, I will make the change in next spin. > > Other than that, it looks good to me. Thanks, SeongJae Park