From patchwork Wed Apr 16 04:25:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 14053144 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 E7ABDC369BA for ; Wed, 16 Apr 2025 04:26:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D35C6B020F; Wed, 16 Apr 2025 00:25:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 481636B0246; Wed, 16 Apr 2025 00:25:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 371BE6B0248; Wed, 16 Apr 2025 00:25:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1A18C6B020F for ; Wed, 16 Apr 2025 00:25:58 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 83EB581AA4 for ; Wed, 16 Apr 2025 04:25:59 +0000 (UTC) X-FDA: 83338619238.30.CA03F89 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id EBDC080008 for ; Wed, 16 Apr 2025 04:25:57 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=peMo47u0; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744777558; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=f6SFZYVvh/lwAhPwxi7IAKiCwhHDzBi7Ah9GiJoDIdA=; b=8VNET58eJZFFRDPZfI6YwTbztTLVEQ8fmtxg9SGe8aXYBC5bs8Ndm8SYt/LQBJBJ9Ey2QF VuabdfyzJWO8fxlBGMKzCXrSab6RuBIqe9FNFl43AYYfssmiEV4L+bewdGfsaT2zxX704K li0c25Uik3mOkhalAniudqFzfJAAhxc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744777558; a=rsa-sha256; cv=none; b=SiXn/cCu0Fn6+MS4Auxkjzj9R8hzkKZPLenLvX91sQOi0QWvYzOVbbQqb3nB9kXcmDy9AX ipXuYGXo8fimarI6+wmD/5V/xHbtmlDTh1vWQR0JNh7W2H/fgJvjQXC7lA6lYtwNNumOAO +RCKnYdZtmEliMbw83DSkJhRqQweLM0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=peMo47u0; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E03515C440B; Wed, 16 Apr 2025 04:23:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3643FC4CEE2; Wed, 16 Apr 2025 04:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744777556; bh=mYG/+R348tZd+dJ2HFrDs46wncUZ9D5vvhSOn3amrJw=; h=From:To:Cc:Subject:Date:From; b=peMo47u0ongXhI2+Hi541Qw7tSxccSBkOVAeh67fLXCVzr/iNluYMxIZGJz/iVFCu Si+QN4paJgvp/bEYcGiq7N/ceZFKuCL0DACO1UgSgoHl/NkJZBjGJw12tiq4IgJKMS IUg+1kt1lSRocJ4lyuuNTSeNiAMb80bVpLWHWxgF1Qbclp555WZyrF5ts/nxiGxkGR eudUeXvyRSnCXf+pF/8j2iF2yrB71Vhqq8DDxZFpuba0Vt3VAc013AkEAvZwAaITqQ sgW1GuPN3P0rcou8PF3Sph83uqR4IvU2f9SIa/Me6wXIenq+qg6p4YwykWYcIlXMcW t5RjkSfNoV6hQ== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , Ze Zuo , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 00/10] mm/damon: support address space larger than damon-core address space Date: Tue, 15 Apr 2025 21:25:41 -0700 Message-Id: <20250416042551.158131-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: EBDC080008 X-Rspam-User: X-Stat-Signature: xicho7cqnaixs3rp7pk11nsxoq415fo9 X-HE-Tag: 1744777557-585419 X-HE-Meta: U2FsdGVkX19DQmqt4Tmytt66UWj1PLbuz1PS8t5A1xg98FbYSHwS1DzEnHed21mM3ViLDsrnPPjrkv/UUqkGaeb+TEWnt05+KxPRSxGs/avQWokevJusYKasKxo1O1pTqB/ounfBvlUAHmBgHbhQKT0fRMZQDxvHcGTS5rerrtgdw9Aobts9WPYAv7zj0eqxEJS7qNzivwONdV/EgsTbnFaGvt+zQPYRsAitocUJvsR0l4Zz0JQYkEsnLl3aUYlMffxWA3gu90H6n7iUG5e7+DGkv8meiEkKDCNksjmIP0RXbfqK89sPNdYDPOWzyhUDM4oGcNtaWrir5XsceHlGzAns4GN/lCQbLO7HJRlm4s6ypruAkr3rD7IcbQ7R85zzQk5Y5ooXy3gB0r3dQAtQ+pKCOFOhE3bKaDVMmdVBVMJRzEn6wygJRj1dMdLuuDaUQqT0brIxfo5PbGmhvZP8ShRO6wnV9BArpF3S6uRnVhWLm+mhZnwh3UBPTEj0BxxlaDHiv+SDVtR6tMhPL99rKm5iKfSEKvXLoQ5IBiqcU5AbR8rliF5DRy4rYPoSX/pCJMCNT5fvXNFChRnoIa9FQdIozOWpfQJJdFdlSCZp8+sWPel4LfljUyQk739nBjBX6pIJgFWMFbLBBFyJTBm0jKn74oc6EN++yB1LNfi8f9kp8LaYbQkaEa8yoM1J61gC22lQ3eNpBm1SShwODdGsc393/ZlVCd/BB8DXaKfORTJfWB+oQ6edNc7MHcyHVCBQuqr1ZxPjqonvCAcKxhxnSWIT+kJtPGpV//kX8a9i9FaEkDiYvIRbWBHEgegNt80Srx1zcRXV92KBIiXGs9N7C8EcEod4NQJArXUdJtiHvmfS1EzeeFdhG+Feuj6B6Vaut1ODw9vWfbhgCShE46nq+PT80BsKA2ycDPW+V0mGhur6y5wo+i4LWkgeASVN8t5/aFtrNpZRyl/CPxZT6Ju GTV1gxpo 22OUJ/G6gd7dKFzMPwrbro/5NHSU0gvhM5FPgIhbhLTLYOp0WD568ANxdLGAF5cPwkVic3ctvmvYkESCx/X1fugBZacEmGLw0MgumZZIlDM7zbtEPXhwV0yq0brGgHehTExeKX0Sd80eHl8qhASr4ix3slHE+oqSN75LXqrNL/ZQZE9QHgJ7ViTrqejKQMHqwfhCq1id51TLgYgnONiq1ttS9+DtooyhJ9Q76GsKS6lJ4jQ4k1IGRw++9ZhlD5di5ZRM5 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: List-Subscribe: List-Unsubscribe: DAMON core layer has its own address space that uses 'unsigned long' for handling addresses. The underlying DAMON operations set implementation translates the core layer address to the real address space that it is working for. For example, vaddr and fvaddr translates the core layer addresses to virtual addresses. However, all operations set layer simply assumes the core layer address will be same to those for the given address space. Since the core layer address uses 'unsigned long', it is ok for virtual addresses. In case of physical address space, however, there can be some cases where 'unsigned long' cannot handle whole address. For example, 32bit arm machines with large physical address extension (LPAE) is such a case[1]. Arm with LPAE is the only reported use case, but similar cases could happen in future. Add a new core layer parameter called 'addr_unit'. Operations set layer can translate a core layer address to the real address by multiplying the parameter value to the core layer address. Support of the parameter is up to each operations layer implementation, though. For example, operations set implementations for virtual address space can simply ignore the parameter. Add the support on paddr, which is the DAMON operations set implementation for the physical address space, as we have a clear use case for that. Patches Sequence ================ The first patch implements the new parameter on DAMON kernel API. Following five patches (patch 2-6) incrementally add support of the new parameter on paddr operations set, for monitoring operations and DAMOS operations for each DAMOS actions. The seventh patch implements DAMON sysfs ABI for letting users control the parameter. Final three patches (patches 8-10) documents the new ABI on design, usage, and ABI documents, respectively. [1] https://lore.kernel.org/20250408075553.959388-1-zuoze1@huawei.com SeongJae Park (10): mm/damon/core: add damon_ctx->addr_unit mm/damon/paddr: support addr_unit for access monitoring mm/damon/paddr: support addr_unit for DAMOS_PAGEOUT mm/damon/paddr: support addr_unit for DAMOS_LRU_[DE]PRIO mm/damon/paddr: support addr_unit for MIGRATE_{HOT,COLD} mm/damon/paddr: support addr_unit for DAMOS_STAT mm/damon/sysfs: implement addr_unit file under context dir Docs/mm/damon/design: document 'address unit' parameter Docs/admin-guide/mm/damon/usage: document addr_unit file Docs/ABI/damon: document addr_unit file .../ABI/testing/sysfs-kernel-mm-damon | 7 ++ Documentation/admin-guide/mm/damon/usage.rst | 11 ++- Documentation/mm/damon/design.rst | 16 +++- include/linux/damon.h | 2 + mm/damon/core.c | 3 + mm/damon/paddr.c | 95 ++++++++++++------- mm/damon/sysfs.c | 26 +++++ 7 files changed, 119 insertions(+), 41 deletions(-) base-commit: b32e0b4ccfbe176a541e7feee0cdaebb957738e7