From patchwork Mon Mar 11 20:45:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13589313 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 737C7C54E66 for ; Mon, 11 Mar 2024 20:46:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3569D6B00F8; Mon, 11 Mar 2024 16:46:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 304636B00FA; Mon, 11 Mar 2024 16:46:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F6046B00F9; Mon, 11 Mar 2024 16:46:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 129226B0122 for ; Mon, 11 Mar 2024 16:46:02 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C8776160A11 for ; Mon, 11 Mar 2024 20:46:01 +0000 (UTC) X-FDA: 81885940122.16.D03A550 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf01.hostedemail.com (Postfix) with ESMTP id 4D0C34000A for ; Mon, 11 Mar 2024 20:46:00 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uQNI7zWP; spf=pass (imf01.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710189960; a=rsa-sha256; cv=none; b=pa5NDxxm7eWtH0pDCQp7EMlxZS013cpa2TEZvumdhGoh8o9+Cz07/c57oB15XV55BoqKAF QKnYvpcfeIqla7D/IAq62tOBNTgzlW86V9NuNbPrG40I1t5YjWP7DFjIi2Z04XSIp06vQn Vl4DMXK1YU1NL0pTLqUq6HdxJUAN2Bw= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uQNI7zWP; spf=pass (imf01.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 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=1710189960; 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=s/UROI7MTVOyLFiZvnAp2lV2WXma072h+i8Hofo4yTy3RmOpY3R1NKiHqPcqUbZFKNfOBk wHR102fx8ejo3169kWRN+YIKlQmh1b9yNeU5n0QrGOfI1oXLtICnquuXdZxZztVj7Dx+QC pGhPgBygz8S/oTSXdbsxcOeO9GP3B38= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 966DA60FB1; Mon, 11 Mar 2024 20:45:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E78B2C43609; Mon, 11 Mar 2024 20:45:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710189959; bh=LO88k+dd/BebwXvUzvdC1iypWVc1Mb6U9juVYlKD5Nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uQNI7zWPftUXcAfchepbgu8pxGBdbSEAdCcgL0ZjBDDyDymzJz0oEGIjl1OL+4pOt vUUdgM/UGEUp+bWCp1PrYYONwHar+psVszUNLtPUFGicKlMIC14alMAomTeoLBXq4d XRX42K0XQUw+pfrz7kvEdLVuEeV3Ro1H5LszW9h9yE52XzWosaYdLX41fQc16Rm/7U 9vWI5p8uNYo+yyJbbQn9XLalmRiILMwr+Y+u9ct79phKv9T9KKMbBHoMZLtdJsYsdX Nm02cMdyHt7eixGAwW9mDAePdrQmDJY0NEfiaDstr/nBbSy7p+j7D6ofARR9C4OLZ9 wEqqUEnKRvp4A== From: SeongJae Park To: Cc: honggyu.kim@sk.com, hyeongtak.ji@sk.com, kernel_team@skhynix.com, SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 3/4] mm/damon: add DAMOS filter type YOUNG Date: Mon, 11 Mar 2024 13:45:44 -0700 Message-Id: <20240311204545.47097-4-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240311204545.47097-1-sj@kernel.org> References: <20240311204545.47097-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4D0C34000A X-Stat-Signature: bg7fgtthbtcxpcrmc3n38yyxuaufijg6 X-Rspam-User: X-HE-Tag: 1710189960-908530 X-HE-Meta: U2FsdGVkX18GySZN19KFBkij6W2fWHZSyTe16c3Zu6WfR65UE6mc07kUpj0mr0eOMCtm2nQqasd6IxXnNrX27mj79dqH1ua38ROFk2AoRUgwUDryMDCHtN/WhFsgf7607jIIWRaW+jk1dT6lKb5WmKuqQcRcD4QJBVsIETJhM5lvfBWI6/5Ux984lB1I+AF7ZCfbg42VqQoUClv/zB+lkgeuro/cj5v39Ec53O8wlLSzOayoNg2lZsFwIHpeaGBu4vt+MkMzL59woczI7HOOvrTUXW5QzPlCgUgc6Rmp+atUTteBJENINUdprOoC6uRhuv++kMEWHQtRnTVaAy1QA+HqjBRfNFD/om3qaytS6i8+nWzEXVza1pPfF3eHLTwviNsZ4sh0u7BxDfHUr/vglwwAycniyaD3SyTDAVEH5TVA84si7xeIpzMUmF1prIi8Fdw87Bb6SJHoKJ3245hrMiTdjVhMZmEFy71o4N0NsCmEgHf00RgallUGTTmtNo8w93BdBDoWT3KV67XKmDuRTRgAN11RwFK7ECiQfjLxAtLS2eTBBYkISaPe329LLrdOp2WVNqufb07sptzvMZjDO/7OgXv9tXawTI5Y2A9+5usL3ZR6th3bUeyCEHM7FxsGmOiTsphBd84iVUrK/eHxvIxOivOJ3prm0Obqvm0zhHSpsGPDXdWjy6XW01LGEfnWzAFIL8ZtWiFtdjSezyEtD51/nZ+n82v3//xLyi00TovohJvzcYP+1nj9fCwyL0LlICr8qJ+NDf7QGB0e6BrBDWMXUtZmPaIWiMhJATJLI9WbuchoMXEiQBee+E5xulwSdPxj5CE4MXijUpyUjxMk+q85VeGHpST/QlCJ1GkmbS9Bzoh8WnfxMOHC7KD1eCVH0sYtX0XL/vn2ij/mKimrAUnCv88t7Wsy9aib/qIxPu8= 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", };