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.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 283E2C2B9F4 for ; Tue, 22 Jun 2021 14:59:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1166560234 for ; Tue, 22 Jun 2021 14:59:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231947AbhFVPBw (ORCPT ); Tue, 22 Jun 2021 11:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232097AbhFVPBs (ORCPT ); Tue, 22 Jun 2021 11:01:48 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50F28C061767 for ; Tue, 22 Jun 2021 07:59:32 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id c11so30572621ljd.6 for ; Tue, 22 Jun 2021 07:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RA8ZD9ClukMzIKl1MArz2ae3thSxvhEA0gqsTc1XYss=; b=Pb4LQYmNj3prWXaEvsu8+rvfYImNKOOFVO+YElWuhVGmGRuzjKH3ziJIRpyoScfWkq CtFTKrqB7bLWr3dbBYb/lObqKFZtynQCNjOKG4XgFCSzPIuj8Cq3KKhd3TmrtlHlqgED SafREWJtEpmXpAzkZuiZx9uJG1MHLKvv0RhzehuvcKx1aEcAfMsYsULjKYqMLOkFXgQ+ SXieBM52oa/d16NaRVwpOaypC3AyhGlXY8ya/3N0yFfVohmHUFpNW/6GvNFYew3hCdVj esSl1xYrpRwRjF6yq543gA9qCZrqpYjO7GGiGfzFegaccFxdLq9RKHxf51AdT9+N4tP+ ffYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RA8ZD9ClukMzIKl1MArz2ae3thSxvhEA0gqsTc1XYss=; b=Lzp1pxyR8srO9ep3YW35r7/G9KdCLkow39ymNYcTmdPkZ7MRKpSaEzuSHzoybQbp4q 7B7eJk2zhUMZjnULFlOqFXuC+S6AtxlMm1DMg74ZW6bQ8Jbadpm6ZPyFMBe5y/d2ewS6 dUbZu9ycwVpGe87OucMFXYOm9ZDQ3fn34egSkXS4zjP7xR2KDngxdmxXt9ZPPZefi9IG cnvD0EpV4KkerrXTFgXN1Wd+zrp5ou9W3/MpbCLke34UZfcpdmvtEpJ6wN8ejklqi/iY dYBLzbMNnO5362XQS9VGjqHYr8CD/apll8h5x0iC6r0UruXJwsiemjIkwEsPFuCwETd1 gxCw== X-Gm-Message-State: AOAM5311E9cTWUUBURWya6oTC4t0am7FNICEQY1Vf0XzK+Taxf7SJapv HDjkFELiFobwFJfKc3f4VGd4X/Su9iZQS+PgUTwl0A== X-Google-Smtp-Source: ABdhPJxulhjPL3w9xH/DtXwDuOpTPs0GBBZVsrKKsHxqzu/ANLShEMXKYExXbngsiCwr7f1lxiXoFteJooEKw+KviKg= X-Received: by 2002:a05:651c:49d:: with SMTP id s29mr3703265ljc.279.1624373970420; Tue, 22 Jun 2021 07:59:30 -0700 (PDT) MIME-Version: 1.0 References: <20210621083108.17589-1-sj38.park@gmail.com> <20210621083108.17589-3-sj38.park@gmail.com> In-Reply-To: <20210621083108.17589-3-sj38.park@gmail.com> From: Shakeel Butt Date: Tue, 22 Jun 2021 07:59:19 -0700 Message-ID: Subject: Re: [PATCH v31 02/13] mm/damon/core: Implement region-based sampling To: SeongJae Park Cc: Andrew Morton , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 21, 2021 at 1:31 AM SeongJae Park wrote: > > From: SeongJae Park > > To avoid the unbounded increase of the overhead, DAMON groups adjacent > pages that are assumed to have the same access frequencies into a > region. As long as the assumption (pages in a region have the same > access frequencies) is kept, only one page in the region is required to > be checked. Thus, for each ``sampling interval``, > > 1. the 'prepare_access_checks' primitive picks one page in each region, > 2. waits for one ``sampling interval``, > 3. checks whether the page is accessed meanwhile, and > 4. increases the access count of the region if so. > > Therefore, the monitoring overhead is controllable by adjusting the > number of regions. DAMON allows both the underlying primitives and user > callbacks to adjust regions for the trade-off. In other words, this > commit makes DAMON to use not only time-based sampling but also > space-based sampling. > > This scheme, however, cannot preserve the quality of the output if the > assumption is not guaranteed. Next commit will address this problem. > > Signed-off-by: SeongJae Park > Reviewed-by: Leonard Foerster > Reviewed-by: Fernand Sieber Acked-by: Shakeel Butt 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.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 EC162C48BE5 for ; Tue, 22 Jun 2021 14:59:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 919EA61001 for ; Tue, 22 Jun 2021 14:59:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 919EA61001 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7ED746B0070; Tue, 22 Jun 2021 10:59:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B8EF6B0071; Tue, 22 Jun 2021 10:59:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 617536B0072; Tue, 22 Jun 2021 10:59:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0139.hostedemail.com [216.40.44.139]) by kanga.kvack.org (Postfix) with ESMTP id 25BE36B0070 for ; Tue, 22 Jun 2021 10:59:32 -0400 (EDT) Received: from smtpin35.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5D31711215 for ; Tue, 22 Jun 2021 14:59:32 +0000 (UTC) X-FDA: 78281668584.35.E881591 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by imf29.hostedemail.com (Postfix) with ESMTP id 178CF2650 for ; Tue, 22 Jun 2021 14:59:31 +0000 (UTC) Received: by mail-lj1-f175.google.com with SMTP id z22so30543942ljh.8 for ; Tue, 22 Jun 2021 07:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RA8ZD9ClukMzIKl1MArz2ae3thSxvhEA0gqsTc1XYss=; b=Pb4LQYmNj3prWXaEvsu8+rvfYImNKOOFVO+YElWuhVGmGRuzjKH3ziJIRpyoScfWkq CtFTKrqB7bLWr3dbBYb/lObqKFZtynQCNjOKG4XgFCSzPIuj8Cq3KKhd3TmrtlHlqgED SafREWJtEpmXpAzkZuiZx9uJG1MHLKvv0RhzehuvcKx1aEcAfMsYsULjKYqMLOkFXgQ+ SXieBM52oa/d16NaRVwpOaypC3AyhGlXY8ya/3N0yFfVohmHUFpNW/6GvNFYew3hCdVj esSl1xYrpRwRjF6yq543gA9qCZrqpYjO7GGiGfzFegaccFxdLq9RKHxf51AdT9+N4tP+ ffYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RA8ZD9ClukMzIKl1MArz2ae3thSxvhEA0gqsTc1XYss=; b=CorcRKtjmN5x6xVVz9S848OWyK/BPguOxXNiHM1pGHcUqtJt20eXVE3Wu+j7zc+EMO kJs/rvjb3jlNYQS2ulLZa4QysoLC/0wCcu1h9zoNIqFiViqsVVmKwqldl0XshbgIAerV /6rhDCRne6uwY5zQS8Hbmc/IqUHJVY2l91xkLAzahctNQ2DZbJ5a2CgKo4DVE18+sY2F EFW1doPmu1KN9UpMB0OGJp3t3Kdcmn9Ko9ICmJqZMKBFn5DgCNZOxSZRfI2Ws75Rq4cz 1edjeTGv62uHOpnx05ODSIgui/twLHPPUBGDF7OHib9wle1O1QIPnuGTZBGdHCgRm74x QwrA== X-Gm-Message-State: AOAM530z1h0RRe0wwoGnxCdXTEaNjC0p3lDtzWX1nSYxEc85N5mQl+LA 0PhwdSxITyczFxH5WSI2MBD0jmUp7peQyj2616mguA== X-Google-Smtp-Source: ABdhPJxulhjPL3w9xH/DtXwDuOpTPs0GBBZVsrKKsHxqzu/ANLShEMXKYExXbngsiCwr7f1lxiXoFteJooEKw+KviKg= X-Received: by 2002:a05:651c:49d:: with SMTP id s29mr3703265ljc.279.1624373970420; Tue, 22 Jun 2021 07:59:30 -0700 (PDT) MIME-Version: 1.0 References: <20210621083108.17589-1-sj38.park@gmail.com> <20210621083108.17589-3-sj38.park@gmail.com> In-Reply-To: <20210621083108.17589-3-sj38.park@gmail.com> From: Shakeel Butt Date: Tue, 22 Jun 2021 07:59:19 -0700 Message-ID: Subject: Re: [PATCH v31 02/13] mm/damon/core: Implement region-based sampling To: SeongJae Park Cc: Andrew Morton , 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 178CF2650 X-Stat-Signature: 8teta9g561xipt73kh96hjemp8g4tiwp Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=Pb4LQYmN; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf29.hostedemail.com: domain of shakeelb@google.com designates 209.85.208.175 as permitted sender) smtp.mailfrom=shakeelb@google.com X-HE-Tag: 1624373971-921189 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 Mon, Jun 21, 2021 at 1:31 AM SeongJae Park wrote: > > From: SeongJae Park > > To avoid the unbounded increase of the overhead, DAMON groups adjacent > pages that are assumed to have the same access frequencies into a > region. As long as the assumption (pages in a region have the same > access frequencies) is kept, only one page in the region is required to > be checked. Thus, for each ``sampling interval``, > > 1. the 'prepare_access_checks' primitive picks one page in each region, > 2. waits for one ``sampling interval``, > 3. checks whether the page is accessed meanwhile, and > 4. increases the access count of the region if so. > > Therefore, the monitoring overhead is controllable by adjusting the > number of regions. DAMON allows both the underlying primitives and user > callbacks to adjust regions for the trade-off. In other words, this > commit makes DAMON to use not only time-based sampling but also > space-based sampling. > > This scheme, however, cannot preserve the quality of the output if the > assumption is not guaranteed. Next commit will address this problem. > > Signed-off-by: SeongJae Park > Reviewed-by: Leonard Foerster > Reviewed-by: Fernand Sieber Acked-by: Shakeel Butt