Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp818225ybm; Wed, 27 May 2020 08:44:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjb1KMqpQsUahmoZxJUGzTQvvXIasj9A+f3mK4+JN+A2kAG2//v2XH9IO99zJuYtFM7tL/ X-Received: by 2002:a17:906:ce36:: with SMTP id sd22mr6513541ejb.94.1590594261664; Wed, 27 May 2020 08:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590594261; cv=none; d=google.com; s=arc-20160816; b=iVJ9qGHY3kgq+sYx4olvU5FXzZtjGGhM82wB6iA/RabdZE2BViTz4Ux43qhlnU8C2D JeYgNoGB1XqdHUjMq5ldBu9SEce2PJhSjjuT22J5uZbYoynq0tZC4Vnoa3laYnYtj/R5 sSULjcDmSPf7tyacbwmHfxeEG3M3LreM33NqZb24QNeXeKDTUqLAJzZq9zE1UER1jlSu d7eDFcAyVXt4inTDaSbuN2JRKmCPYnfpOAcD7rCJuhz4za+qweAUyL37EpVivMzpuVAA GizjJ8foO/C7l23UXeeBzb8MdDP77dQIq7Y/a5JAUkka67WbauHtsOeyngKYkWJhuOWb 1B2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:message-id:date:subject:cc:to :from:ironport-sdr:dkim-signature; bh=DFocd5jeTsIMiOO4Pa/eJba/mmL/NWJtB06/JmfYgIs=; b=he/tWviJVTUjdlQX8eb/F/ScT5qK7l/bu/EidN6dvzgdXaWbHDF68DvLNrOSinSabD r7KmSsecmD2AVESSlbpHPl6AeKtvjYpGLvZDm0B0KkGQPE7bu9B3GKmgMCzDKHbflnoZ s39fpfStAGXEPhu5mtG0lUSSqjqGiNlRYhnWeyLC+oPiVPa/9RJD6G2qaflSDfxqstZr dlTagAEkAbhs0VVBCAg50HXSvZu2slCgkYPy4nQXK9+81E2rzo1EJExtNXEhhxhESof+ HSJmEWAFwfTuM6fpr0li6wHDQrfmPjGKVIH7LsCpykGvqg8iBp4wp9JrHlksAO3GPqyh dVOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="KDGM/uPk"; 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 m28si623228edb.7.2020.05.27.08.43.58; Wed, 27 May 2020 08:44:21 -0700 (PDT) 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="KDGM/uPk"; 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 S2388423AbgE0LYH (ORCPT + 99 others); Wed, 27 May 2020 07:24:07 -0400 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:15187 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388414AbgE0LYF (ORCPT ); Wed, 27 May 2020 07:24:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1590578645; x=1622114645; h=from:to:cc:subject:date:message-id:in-reply-to; bh=DFocd5jeTsIMiOO4Pa/eJba/mmL/NWJtB06/JmfYgIs=; b=KDGM/uPktHPh4dfLsDs9cQbwdzjiNq9UMn9s7cSHQHhO2JM/N0sNAIE9 obOc16ZOwiv+cHOqU4EiZ/RzoFLGlWhB9dhBPG1z6XwcXuv4fP6XQrHPS NTC7++jO/KihG/0r75UTgcdTzWAfI30Nq8//l/Cmpqwv6hxhb6D3Y7QSs s=; IronPort-SDR: 66TYDWmV85+x7TJR4HyvtWzhIn0lN0f7OK9Bvi4H9cEhtAEBJs+ptoyIZOLIT798vIblwD3+A7 4bXL1rhJIU3g== X-IronPort-AV: E=Sophos;i="5.73,441,1583193600"; d="scan'208";a="33842663" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-f273de60.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 27 May 2020 11:24:05 +0000 Received: from uc85b765ebdd8595b4b67.ant.amazon.com (iad7-ws-svc-lb50-vlan3.amazon.com [10.0.93.214]) by email-inbound-relay-1d-f273de60.us-east-1.amazon.com (Postfix) with ESMTPS id F3929A05C9; Wed, 27 May 2020 11:23:52 +0000 (UTC) Received: from uc85b765ebdd8595b4b67.ant.amazon.com (localhost [127.0.0.1]) by uc85b765ebdd8595b4b67.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id 04RBNoud027138; Wed, 27 May 2020 13:23:50 +0200 Received: (from foersleo@localhost) by uc85b765ebdd8595b4b67.ant.amazon.com (8.15.2/8.15.2/Submit) id 04RBNov2027136; Wed, 27 May 2020 13:23:50 +0200 From: Leonard Foerster To: SeongJae Park Cc: akpm@linux-foundation.org, SeongJae Park , Jonathan.Cameron@Huawei.com, aarcange@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, amit@kernel.org, benh@kernel.crashing.org, brendan.d.gregg@gmail.com, brendanhiggins@google.com, cai@lca.pw, colin.king@canonical.com, corbet@lwn.net, dwmw@amazon.com, irogers@google.com, jolsa@redhat.com, kirill@shutemov.name, mark.rutland@arm.com, mgorman@suse.de, minchan@kernel.org, mingo@redhat.com, namhyung@kernel.org, peterz@infradead.org, rdunlap@infradead.org, riel@surriel.com, rientjes@google.com, rostedt@goodmis.org, sblbir@amazon.com, shakeelb@google.com, shuah@kernel.org, sj38.park@gmail.com, snu@amazon.de, vbabka@suse.cz, vdavydov.dev@gmail.com, yang.shi@linux.alibaba.com, ying.huang@intel.com, linux-damon@amazon.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v13 04/15] mm/damon: Implement region based sampling Date: Wed, 27 May 2020 13:23:48 +0200 Message-Id: <1590578628-27088-1-git-send-email-foersleo@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20200525091512.30391-5-sjpark@amazon.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-05-25T11:15:01+02:00 SeongJae Park wrote: > From: SeongJae Park > > This commit implements DAMON's basic access check and region based > sampling mechanisms. This change would seems make no sense, mainly > because it is only a part of the DAMON's logics. Following two commits > will make more sense. > > Basic Access Check > ------------------ > > DAMON basically reports what pages are how frequently accessed. Note > that the frequency is not an absolute number of accesses, but a relative > frequency among the pages of the target workloads. > > Users can control the resolution of the reports by setting two time > intervals, ``sampling interval`` and ``aggregation interval``. In > detail, DAMON checks access to each page per ``sampling interval``, > aggregates the results (counts the number of the accesses to each page), > and reports the aggregated results per ``aggregation interval``. For > the access check of each page, DAMON uses the Accessed bits of PTEs. > > This is thus similar to common periodic access checks based access > tracking mechanisms, which overhead is increasing as the size of the > target process grows. > > Region Based Sampling > --------------------- > > To avoid the unbounded increase of the overhead, DAMON groups a number > of adjacent pages that assumed to have same access frequencies into a > region. As long as the assumption (pages in a region have same access > frequencies) is kept, only one page in the region is required to be > checked. Thus, for each ``sampling interval``, DAMON randomly picks one > page in each region and clears its Accessed bit. After one more > ``sampling interval``, DAMON reads the Accessed bit of the page and > increases the access frequency of the region if the bit has set > meanwhile. Therefore, the monitoring overhead is controllable by > setting the number of regions. > > Nonetheless, this scheme cannot preserve the quality of the output if > the assumption is not kept. Following commit will introduce how we can > make the guarantee with best effort. > > Signed-off-by: SeongJae Park Reviewed-by: Leonard Foerster