From patchwork Wed Nov 13 16:26:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13874001 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 A1229D462D3 for ; Wed, 13 Nov 2024 16:26:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 736496B00AF; Wed, 13 Nov 2024 11:26:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E5CF6B00B3; Wed, 13 Nov 2024 11:26:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5859F6B00B4; Wed, 13 Nov 2024 11:26:37 -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 226C16B00AF for ; Wed, 13 Nov 2024 11:26:37 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D323A1C6879 for ; Wed, 13 Nov 2024 16:26:36 +0000 (UTC) X-FDA: 82781599110.18.E4CAC67 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf06.hostedemail.com (Postfix) with ESMTP id 96871180027 for ; Wed, 13 Nov 2024 16:26:04 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rk5i0Kre; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf06.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731515065; a=rsa-sha256; cv=none; b=JoEQc/Szdke3PtqJw38g20GNOBjWmr2wFs4+e8O5TMZyv/O+Oaiwk0tOu3wKseMiz/8pIx Cl+3ELz899J1Q2OeTL8l2IjZyot7pv2nkinWYtIODnYqKxVJOs35HfgbrmZfY1Gt3CAxbR far7as9KoDTliF5vYr2R9iHi3yEZjxE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rk5i0Kre; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf06.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=1731515065; 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=aUS25Ln9Gm2Fa4MIDhefrr1kJGhoBnhlzzNityKKtm8=; b=M2M6jvWVD3pyV7ZbTMZ1y81cGsHG+Va9187AP8y/1YOUsgnES5CNrZXfsMmq2DhrOjpGRs c0VyFavb5k1oLJjmiJW+MWekqQo+GTpfYuzPYxvXzopCZO2GaiRBVhl2YmqAWoDQqKDPAZ BUUIA38fffwuLeibTMhwZ14N2tAK8lg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1A5CE5C5934; Wed, 13 Nov 2024 16:25:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DB50C4CECD; Wed, 13 Nov 2024 16:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731515194; bh=f5G64UqwzMEmnAbYFpT0izlILG/ACPrrbDzbSfum1w0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rk5i0KreF7flYadabrj+EGCJCsLTTGhajaATGds4Av2dLFB0ET5NvC82TjBJvxycS 3F8B3QAS6ZhPWnO9ZPIMKlxRAiDVZD43qKCgcswmHDjsxDUt7FdvPsdRgCCnNF5f0Q nGsxcUiUXI3EBRNq4mGalvtz3KFT4U2fWWmau6RdFhPU87dw0wVaz34G9equ3oi1Xr xEtAoBju34QRz8l6yzGQUtToGKT66VZWojsuE2QRXF0yMMgYeBNeuJX1Q7W44KrNca LKUAIEWOzRsLZxxDEX0rKCfNkJ5cXx8nZ/TRa+cLJTebBn0njV5enL1Bhugdqy8ZlJ wTsUAyssqsUIQ== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: [RFC PATCH 5/5] samples/damon/prcl: implement schemes setup Date: Wed, 13 Nov 2024 08:26:24 -0800 Message-Id: <20241113162624.48973-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241113162624.48973-1-sj@kernel.org> References: <20241113162624.48973-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 96871180027 X-Stat-Signature: qb8ti4wa6ra76kbrkea8n9qr7rttubhd X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1731515164-58730 X-HE-Meta: U2FsdGVkX197EvaNSKuFkT+YHWMtt5EhqCpRHBFgFfsEcAJ88wthYj7CZHVpNcgqgrji8YGY2ugc0FlLZ3QNEaR2yDViq6EjNypOM4hRLaB/et6e1vUvp9ReZPwDSAsWbZug5XiRj4orWW1wjxBkdra+nC0jVR4SdA4/ZVARvWz17HLkBJTdnP6woyXmsOZyIs5kIIG4fajb696trHS+MEqX3kBzaDv58fmKZBkLSky3WD+PV1WlpWMkAWEuSGtchVZJwXGPDW0Oayn6Q+GHML8U1wstTZ3COcKO2OchFR+Yz8TMBATjFDr7z4KmchnoFLjE7WG+Kddg1KQm30YwLcryJ6+KyZEO709qoIdJMyTU5N+WpuFZg3KDlHFiWgzRIiZpD5BjdZ7HpQJr4kxzo81iorYqKPoG3sftjIT9ykfaJMGf/Xqf/9sKmvlMCwCqpmzcdnqV+92WAYWtx3gNngAJ+fEmKB/OnkAbTo104RkxFLALmu+RYPtzKnoz93dN5s9h5JBJguSVPFb/d8Qbm2XHswwj606opq+Il1QCG2D5AVVHdPSAeDcxBcCs6oJeCn0E9WVQJx6TCDX7AHJmp8lZFmH5hwGuPsWsd7eDpFkYXuk15nPLgwGiGQfhYBl0UZYaR/aLKwMH8BQCVC/zmjGuBLXF1rHFlcL7vcWU7Sb36zaeoEKHrhfo1ysT51J8Oy7vo19rrGYDA5Q12f0cDsqDcSw6YlEw55R+n/qaVPUavTRzZrqp0zTPHQUtS5djNUtt/xaGrCnx39svT6NAjBbqJWK0sEHBq00EtfOVjMB+OG/BMf7uKaG7iaE9A+fNpxwNb855IwczDeKVlwr3YM8o0RHHUgV35WZbgK7PutnWmJuQ9uY8RwDT2S2Fwpn0Dcot3cPJ++OPL889sR395kvUCeF1adtYDaiK3U/gBM/o9q3/cDFRGuv+lGn10b0M2dKzse8IaCTz/mIdt0c kqD7d89s dIF4KcuYADmP1cp03D2I4joZW6i12Bhn4ZmZU/q2e4XmWj9OpajFce1jl/nHoVW4U16fnAY5tkBBomcJtXQP/D2H0R5dCRyc92DnGtnG+2uuIbFG4yPWQzf9y/drPwkaziailD5Ss1/Y5CHbNVPHvRNO3LIPWSdbQJsS6xHVi4cYaXMtc1VsLxcs7MT6w7DGyjg4LlVAbN/S7vYfbOLLQIgjL+TST2GUPHoASQtofqS4a2+8= 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: Implement the DAMOS-based cold memory regions proactive reclamation logic. The logic treats memory regions that assumed to not be accessed at all for five or more seconds as cold, and reclaim as soon as found. Signed-off-by: SeongJae Park --- samples/damon/prcl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/samples/damon/prcl.c b/samples/damon/prcl.c index 32ccdd91cf55..cf8c6f29d8a3 100644 --- a/samples/damon/prcl.c +++ b/samples/damon/prcl.c @@ -49,6 +49,7 @@ static int damon_sample_prcl_after_aggregate(struct damon_ctx *c) static int damon_sample_prcl_start(void) { struct damon_target *target; + struct damos *scheme; pr_info("start\n"); @@ -75,6 +76,23 @@ static int damon_sample_prcl_start(void) ctx->callback.after_aggregation = damon_sample_prcl_after_aggregate; + scheme = damon_new_scheme( + &(struct damos_access_pattern) { + .min_sz_region = PAGE_SIZE, + .max_sz_region = ULONG_MAX, + .min_nr_accesses = 0, + .max_nr_accesses = 0}, + DAMOS_PAGEOUT, + 0, + &(struct damos_quota){}, + &(struct damos_watermarks){}, + NUMA_NO_NODE); + if (!scheme) { + damon_destroy_ctx(ctx); + return -ENOMEM; + } + damon_set_schemes(ctx, &scheme, 1); + return damon_start(&ctx, 1, true); }