From patchwork Fri Apr 26 19:52:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13645328 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 EC8C8C4345F for ; Fri, 26 Apr 2024 19:53:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 641B36B0099; Fri, 26 Apr 2024 15:53:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 557726B009A; Fri, 26 Apr 2024 15:53:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F7966B009B; Fri, 26 Apr 2024 15:53:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1E8B66B0099 for ; Fri, 26 Apr 2024 15:53:08 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9D80FA08C8 for ; Fri, 26 Apr 2024 19:53:07 +0000 (UTC) X-FDA: 82052731614.24.EDCAB74 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf20.hostedemail.com (Postfix) with ESMTP id 9739E1C0005 for ; Fri, 26 Apr 2024 19:53:05 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RHJRU25s; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf20.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 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=1714161186; 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=Ax0ak193mfRPLEDaHOaEMRjbpwwWvp6smyg8+qCmr/A=; b=UZMDiWbkui69PUTinHUYJQA1A5RDsbiuE79P+b21wa46x+wC35IMWKT71wCXTrdmysZCdQ Ri5LyWQBGOTU63KmwIMzF1LvkWPUgwjk7BNOz7meI0d7kmiJKtGnctALmlAxYl1+IzHzw8 ICUpNnb93Qsg4U0RMVnkGvwO9WR++cA= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RHJRU25s; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf20.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714161186; a=rsa-sha256; cv=none; b=dev/vC8HqFjxaJyZ3RdDfi/U6QsuruHyz6kDm2cUc7OJY4d3O7OfqAgDOUF9XPfjlM0C6A anYKRY7KCkNxI5AXKoUf2gwKVsWv7+IWLSwezpR7N4zCdOUmlopfnFoLuv1TItklA69Szl YvYBBm7T7H7nHoxzNxmIZyYXpDP+7+o= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 08100CE1D0E; Fri, 26 Apr 2024 19:53:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA417C32782; Fri, 26 Apr 2024 19:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714161182; bh=46Ldc4399x5vGxfdUW5g3TDQSnO265hzzOnyBh65g88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RHJRU25sNcZ3kflmc9l32q9W9O5dkcFuYIFx4htbsFTTzuLcIKoq9OYjbHSgGAoxN wBr7lR9mubXiLcmQPxKdxlvdKtYeIYiPQ7w48zCP0wR2rlG9ASPxuxwMIucHe+55b+ PwKyiWbJnIBFXfDxrmCkwgTTKrd1pSIv/QPS29wLCzkg20hJXH6VeSafdXfQ7AD30s rAEh9hr00Eso94b+xhsEI0G0OE8QVQmM59lL2AvNN9bdQJlGnTWcKsVnLcWnbjGBpA SmA35yWD0jqw4y4ByPWOtykdRf1ZPqrAfDlIs3DlgjtwHhAVkseI7H82QAVJ9/txXc y0gQttRPRGmbw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Honggyu Kim Subject: [PATCH 3/7] mm/damon: add DAMOS filter type YOUNG Date: Fri, 26 Apr 2024 12:52:42 -0700 Message-Id: <20240426195247.100306-4-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240426195247.100306-1-sj@kernel.org> References: <20240426195247.100306-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9739E1C0005 X-Stat-Signature: ri81z1fyx35bpz7sbn8zmmwf5iduqoot X-Rspam-User: X-HE-Tag: 1714161185-867416 X-HE-Meta: U2FsdGVkX19SlWNo9eqSZKErm+vbzuYcm8EuxqBGACJyRMWf5pOzDZS1/f68gXlT2KyQzI6BCGrYZRBHsq4NSZWvCd+wfL6raIQUYsWszYKpUeQ/wZFHJcUWILpUO8M5oDSfQUhQ1FDr1M2YTHsOKxCcOojYyFogCKRJYk/NLP0kauLXXhdOshBZSp1MQ+VljDGxkgnp03VSGtqTK1zrDjpH3Y/jjoT6XNNdaYH+/8kyaFXRgtdnsOoG2okEWIo0KIFopa44CEstv9tIEiJMBnLI43/Vrgl2ktZ80B9VPyUnEnPq4SQFxjhYmd9OQq3Z6GYJ4TWyIxJKyaAEfMGfSZfplgJ8AxH5mU699VEShPqel2/GpE6cIMrnr7rmRL7JE9R8nlCPkGN/zP9jDGkvG38knmhZ7Mp+gGq5bYiA+GbOibN/o5uQYDNa8ahY8PANt6CcTcK1/B8alyjYlesyLCG2BsjRXgFusj3yE5/dWnssOof8AYtfEarSQg97toLxGXbgXaUVpTU2XmU1fiFfxlQzmaPBYPCEoCTQR2tyccU/Gqx+UPsfSXvfdBYiMp+iETnRKK1ehNkBAo/2eqqhoifXGv5cAqA/4kfBNnBL4SvHtI3fjuLjJ6RxEdwZsDy9u1M//FiTiCUNZF+4DevF/2+vXQpX1RnHgJ/QaqOY2GdrSbf62a0QJvmWrNL/E8EOnzjQpexuVHygm+armMUwworbK436PcEFjoMw7CE++0aZyJqeRn7zhav7rxTsNqwilstGQVsO7Nb9Ib2jNyGBuTlupYAK7YpDyI0wO03glTvN1AVyx6SxiRQ2WKD8Hr3GB9YCotq96MD63swh3owpELZDgu35cNr9/VSCnmLPFFNAwQHNf15MzYW0Nni/htuZw9t5BANRtVr95xVWE+6BYt6ZlJYN3Sr2PnnKKsvh0IFuw9CXbkU7+ByyC+KWUBJONWvihRI55HgMsm3GhBc 2GuvpEgE r/AyMKO+dYT5WklFKvPQOWyqo92cLGHsd0ybdZdkeuNBw/BQNp8+5PIFC513s7ImOvOeizRFhq0V8l+OQ+yJ6UonPOdguxKZhfknXh9y6TDZrOZ0YJ9PSoxsoNuQJTvV4kndEXSs9Ya+xJ04CBSA5dtXdPIlQPlkwagJaPxdQRvlM7iKTc4Byf8BgVlX4tO6/Cbb4tqQu5CDh6XUSmHEaF9R0pdcfTJPm1H2eeVfQjuuV+YN3h4jM/zeSbzi8cjxFKv8PaBdwOjbIhUK/IoT5XAq7ZSDgoJaQCjbub8rMjgPRDSA= 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 see if the page is accessed since the last check. Based on the 'matching' parameter, the page is filtered out or in. Note that this commit is adding only the type definition. The implementation should be made by DAMON operations sets. A commit for the implementation on 'paddr' DAMON operations set will follow. Signed-off-by: SeongJae Park Tested-by: Honggyu Kim --- 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 886d07294f4e7..f7da65e1ac041 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 53a90ac678fb9..bea5bc52846a6 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", };