From patchwork Mon Apr 29 22:44:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13647845 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 37AEBC4345F for ; Mon, 29 Apr 2024 22:45:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EFB1C6B0096; Mon, 29 Apr 2024 18:45:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E83616B0099; Mon, 29 Apr 2024 18:45:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCFA66B009B; Mon, 29 Apr 2024 18:45:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 9A6656B0096 for ; Mon, 29 Apr 2024 18:45:03 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 42E06120452 for ; Mon, 29 Apr 2024 22:45:03 +0000 (UTC) X-FDA: 82064051286.08.4D8DEBF Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf17.hostedemail.com (Postfix) with ESMTP id 469D340004 for ; Mon, 29 Apr 2024 22:45:00 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lOVb+7he; spf=pass (imf17.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=1714430701; 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=SsFSfT6coOLT2VWhr656B0/8phVOmW2YGLApOd5HafA=; b=NVBxiOYkk6qm9QR8W/SAuo24dQqZSWocE8ZzlIPrv5bqIo/xSGVgRONUyrXq4pR2BT4zR7 zchwL5tT6YJHg8AJ/QY0Cwad3I02nsbYmstcL2SbkLPPNRCIiKdXhno27DwIVyaSXCU3MJ nPF15R7vWLtHDzI/EMX0gPe1jADz6hM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714430701; a=rsa-sha256; cv=none; b=kvhn3TgyKa5ol1BbpssnvBHYS2VbvuiBy9Q9Z1xrEJ904sYHqEz2eJWzEz9/lN0vKZggTm p5MbzHYsoqTd76gpCIfB3+BB0McF6xOTwVQSjSWoVfcYGdE2Vs77eSvbPOmOHbytDwZmCR 24/5PFPvxHzukdJTw4Q5VUV9GMwfMik= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lOVb+7he; spf=pass (imf17.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 5A816CE0B41; Mon, 29 Apr 2024 22:44:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 205F9C4AF17; Mon, 29 Apr 2024 22:44:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714430697; bh=mENk5G88cYd3MXH884J6VW2xQ20zMe3RoStwvahKaVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lOVb+7heQ3WwXvk0thHVAc7hGwVjDLKdY428VNMOlvAawCnraFMZ0bP6PGHp99LhZ hvAu47Dmw1GvdyEgaauwyfO6N1mvn5cAfOMnRlhjGrlakozgB3teDCh7qZky88clEn 3bSqWAtgJ5UuXhKIV3wgyZ6ZaOgT93do2h5RpKPP3eFkhxeFFs3AYTYu3RdK6uGcgY Ex7qzWG/3oXzRskceqor3/3YlKh7M6lTHaDwoMLaD7YEIN5LrUFKlR6yZAB7C6DOy3 FK6X8WGP22G23fWyeHJ2nGSg1JoqWGHMnnQ/A6W9pOFHOJ2Gwk3hO3iwqJBK+Ixfhs 9PFN4V67WZj1g== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] mm/damon/paddr: avoid unnecessary page level access check for pageout DAMOS action Date: Mon, 29 Apr 2024 15:44:48 -0700 Message-Id: <20240429224451.67081-2-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240429224451.67081-1-sj@kernel.org> References: <20240429224451.67081-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: oymkh14bqzc38ienrdhhb7jgkx3u5orc X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 469D340004 X-HE-Tag: 1714430700-91920 X-HE-Meta: U2FsdGVkX18pkEhJJpifcgicS+Og4r2yQsP1pEpmUW23cn7kzX7OPWc4GgK5fLME2Y7x5naYeGy/ytNMB6cBO59TsurvjC3DQbTLb7emOZOtz+HORE+I3DTLHALSjp2g0xjbr73a8hfHOQe5euPRYGFppDGyuL9JKGttyFXT0W5gLpm/M4r3A/Bd7PAR/icQ0kmL94ig/pNnYhnzBL1tsBXz0vBff/PeZ5gIW68IZUfgzMMGUGphaCWgZJqrGIuh0y4F2fq0LSbo6v19Z9CPlexdKpNQhigTK2Y3rKbTiNgIMcwkhtyTYZ5YXqu0KZ6UMDkEQo0sYyTuWzUx6U+eQmUiOzhXM4UowUS4KSQVHAYP9bv2fks7p1eIP4oRFNKjub3et8QtmAYIouFCkCGweD/twsNKUUkuvEzZUDudHckNw1I6t0WoZyxC0Y/M9WswfLck2rZYve5KJKgNkxexsAQiRUXa+5nEjltMWP2YPmeQGnUhGpKCX4x93GiXetOS8Dl5bKFfWsXKbYpRO87K5A0RPtzUEwYzmfqpP78Nh5fvIPX8RAK6WUqCPd6TodQblDzDSvrQl/1qMlPzrZDQ2KdlP1XFz28ka4QS4b6R6VQyJ6XzrD4l7+yNGRgvX2dcaXaYdvV5GuLsFMjLN/KcUuVjWkmJf8g4jdNqF9znXHaawfc5ekevfI79fjSYT3AlHvfyIY1LMaoCVxJuEk7tnZBb242L7JSlTvmjw8+xvNs/N4Yu6otfiWMqcMB7dIvpGtX3tcCjcPZtVxzAhpN+zame05kiGE5rMKb4CUMw+UBcFvHPigiF8cr7lg4fDgswd8rI4a1J0m4T0X4b/3SEvC4kMM5RsWHI4jjgXiI8hCc9yjLOWIZuhXIw6CYzSjvnf+neaTL1fdkdWDzqjq4171yuWhiTGlieW4GjVA4ma2skuGGvVw2RxuIwa97RubcEYYIkai2E8XELLqAJxf0 ggvox0r/ P6Jnzkj8DflIBay6xkYnh9KUtOTJgokPI4qGJM4A2DxI5QMKsgKcqHWlzJ54JigxeqwgAwqVuYVClWFhliw/l/0MrVUKdeMoTf0zo8Sqf2PW7o7wZuYWl6B51fTtUxVAnTr40mWNIo0F9otgzZrC1vSt2Gb8n/34B1AtN0qmeFgzhptBJ0jLN1Zm3JUw9XElizOft2uDY6/+9yd66WqjTQCifl2w2d/DrSK2A0NvIi+azi0Q= 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: 'pageout' DAMOS action implementation of 'paddr' asks reclaim_pages() to do the page level access check. User could ask DAMOS to do the page level access check on its own using 'young page' type DAMOS filter. In the case, pageout DAMOS action unnecessarily asks reclaim_pages() to do the check again. Ask the page level access check only if the scheme is not having the filter. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 5685ba485097..d5f2f7ddf863 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -244,6 +244,16 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) { unsigned long addr, applied; LIST_HEAD(folio_list); + bool ignore_references = false; + struct damos_filter *filter; + + /* respect user's page level reference check handling request */ + damos_for_each_filter(filter, s) { + if (filter->type == DAMOS_FILTER_TYPE_YOUNG) { + ignore_references = true; + break; + } + } for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) { struct folio *folio = damon_get_folio(PHYS_PFN(addr)); @@ -265,7 +275,7 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) put_folio: folio_put(folio); } - applied = reclaim_pages(&folio_list, false); + applied = reclaim_pages(&folio_list, ignore_references); cond_resched(); return applied * PAGE_SIZE; }