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=unavailable 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 B9B73C49EA6 for ; Thu, 24 Jun 2021 10:26:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A1D86613FE for ; Thu, 24 Jun 2021 10:26:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232124AbhFXK3B (ORCPT ); Thu, 24 Jun 2021 06:29:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232111AbhFXK27 (ORCPT ); Thu, 24 Jun 2021 06:28:59 -0400 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 915BFC061574; Thu, 24 Jun 2021 03:26:39 -0700 (PDT) Received: by mail-qv1-xf2b.google.com with SMTP id f16so2997328qvs.7; 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=JPUgGCMTCG9bw0yuYYQCAVyJDjPCNcbtDoIr5YVZzisimYAcUIXoVSyIGDKv4GWRS3 zNvMwoOSeC7ffXzxq/BQ39caNP9WI6nJbYzUsXJnkGcFd5X0Oeew1zVgnJqXui3Q3w3r TozMzcawOjYwybm1ekExhVPznYk14G/0SsiM+UnoRraJIPxCnpphv9unng6Im6JGC9sH MgQj99n2J31u2oZOch+0B1v1XWa6gHWEkSQBwYYa04aAOPuNJqrzEm75Av70TV3c6Wk7 Dy7GQGzdWJL+0Td6oocnv3tpEhEz3JpFGhaKLngkr9REotj2p1ysLgYPlNjlBwR2VZSH QIRg== X-Gm-Message-State: AOAM532N4j3L8RZVxQnhLKJbBp0rdzA+0KrGdW6wpwG93WX6Awmvxuy4 N1dGmtzRg/p+r04DF17EtVk= 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: Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org 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