Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1327958rbb; Mon, 26 Feb 2024 06:09:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXA0jJjI/TUkvjU8yYrqEjLwuMEyhg3yEmVUivepu6sE3lsHlq3WTeALToRcVv5wy+Z7v2nRFpqkOiOmrNurEBuE2zvQtQo9+WifTgpjw== X-Google-Smtp-Source: AGHT+IGXkit1I7CwxHeVticnBTAkZV2+7Mk1juAIvr5mX060JqG8/oKiD9+5jP4aVQ54MfSwK9Mz X-Received: by 2002:a0c:b552:0:b0:68f:e779:71fc with SMTP id w18-20020a0cb552000000b0068fe77971fcmr5275882qvd.30.1708956588152; Mon, 26 Feb 2024 06:09:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708956588; cv=pass; d=google.com; s=arc-20160816; b=uecaG6n5cZfKjtudwR/Qt4jLy1OGchV4MD6r4Fo6HA4q8tAiQlaXDrMKxOu6N6TVqN 0TuVq/rEf+BZLZt+6Ltf6n0qo5kZjy/d2qFFP01Rj15wVpPk78uG3yvI9b4Kl6P0xBQg uauUb9Skl+3WOGDmSj9mvBAQx9zTE6qxGniH52R/OtJxpmNreE9t3Hhu5Nr01sA4t8oQ RQ1Cp9Z2ZnjPQr59lba4A90HOC9J/pEc8+gBmse9Jtbmg4q1GYpheBDXglE08gI4kYRx 1CZ19GQELWJNDyPVNVMUBF1XUi7Io41pVm1JoZ1+/sEb/CNr3hKNTdtjjDOEnOxLZvHi 0Uag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Y9OC4YXYFjc+2FMc0Wyr+afdOtmeZZzGlGXJ/Mb/OPk=; fh=egwJU2bb679B4Zi0WdxyKykgfACRkSkUGxyHY52POxM=; b=A6k+naiPQxvX4uXq2pUBjBqm5tbGGSyNdk8YZ9BlJegdxAHUPF1bCP7MFxWZveyoR3 PmPbF5RKGVtXdHt2CqEH1DvTYvZ0SEIoENqkelQ3LtJHHyxWbXsYB9QA/iZO/MxP3vre BUcFPfcp8X9Abb3qp+U/QsaQ+OxGNNek5eg9jt26c+IA48fX3PTATEv3p4KcH6J5rdwI kjga60Ow4kZHq2sNMKIkLbIPL4JI3ygHSwnGSXqmFxcL423+5tyYBhdJGgeEXnBgzu7/ vsGjtHaCP3nINg6P7BI5Hfp3yRPg7SUPYwHHrxNHOSL0oOYH7hK7tjsueRJ9o0PAhAES KxqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-81579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81579-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z22-20020a056214041600b006901a0cf9cesi197607qvx.565.2024.02.26.06.09.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 06:09:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-81579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81579-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E338B1C232EC for ; Mon, 26 Feb 2024 14:09:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3BE412C520; Mon, 26 Feb 2024 14:06:19 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 583CA12A14A; Mon, 26 Feb 2024 14:06:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708956379; cv=none; b=IUGh9nU5qUeOmLHsYRjPdAE01R6O4/PP3nOehDM+/3gj7jLt2ItN+eOQKndGER6eFeHW77N/EMngRlTW84Wau9JX9fPzRErHErkUm4GHxb9x53pvwxBGdpb6Y8nyfXHXYQgI6f1QJih1vXRoDRx5qeBOWbMP0u0a/lExEybsD3U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708956379; c=relaxed/simple; bh=Ig1CU3NKL8/cdJN+rmc1e4GaDBcrnBkfyq6QFF/1g7U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G8/0gnVdoWeg0h9p1ISwsgvd9dgak9cN0Xb2W9lgxjTbt+TcNWFktgr2tp1p4g6i1Kxj1DX13BD/VvODzQH+CkE4euCmUkniVa8zK0P6eYkyuYqmb5tTXYgSoSAbGATefGajivRjKeZKmvWPzH5D0DBIWFf+AwhIJkPnAR1mDIk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d6dff70000001748-5d-65dc9ad5f17d From: Honggyu Kim To: sj@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org Cc: akpm@linux-foundation.org, apopple@nvidia.com, baolin.wang@linux.alibaba.com, dave.jiang@intel.com, honggyu.kim@sk.com, hyeongtak.ji@sk.com, kernel_team@skhynix.com, linmiaohe@huawei.com, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, lizhijian@cn.fujitsu.com, mathieu.desnoyers@efficios.com, mhiramat@kernel.org, rakie.kim@sk.com, rostedt@goodmis.org, surenb@google.com, yangx.jy@fujitsu.com, ying.huang@intel.com, ziy@nvidia.com, 42.hyeyoo@gmail.com Subject: [PATCH v2 1/7] mm/damon: refactor DAMOS_PAGEOUT with migration_mode Date: Mon, 26 Feb 2024 23:05:47 +0900 Message-ID: <20240226140555.1615-2-honggyu.kim@sk.com> X-Mailer: git-send-email 2.43.0.windows.1 In-Reply-To: <20240226140555.1615-1-honggyu.kim@sk.com> References: <20240226140555.1615-1-honggyu.kim@sk.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRmVeSWpSXmKPExsXC9ZZnoe61WXdSDRb+ZbSY2GNgMWf9GjaL XTdCLP7vPcZo8eT/b1aLEzcb2Sw6vy9lsbi8aw6bxb01/1ktjqw/y2Kx7haQtfnsGWaLxcvV LPZ1PGCyOPz1DZPF5EsL2CxeTDnDaHFy1mQWi9lH77E7CHv8PziJ2WPp6TdsHhuagMTOWXfZ PVr23WL3WLCp1KPlyFtWj8V7XjJ5bFrVyeax6dMkdo8TM36zeOx8aOnxYvNMRo/e5ndsHp83 yQXwR3HZpKTmZJalFunbJXBlzGnYwFzQwlsx78catgbGK1xdjJwcEgImEjfmPmXqYuQAsxdv 1QIJswmoSVx5OQksLCLgILHqq0IXIxcHs0ADi8SPz5dYQGqEBXwk1v67wQ5iswioSvzaNB8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aPxN3MH657H6IUYCDUYmH16H2TqoQa2JZcWXuIUYJDmYlEd5wmZupQrwpiZVV qUX58UWlOanFhxilOViUxHm9wlMThATSE0tSs1NTC1KLYLJMHJxSDYxhHAuf6dzr6NtyNJy7 13qtTeBhUWmln4dEykuTjp9kPrPYvdXukZi588M8jvz/Okuuvs5e+U/k4+zt36xcRG4WSjyW j2Gbe+7GhJ35d3/qb7q6TXVr2Mlrj62Yb2bkL4n3/jzrYsN99qW/1PO3W39Rl/abUabYKMh2 /GZw+UrX89m3ys78F+1XYinOSDTUYi4qTgQATejUCbACAAA= X-CFilter-Loop: Reflected This is a preparation patch that introduces migration modes. The damon_pa_pageout is renamed to damon_pa_migrate and it receives an extra argument for migration_mode. No functional changes applied. Signed-off-by: Honggyu Kim --- mm/damon/paddr.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 081e2a325778..277a1c4d833c 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -224,7 +224,12 @@ static bool damos_pa_filter_out(struct damos *scheme, struct folio *folio) return false; } -static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) +enum migration_mode { + MIG_PAGEOUT, +}; + +static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s, + enum migration_mode mm) { unsigned long addr, applied; LIST_HEAD(folio_list); @@ -249,7 +254,14 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) put_folio: folio_put(folio); } - applied = reclaim_pages(&folio_list); + switch (mm) { + case MIG_PAGEOUT: + applied = reclaim_pages(&folio_list); + break; + default: + /* Unexpected migration mode. */ + return 0; + } cond_resched(); return applied * PAGE_SIZE; } @@ -297,7 +309,7 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx, { switch (scheme->action) { case DAMOS_PAGEOUT: - return damon_pa_pageout(r, scheme); + return damon_pa_migrate(r, scheme, MIG_PAGEOUT); case DAMOS_LRU_PRIO: return damon_pa_mark_accessed(r, scheme); case DAMOS_LRU_DEPRIO: -- 2.34.1