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.4 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 5501CC11F66 for ; Thu, 1 Jul 2021 00:19:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BE55161466 for ; Thu, 1 Jul 2021 00:19:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE55161466 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 24B378D01CF; Wed, 30 Jun 2021 20:19:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FB528D01C8; Wed, 30 Jun 2021 20:19:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0745D8D01CF; Wed, 30 Jun 2021 20:19:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0160.hostedemail.com [216.40.44.160]) by kanga.kvack.org (Postfix) with ESMTP id D3FDB8D01C8 for ; Wed, 30 Jun 2021 20:19:19 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9B31C180ACF84 for ; Thu, 1 Jul 2021 00:19:19 +0000 (UTC) X-FDA: 78312109638.12.AD8B753 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by imf16.hostedemail.com (Postfix) with ESMTP id 4AC6FF00008E for ; Thu, 1 Jul 2021 00:19:19 +0000 (UTC) Received: by mail-lf1-f43.google.com with SMTP id a11so8389044lfg.11 for ; Wed, 30 Jun 2021 17:19:19 -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=/CG640Lc2WlWabIvLJm9NXIcCA/KplWLKdPf3hf/cNI=; b=FAkN/08P/90nWgSkJc7L+wrN7B1QLzMymQTCG7qJ0k1xwbLmA8dEfmdwRnyoUk2qbW i6/QaE6HPbvcg8AoUpl+0hcqc38prTWvkA80zgPYYh+IPMoxRJ6/CsItYec4KCwFsvrn 49F8za2RC64Ob+mm9wBQQt+1iewP0zFw79CbnEK21v1wSp/gsg/wJYDptCXP/TiPC6m8 ay9j4OEaS5L+kfbEdi00qT9X8RMRdJzjgshDuOUGgz8Ftdmgs4ePLbIpnViDeETcqtPL qr0sWNb8qqgwNDrJ0XsLRqK7SNnWoGfohEVXNHMfFWYJ6dOeRBDZNgiDwQ3sctELb7ir iXtA== 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=/CG640Lc2WlWabIvLJm9NXIcCA/KplWLKdPf3hf/cNI=; b=tHAx1kPYb15utK6aa/ckmFylaiBXQyLsI0hCYDnGB7TJL+26NncohtjliBjKg/XmrC 0fV03wF5hs+gAfdO4xW88Ase/XYB54jrgCoO2Fi+ePx4uTzT4BWe4zTGDKQkZdu4cCOG j8Lq/cZQXLjjEui1iOHOTx2pYxH+tNYZjL2nSe18tf+JaMfv+9bXn8JGQNxw4fgY3VjJ YUYhIA1Al4/r+nRfrsHKJiCM4pewteFnj6OMRjVr8LOABNw+lr9kHM+WlRIRr72dSOib /aIzizbVc/u22mh6vfXmI1tYvkA6urjwTXoyKIPWp6BQIlWIB0H3CSeqvGpV+8yi3cJ+ yTaw== X-Gm-Message-State: AOAM5327+kgl56McZzDlDW4RDuHHcZ5um5DY2k3ZqzKatSPzs/6PPfT1 hrHfHVvntb91qJUY5D4zUwHkcgS4RPJX83dRhfz9yA== X-Google-Smtp-Source: ABdhPJyrzqfZ4GqBdHhEisbEDRI9b2ya4zX2ZwzqgjYzVwmdCdFZJwOrHhhY/8Jv2UXgbZnc17zXZkkYZ6Tv/HiF6pg= X-Received: by 2002:a05:6512:1191:: with SMTP id g17mr28938164lfr.347.1625098757807; Wed, 30 Jun 2021 17:19:17 -0700 (PDT) MIME-Version: 1.0 References: <20210621083108.17589-1-sj38.park@gmail.com> <20210621083108.17589-6-sj38.park@gmail.com> In-Reply-To: From: Shakeel Butt Date: Wed, 30 Jun 2021 17:19:06 -0700 Message-ID: Subject: Re: [PATCH v31 05/13] mm/damon: Implement primitives for the virtual memory address spaces 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: 4AC6FF00008E X-Stat-Signature: ku9nqnkij7f6eb41b86rgbfgrsefman6 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b="FAkN/08P"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf16.hostedemail.com: domain of shakeelb@google.com designates 209.85.167.43 as permitted sender) smtp.mailfrom=shakeelb@google.com X-HE-Tag: 1625098759-829489 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 Wed, Jun 30, 2021 at 5:18 PM Shakeel Butt wrote: > > On Mon, Jun 21, 2021 at 1:31 AM SeongJae Park wrote: > > > > From: SeongJae Park > > > > This commit introduces a reference implementation of the address space > > specific low level primitives for the virtual address space, so that > > users of DAMON can easily monitor the data accesses on virtual address > > spaces of specific processes by simply configuring the implementation to > > be used by DAMON. > > > > The low level primitives for the fundamental access monitoring are > > defined in two parts: > > > > 1. Identification of the monitoring target address range for the address > > space. > > 2. Access check of specific address range in the target space. > > > > The reference implementation for the virtual address space does the > > works as below. > > > > PTE Accessed-bit Based Access Check > > ----------------------------------- > > > > The implementation uses PTE Accessed-bit for basic access checks. That > > is, it clears the bit for the next sampling target page and checks > > whether it is set again after one sampling period. This could disturb > > the reclaim logic. DAMON uses ``PG_idle`` and ``PG_young`` page flags > > to solve the conflict, as Idle page tracking does. > > > > VMA-based Target Address Range Construction > > ------------------------------------------- > > > > Only small parts in the super-huge virtual address space of the > > processes are mapped to physical memory and accessed. Thus, tracking > > the unmapped address regions is just wasteful. However, because DAMON > > can deal with some level of noise using the adaptive regions adjustment > > mechanism, tracking every mapping is not strictly required but could > > even incur a high overhead in some cases. That said, too huge unmapped > > areas inside the monitoring target should be removed to not take the > > time for the adaptive mechanism. > > > > For the reason, this implementation converts the complex mappings to > > three distinct regions that cover every mapped area of the address > > space. Also, the two gaps between the three regions are the two biggest > > unmapped areas in the given address space. The two biggest unmapped > > areas would be the gap between the heap and the uppermost mmap()-ed > > region, and the gap between the lowermost mmap()-ed region and the stack > > in most of the cases. Because these gaps are exceptionally huge in > > usual address spaces, excluding these will be sufficient to make a > > reasonable trade-off. Below shows this in detail:: > > > > > > > > > > (small mmap()-ed regions and munmap()-ed regions) > > > > > > > > > > Signed-off-by: SeongJae Park > > Reviewed-by: Leonard Foerster > > Reviewed-by: Fernand Sieber > > Acked-by: Shakeel Butt Ok that was by mistake. The ACK is for v32.