Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1199100ybt; Thu, 18 Jun 2020 03:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnf7uasxMKM4lIDAyrB9IeWQdM4GlpxdGNq8IfxnGjhmJjdaWIvz7YxgmPleZwHNCHogdr X-Received: by 2002:a17:906:1d56:: with SMTP id o22mr3160900ejh.406.1592474505679; Thu, 18 Jun 2020 03:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592474505; cv=none; d=google.com; s=arc-20160816; b=CmElB6OgXGIAIOgHvKJJhm80zgbRq7iDsKmc/Oj1hkj0qAZwr/CuT5xS+XIAjJRsqO 8n/xxjkceOCr1SdiluskPIFK5jpBAfeWfbbjI0Do3KEjNnu6i0YmsuSRNtCMH6Ey7Bt3 pv9DtJU+D45dilX7EV3zMiGOLuNRNHmLlOGi/VoyCZuBb3t9yI7l3VYIRWDr/YpIGyuB O50YQHyehGxVvIwUwkz7T/z0k7mtSYkkOzFzvz/ct9yw04Gx4t35/ijmiLkVImnPcq52 +j0lTJaLYxlJSSLjdSgdQ9Uz3BP4Wd5ZZJj4MNbsxbn8X4jpTfeDNS4ggRjHpVb5TU9d 5G6Q== 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=FrQFWi/xY34CO1aXWXmdnkW19MrSY+JhOMiMHLm7T+s=; b=cMg8mJqxkdR1TP0hFV34X1BMhSugAR5LbGb/iAEeNH6EpXVc8Q2wFsh+Jmy8jHssC5 S+lC2iIr3266gXiiFKEMpvYKqlv7L5KdPb9r+1YUs3gnIa9dFsPKHm1xcGiqunqjnlzF R9nX4FlxzazD3n2+JS+Sqd9xE6W+JYfFoFkDpiSI4nA7V1JdLn7+RoBOSPdPUqzhJ3RD Oov1qwsOmVtj9FzXT9On7ctejBwVasbFFcBl1DzDtF9WkD8eZPSY2nneLajxTlPfv32s RkIDE47xFqjKNCB5vaM7huEEI4Q5wl1jt2u8hjR6stsngQzLaLPBdpgCYllhbVFkoFMp St5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="TUG/9Nqb"; 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 si8si1708170ejb.7.2020.06.18.03.01.22; Thu, 18 Jun 2020 03:01:45 -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="TUG/9Nqb"; 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 S1729087AbgFRJXV (ORCPT + 99 others); Thu, 18 Jun 2020 05:23:21 -0400 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:47492 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729023AbgFRJXV (ORCPT ); Thu, 18 Jun 2020 05:23:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1592472201; x=1624008201; h=from:to:cc:subject:date:message-id:in-reply-to; bh=FrQFWi/xY34CO1aXWXmdnkW19MrSY+JhOMiMHLm7T+s=; b=TUG/9NqbRMFwKlSmGeqQVp3K2F9ohQgW4U9TbzQI/uL6l1Q/NWuxKRad J9MVEH7PTzQM3gHKPQrhMSBl4YLifqsyjJIcUPCn2txmLWKhneCciuRQw Qvpt+jc/ex+ByDvd9GRAPefc4LNgWt22q64itkCBMoZqPTMtoPhZe7gGQ Y=; IronPort-SDR: 3luC+foP3FAHkqHBVGpAbflh+Fhxy3xXWOoEx/AnfvPeb0zPbKm0C8zlJBhWMTia+K8OdqjEuM QmiwPjg/YZCA== X-IronPort-AV: E=Sophos;i="5.73,526,1583193600"; d="scan'208";a="38333624" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2a-119b4f96.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 18 Jun 2020 09:23:17 +0000 Received: from uc85b765ebdd8595b4b67.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2a-119b4f96.us-west-2.amazon.com (Postfix) with ESMTPS id 57FDB1A09AC; Thu, 18 Jun 2020 09:23:13 +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 05I9NAhx022461; Thu, 18 Jun 2020 11:23:10 +0200 Received: (from foersleo@localhost) by uc85b765ebdd8595b4b67.ant.amazon.com (8.15.2/8.15.2/Submit) id 05I9N6KK022447; Thu, 18 Jun 2020 11:23:06 +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, foersleo@amazon.de, 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, david@redhat.com, linux-damon@amazon.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v16 03/14] mm/damon: Implement region based sampling Date: Thu, 18 Jun 2020 11:23:03 +0200 Message-Id: <1592472183-22394-1-git-send-email-foersleo@amazon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20200615161927.12637-4-sjpark@amazon.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-06-15T18:19:16+02:00 SeongJae Park wrote: > From: SeongJae Park > > This commit implements DAMON's target address space independent high > level logics for basic access check and region based sampling. The > target address space specific logics for the monitoring target address > regions construction and the access check are required, though. The > following commits will provide reference implementations of those for > the general virtual address spaces and the physical address space. > Users can implement and use their own versions for their specific use > cases, though. > > Basic Access Check > ------------------ > > DAMON basically reports what pages are how frequently accessed. The > frequency is not an absolute number of accesses, but a ratio. > > For this, DAMON first calls target monitoring construction callback > (``init_target_regions``), and then the access check callbacks, which is > assumed to check the access to each page and aggregates the number of > observed accesses of each page, for every ``sampling interval``. > Finally, DAMON resets the aggregated count per ``aggregation interval``. > > This is thus similar to the common periodic access checks based > monitoring mechanisms but provides the access frequency. The overhead > will increase 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. 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 some sort of best effort. > > Signed-off-by: SeongJae Park > --- Reviewed-by: Leonard Foerster