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 BBE2BC56202 for ; Wed, 25 Nov 2020 15:29:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2B2CD2083E for ; Wed, 25 Nov 2020 15:29:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="EtFwDakd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B2CD2083E 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 615F86B0074; Wed, 25 Nov 2020 10:29:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 59F996B0075; Wed, 25 Nov 2020 10:29:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F36D6B0078; Wed, 25 Nov 2020 10:29:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0235.hostedemail.com [216.40.44.235]) by kanga.kvack.org (Postfix) with ESMTP id 2231F6B0074 for ; Wed, 25 Nov 2020 10:29:25 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D394C3620 for ; Wed, 25 Nov 2020 15:29:24 +0000 (UTC) X-FDA: 77523324648.11.legs34_590aaf827377 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id A3CBC180F8B81 for ; Wed, 25 Nov 2020 15:29:24 +0000 (UTC) X-HE-Tag: legs34_590aaf827377 X-Filterd-Recvd-Size: 6316 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Nov 2020 15:29:24 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id a9so3711345lfh.2 for ; Wed, 25 Nov 2020 07:29:23 -0800 (PST) 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=13PkHEsv5Gfsa10yo6xM+865e/X5/3hhggzHTqOXsfY=; b=EtFwDakdU9esaLPfWzzJWQtYC0O8QZ1aEjSYd6jyGyNFsHJbU3dKUmYx/8clc5nygX Kg9cV5BthVrMiwyp4ET9GXGQCSU6jr00bTNUXQelW1NTF92XFBTITcCQ2vKtBk2hlbW0 KFCXPk81RL0a6N6E7YzOef0MyTqMww45RtMIX4nu2KfuzH4/RMa93iWSnzzsuHhVtNYI 1sHg6kX7myPLW4vH8t/EMJaLxl+APqJIm//p6N8TOrsTOeIorJxwFOeDShhnZFTLFhG5 duyLIOrAX7uOWCNDMTPoB49Q67kC8++gGKTMbP+k4uDFOPSRdm0XIIEOg0K87bT+1AoV VUww== 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=13PkHEsv5Gfsa10yo6xM+865e/X5/3hhggzHTqOXsfY=; b=bc8G6Cc4nXdygxARQ+xrTM49lYbUA+hoBG7jHIj5loD3y127cUH3Pcx8orKCHvt2+s P/FCyzErPufa+4LdlQHnHP6lsCyi3E93fX7QB29jIn5Hz8FL3YVlAVJ7MjoL7/xrCTBM 0YaG1Sci/BmZ4TY9hP43BqOsPF2UWVoDHgGtcdve1RWwazFteP4iCr+SLlUBItNhb0dX rajVyN1+s0OG6+ByqTBvCJRVM3gcdZVjTUeJMG/l9039JjLASBp29jAE3o+GiinCNTcT Vn0wQA1FIRx4k42oHknp04PEna59EViky8ohVXO98VjDoBUxCVYczdxWG/Z+yYnRAZKg 0UJw== X-Gm-Message-State: AOAM533bdePcORMr6Kn8WzFue5H1w09DjHRhd5hhoqxWE2C13SFpQjBp na/Csp3Os8Q/1eHV6JFBmnJ/dak+cd/Ln6UN/fKXgQ== X-Google-Smtp-Source: ABdhPJwzuLmEK1UhNY2f2Yzr1gYWBmJ4e3SlnShveEx8r1IdEbiY7y110FD2IyZZ2Nz8RyetMJzXwtu34FltaqP3zKM= X-Received: by 2002:ac2:43cc:: with SMTP id u12mr504816lfl.54.1606318162152; Wed, 25 Nov 2020 07:29:22 -0800 (PST) MIME-Version: 1.0 References: <20201020085940.13875-1-sjpark@amazon.com> <20201020085940.13875-2-sjpark@amazon.com> In-Reply-To: <20201020085940.13875-2-sjpark@amazon.com> From: Shakeel Butt Date: Wed, 25 Nov 2020 07:29:10 -0800 Message-ID: Subject: Re: [PATCH v22 01/18] mm: Introduce Data Access MONitor (DAMON) To: SeongJae Park Cc: Andrew Morton , SeongJae Park , Jonathan.Cameron@huawei.com, Andrea Arcangeli , acme@kernel.org, alexander.shishkin@linux.intel.com, amit@kernel.org, benh@kernel.crashing.org, brendan.d.gregg@gmail.com, Brendan Higgins , Qian Cai , Colin Ian King , Jonathan Corbet , David Hildenbrand , dwmw@amazon.com, Marco Elver , "Du, Fan" , foersleo@amazon.de, Greg Thelen , Ian Rogers , jolsa@redhat.com, "Kirill A. Shutemov" , Mark Rutland , Mel Gorman , Minchan Kim , Ingo Molnar , namhyung@kernel.org, "Peter Zijlstra (Intel)" , Randy Dunlap , Rik van Riel , David Rientjes , Steven Rostedt , Mike Rapoport , sblbir@amazon.com, Shuah Khan , sj38.park@gmail.com, snu@amazon.de, Vlastimil Babka , Vladimir Davydov , Yang Shi , Huang Ying , zgf574564920@gmail.com, linux-damon@amazon.com, Linux MM , linux-doc@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" 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 Tue, Oct 20, 2020 at 2:01 AM SeongJae Park wrote: > > From: SeongJae Park > > DAMON is a data access monitoring framework for the Linux kernel. The > core mechanisms of DAMON make it > > - accurate (the monitoring output is useful enough for DRAM level > performance-centric memory management; It might be inappropriate for > CPU Cache levels, though), > - light-weight (the monitoring overhead is normally low enough to be > applied online), and > - scalable (the upper-bound of the overhead is in constant range > regardless of the size of target workloads). > > Using this framework, hence, we can easily write efficient kernel space > data access monitoring applications. For example, the kernel's memory > management mechanisms can make advanced decisions using this. > Experimental data access aware optimization works that incurring high > access monitoring overhead could implemented again on top of this. > > Due to its simple and flexible interface, providing user space interface > would be also easy. Then, user space users who have some special > workloads can write personalized applications for better understanding > and optimizations of their workloads and systems. > > That said, this commit is implementing only basic data structures and > simple manipulation functions of the structures. The core mechanisms of > DAMON will be implemented by following commits. > > Signed-off-by: SeongJae Park > Reviewed-by: Leonard Foerster > Reviewed-by: Varad Gautam I don't see any benefit of this patch on its own. Some of this should be part of the main damon context patch. I would suggest to separate the core (damon context) from the target related structs (target, region, addr range). Also I would prefer the code be added with the actual usage otherwise it is hard to review. > --- [snip] > +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++; > + > + return nr_regions; > +} Why not keep a count instead of traversing to get the size?