From patchwork Tue Feb 15 18:45:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12747500 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2DFCC433F5 for ; Tue, 15 Feb 2022 18:46:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 549966B0078; Tue, 15 Feb 2022 13:46:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F9476B007B; Tue, 15 Feb 2022 13:46:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C0B56B007D; Tue, 15 Feb 2022 13:46:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0062.hostedemail.com [216.40.44.62]) by kanga.kvack.org (Postfix) with ESMTP id 2D4936B0078 for ; Tue, 15 Feb 2022 13:46:40 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E47358249980 for ; Tue, 15 Feb 2022 18:46:39 +0000 (UTC) X-FDA: 79145895318.31.48F49FC Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id 4FC4410000F for ; Tue, 15 Feb 2022 18:46:39 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A4D31616C7; Tue, 15 Feb 2022 18:46:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CDABC340EB; Tue, 15 Feb 2022 18:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644950798; bh=IZEEeaeimH1toBqTQkv4T6a9UDa2v1gE60oPYpQOfCo=; h=From:To:Cc:Subject:Date:From; b=QyuLo9dERdzYrBbj+GyH7OMzdQBtKYObQWFuu0yIGrTVQZGnvojlchU9PfjTFZqIm 6QLHzq5icSdtNI8B1b4TvZlacfVHHrtLKP8rdp9MUvl9HaiWkLumqooz5VDw3voK02 uw4xWkFGTq48MM0mX7VnIFI1iqGugV2iH6fsAARlisVyeVC0YlwjhKwjXXCs/VHXKU aucFEQ6ImQKcCJtZlTOc+WO9vcT0uIfjdDOnSG3cgxxMYtUYia9d06HbBpCuCjFAcC MXHYTf5cub6ud2/xshfOIUugeAv1kLa0YW4+OmBd0WnL9eIuPEeLTIxaiQ4Xac5vTM 4pr4H/G/hCwrQ== From: SeongJae Park To: akpm@linux-foundation.org Cc: xhao@linux.alibaba.com, rientjes@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 0/8] Allow DAMON user code independent of monitoring primitives Date: Tue, 15 Feb 2022 18:45:55 +0000 Message-Id: <20220215184603.1479-1-sj@kernel.org> X-Mailer: git-send-email 2.17.1 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4FC4410000F X-Stat-Signature: o8353xnie3bhg9u1qxy8pm3bqpy63qog Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QyuLo9dE; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org X-HE-Tag: 1644950799-208751 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: In-kernel DAMON user code is required to configure the monitoring context (struct damon_ctx) with proper monitoring primitives (struct damon_primitive). This makes the user code dependent to all supporting monitoring primitives. For example, DAMON debugfs interface depends on both DAMON_VADDR and DAMON_PADDR, though some users have interest in only one use case. As more monitoring primitives are introduced, the problem will be bigger. To minimize such unnecessary dependency, this patchset makes monitoring primitives can be registered by the implemnting code and later dynamically searched and selected by the user code. In addition to that, this patchset renames monitoring primitives to monitoring operations, which is more easy to intuitively understand what it means and how it would be structed. SeongJae Park (8): mm/damon: Rename damon_primitives to damon_operations mm/damon: Let monitoring operations can be registered and selected mm/damon/paddr,vaddr: Register themselves to DAMON in subsys_initcall mm/damon/reclaim: Use damon_select_ops() instead of damon_{v,p}a_set_operations() mm/damon/dbgfs: Use damon_select_ops() instead of damon_{v,p}a_set_operations() mm/damon/dbgfs: Use operations id for knowing if the target has pid mm/damon/dbgfs-test: Fix is_target_id() change mm/damon/paddr,vaddr: Remove damon_{p,v}a_{target_valid,set_operations}() include/linux/damon.h | 72 ++++++------ mm/damon/Kconfig | 12 +- mm/damon/Makefile | 4 +- mm/damon/core.c | 131 ++++++++++++++++------ mm/damon/dbgfs-test.h | 4 +- mm/damon/dbgfs.c | 20 +++- mm/damon/{prmtv-common.c => ops-common.c} | 2 +- mm/damon/{prmtv-common.h => ops-common.h} | 0 mm/damon/paddr.c | 36 +++--- mm/damon/reclaim.c | 4 +- mm/damon/vaddr-test.h | 2 +- mm/damon/vaddr.c | 33 +++--- 12 files changed, 209 insertions(+), 111 deletions(-) rename mm/damon/{prmtv-common.c => ops-common.c} (99%) rename mm/damon/{prmtv-common.h => ops-common.h} (100%)