From patchwork Thu Mar 7 03:00:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13584996 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 89A81C54E4A for ; Thu, 7 Mar 2024 03:00:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E5AA26B00E5; Wed, 6 Mar 2024 22:00:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E08C06B00E7; Wed, 6 Mar 2024 22:00:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5C106B00E8; Wed, 6 Mar 2024 22:00:25 -0500 (EST) 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 B6F196B00E5 for ; Wed, 6 Mar 2024 22:00:25 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 89B27A1716 for ; Thu, 7 Mar 2024 03:00:25 +0000 (UTC) X-FDA: 81868739610.04.06C5A86 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf20.hostedemail.com (Postfix) with ESMTP id 7980E1C0009 for ; Thu, 7 Mar 2024 03:00:23 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Xfvl0OYl; spf=pass (imf20.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709780424; 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:in-reply-to:references:references:dkim-signature; bh=KW7k2yEs1IhNFivzAY8dNuVjq4m3njEs7sEi/VP7zyk=; b=zveswa2oii0OXOG/mWUlG6t/1AW/Q01FHoF/HKxPg3P127SJtUAG7weYVYhTlZ+iRqDJoG XauvW28ajPP5mQ7BTAIvQszwJncALavh3NRYt2La5qGkYRDs244AdaJBJyqBaeMViofZ1B Vw00bxUUNZhEj142PiXJHpAuyyeVVgk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709780424; a=rsa-sha256; cv=none; b=vNT4uy1aIukT8hCwpQNPKqieGL5sFct1tFruY1tx23BbXkCS9jpxvEu4Ktb0Z3B9COyR1P qmQunM2Aw2vpjpW5ADRRftYSMT0kuWxXJ1/I3e5T0UwT3ZdpT/Rde7l7k8fg7i41LA7mGq veSPwNK3LHWfG9BwMF4mO3MzLKVPf5s= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Xfvl0OYl; spf=pass (imf20.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 230F8CE23C5; Thu, 7 Mar 2024 03:00:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C52C9C433F1; Thu, 7 Mar 2024 03:00:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709780419; bh=LO88k+dd/BebwXvUzvdC1iypWVc1Mb6U9juVYlKD5Nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xfvl0OYlXalMPZ5OQy3u2by1UcGM63J6lYhw6OnPh5BnjI7XbNx9yehBIe98iibpT mVEKZQGkrZK0nQgcWw/M7VsDKZGgiUz/6W5vvgcZScmUgyu7T75nOC9STn59mm8Bte mJfbJOPDheRHml1ByYZpQbHQdeRj120Sjddcr/1nHUd70BI54sCBVgXEXYJketb0Jt z9IUEX3UDo9GyhOR8XDgyW5k+0gxOUQs29Ld4RSIAngv7MO0XbF7f8apdD49lPDFvA NZyTKlEO/ta8kLgllFMMiE92wUPs0XsSDFR+vGs9TLrlKLcicF3HkPvRcWv7Ffq43e QpdZFfAX9k+5Q== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , honggyu.kim@sk.com, hyeongtak.ji@sk.com, kernel_team@skhynix.com, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/3] mm/damon: add DAMOS filter type YOUNG Date: Wed, 6 Mar 2024 19:00:11 -0800 Message-Id: <20240307030013.47041-2-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240307030013.47041-1-sj@kernel.org> References: <20240307030013.47041-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 7980E1C0009 X-Rspam-User: X-Stat-Signature: dic5bso78joe39m1wxh4n5m4h9p3gq76 X-Rspamd-Server: rspam03 X-HE-Tag: 1709780423-805317 X-HE-Meta: U2FsdGVkX1+dNiVSqZfB05VKj3T+DzVTEv/6484NhogtXhPJroGwzL3yIBPBNX7rl7D1C4AtU3hmQ4SrThJFkHLzkb/S8sbNEgmQ/4zeFIEAjLOvnnipnI0Qdt3kqcZgFq8e/p3Q4yy0Ppnu1c87rFZFXqMwGknaGdQOuwaIWyk3d+nXWoW7TBT/A0EJj5Rm/6L+GUD1zcY9Hr4rYpYraIGJ8fafNWxiISHuVBPIGuh1KWAyGOOX0oMbFCaYkIHFkarmsaW1xC1IWd9ySYtBH3tBQpNHlHZIwhA6LpEtQDaXPl5ahxJT+H6jhtNmCuY1DrB483KPWJyE2+IUsflWEfgfbaES0Ihbey1h+m/C4KuHO9e+c38w4z7M7/6efGGtXNpnEGbHGRpE1lISPj1/jq5je3LTmjMVNBnZCUK1Ce2ea2BdlfjCYDP6qijGk336TIQDJrck+L6s3HTkczx6JTyS5s79XrVSwD9uJujEGPVUjHQehyho2NbG/Z+sRLtf5CoG+JbmZdduPztVe36kNIOZX88W8PVsvpW7ai1J65NUx8A2hDmPzb+UygXlRXabZoLqdjIRxH/owVwfoXAOsrya4oTlxoKQzLkY7btv4s0BZcNhvok4R/P68M/YAsUj41vtDV2j/ApI6GRy2Pl/TvRSU6S4SrTdPTRVZW9GwZ7QiN8TQWubh/zQixr8I/5U2RC3k5Sp42Mln/YN+q60qRnISbniaQgNp3DA7EZlPinkcQvoumzfdEnHJ3CGSlLfoRiBLi6g0HLp4HmbwkfabSuoTnTt3QpnAnMrajhh4vEnpyWObvv5bNepHsnOPmvcyS0DXIB5CIEEaixm+5UJMt8jBKdcDOUeoF3sqtShwh668X8F/rIHH067xZOVDEGSyO63UrCsqI3v6+eaB85z2QY6aCgQ/mna2SpgJEqro8Tj6LxlJ+0kh1KlSZxEWDVML78Q9erZ23ZbEmQB1FI vP6FLR6w xIeEaLtU6mBa9ffd+WB9B2Vzs7otkC8NlWINfvqXixmatdynG7ReLEKM334fF4rcVmTiPjhrLfPa0R77P/JQRrrs9pXmuqN1/qRNLHjouYkCsJu3nbYt5b//mG4AHFC2KxcJoH9Oc488ArSweZd8T2wnaQKKseWOJ6t+ye4M14MFpdpHfiEo0jVgginOYB31THhUxv0uzJjz5vWcv2Dy0AP2CqOVpO+2pPkkNpSJ6IBlhDY4= 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: Define yet another DAMOS filter type, YOUNG. Like anon and memcg, the type of filter will be applied to each page in the memory region, and check if the page is accessed since the last check. Note that this commit is only defining the type. Implementation of it should be made on DAMON operations sets. A couple of commits for the implementation on 'paddr' DAMON operations set will follow. Signed-off-by: SeongJae Park --- include/linux/damon.h | 2 ++ mm/damon/sysfs-schemes.c | 1 + 2 files changed, 3 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index 886d07294f4e..f7da65e1ac04 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -297,6 +297,7 @@ struct damos_stat { * enum damos_filter_type - Type of memory for &struct damos_filter * @DAMOS_FILTER_TYPE_ANON: Anonymous pages. * @DAMOS_FILTER_TYPE_MEMCG: Specific memcg's pages. + * @DAMOS_FILTER_TYPE_YOUNG: Recently accessed pages. * @DAMOS_FILTER_TYPE_ADDR: Address range. * @DAMOS_FILTER_TYPE_TARGET: Data Access Monitoring target. * @NR_DAMOS_FILTER_TYPES: Number of filter types. @@ -315,6 +316,7 @@ struct damos_stat { enum damos_filter_type { DAMOS_FILTER_TYPE_ANON, DAMOS_FILTER_TYPE_MEMCG, + DAMOS_FILTER_TYPE_YOUNG, DAMOS_FILTER_TYPE_ADDR, DAMOS_FILTER_TYPE_TARGET, NR_DAMOS_FILTER_TYPES, diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 53a90ac678fb..bea5bc52846a 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -343,6 +343,7 @@ static struct damon_sysfs_scheme_filter *damon_sysfs_scheme_filter_alloc(void) static const char * const damon_sysfs_scheme_filter_type_strs[] = { "anon", "memcg", + "young", "addr", "target", };