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; } From patchwork Mon Apr 29 22:44:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13647842 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 82137C19F4F for ; Mon, 29 Apr 2024 22:45:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 072D06B0093; Mon, 29 Apr 2024 18:45:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1AC06B0098; Mon, 29 Apr 2024 18:45:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0E496B0095; Mon, 29 Apr 2024 18:45:01 -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 9DE1B6B0093 for ; Mon, 29 Apr 2024 18:45:01 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 14D90802C5 for ; Mon, 29 Apr 2024 22:45:01 +0000 (UTC) X-FDA: 82064051202.03.46D3B99 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 65F9240012 for ; Mon, 29 Apr 2024 22:44:59 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ny6osMgl; spf=pass (imf12.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=1714430699; 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=x/0502E9DYmuYINbipbxBREBkS8UlJDMhTMpwHVSq4A=; b=p27OevGdZaUqGiJttzS+KGfOtveJgb4QFjh5D3Vjvno1BIvnpZjsLPlpPfXi58ifZSiPuV AfBWOysk1flJ70eaBPzjkN09WZIrofoLSXTWsAAi7xgT0MdRRindv+QTop/r7GGeWjvc7v yxknauEOZA2Nev+ZHc9m6Xq4oC1SsSI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714430699; a=rsa-sha256; cv=none; b=Y7sq7jrOcW1e45+k2dBX8VuIUrejUqzsJGZpdn7G31TmBUnkJsjRYBVXi7O+7OJIPfHMF1 iDoWnw3e4GLnAKJDSIyGWDCiizUQzAU0zF2w9P4gwilqSmFDEOuThuviYSgOy+E8IThLhQ Wq+MCIgNBQ1je3Ws+xs5cKmnoWgrr6Q= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ny6osMgl; spf=pass (imf12.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6291861143; Mon, 29 Apr 2024 22:44:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC6FFC4AF1B; 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=1714430698; bh=AH03oSjW6IlmpdP3TkCfshDEgNgfP3nlydglW7MDGsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ny6osMgl45sRK1kTdOdB6auEHpoy9gyum6G8OViYWxx5YHF2tI09BaNYiUiQcM1XE CwsnkaXlQWiDC4fyWrn1I+XwFkdEwvX5dKhuKg/nm+9bdGn0y7PKJAyKCFUuyklO9D dvDeBNzrSWTFQOx08wMh6KdfBsiQbT+oMRUzz0/87a37KlHyp2AjnGZqCxPAsg0LSU NF6ze2KTg100UJ2SoPwg/gpn6iM4fjetutiBmcJ6PYtj9f3UKD3nPGU5Q9DHSrgW74 rFUA74TFGHpHWd8ilXj58w3CIyNERfRMxsz02cOVqB4FhMBaBy9mceOVkTlgZpeCax FjpYOOiaKPSjQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] mm/damon/paddr: do page level access check for pageout DAMOS action on its own Date: Mon, 29 Apr 2024 15:44:49 -0700 Message-Id: <20240429224451.67081-3-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: 5g598fff573rsoeneqayi91wttr8nkrt X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 65F9240012 X-HE-Tag: 1714430699-480922 X-HE-Meta: U2FsdGVkX1/CW5YkOpvNaSoqXBx00HJ5Y1PFrKmc3tFqgKkYMaEl3WOqLcjcO+mNEExP3vtHlFxARk0pFrlDaip/DhxHt6FTvYOyyYJ2kjf6x/ASqrPtsG+AeitJFrpNyMIzSSUJggAMQtV/kPObbo5gzNU3uyX9wV+eFfdxdQY5GdLncOo1/R0kDb6cC1Q3Pq2Ft29HoRwsTTwkrkx9jycZjKgpt+lQVPnFdKJpBK2fPIpdBtx3lEI9mvqOXNbyis+p6AQQGzvuhCobeeRBAbKqEvO7ySjfSBFBwsrxMIsRhCR5x4whPc/NybjIlQ2ZIz/FyqsONbVqXKYBMdZqv2o0PAyIm3Bj9HW4Z8hay8NSrfDRHv7rIFENBLapg25csmCeneakVlZFOwKyF0ivqQw5UMGqXoA5WFS1CUpnao8lklst4e3gHvYbhlmWnQLd9+qnD3lt9mdTrY3k7+coj5+/yHBzLEZ2jrbkr273R419tOqQN9BeK+UKp8h1/ggxDQN1Nrl4mV8Uam/RZEpH3Y89EO+cjnsi39gc9I5J1FAFzKBJk41MIsZyusvqbVSZzETEPzzf0Hl7hbNY9yvIOjVUUiGFLfG3ggbnpK+VBmW71UzwkCwpXq+T7JGFWpniTAWPcbu/ied0heMuuRsdQQvqwPQXx6ejZ289gijeTyxzOY4XVIGfUJlnHvK2eqnQcq5qxrXCrD7RydJU8/Mf5FPca0cP9N8vlRODKzhaRdcuSBcXAC97hD5wCcfAfTt7RLj6S81Ed0TxyYy6QEEFdyxvqy/IyxEfdx7+yPaOCGYm86ZxOunJKZOKbMfB57dSdQ7opkKzEYBRNBhHPRp/1qOGkKgDrSfyYTh+mAIHYFRV2Gjj0NwRRZ3SzsEnTxFQ723SvCiAaKM9jT/5wFqm0aTWIbzElCqXOTMLBiQPAFhJauct7PEj6viUZw7c7Y5i4SEdzw4PCkGl4xeWg8I r9E1m9dL 2iHJ4tILpIM0jFjpSR3k+kJkJYPa+f0TR7ms80dTR8RUlqe4nOXnDGAaN7EWr4eW1G4k2Z0hwSb6Nx8ALTdSlhYBymXd5DVjLE/f7f5aX4jUlsDaPR0KrO0hpKvae6KKjPLwEmbpy2gRzMdUHrVtDodZajpNht1D2wnQzftb2pMjBRrbt3CYNi6zctQ3LzeSPqFBBm+7+iRl3BROC95JKhL2+E6buNRWzlRd5qnXbj1OdJ0KsRhPxYDET+KxP23hacNxQSo5R3Umjpxs= 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' DAMON operations set asks reclaim_pages() to do page level access check if the user is not asking DAMOS to do that on its own. Simplify the logic by making the check always be done by 'paddr'. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index d5f2f7ddf863..974edef1740d 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -244,16 +244,22 @@ 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; + bool install_young_filter = true; struct damos_filter *filter; - /* respect user's page level reference check handling request */ + /* check access in page level again by default */ damos_for_each_filter(filter, s) { if (filter->type == DAMOS_FILTER_TYPE_YOUNG) { - ignore_references = true; + install_young_filter = false; break; } } + if (install_young_filter) { + filter = damos_new_filter(DAMOS_FILTER_TYPE_YOUNG, true); + if (!filter) + return 0; + damos_add_filter(s, filter); + } for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) { struct folio *folio = damon_get_folio(PHYS_PFN(addr)); @@ -275,7 +281,9 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) put_folio: folio_put(folio); } - applied = reclaim_pages(&folio_list, ignore_references); + if (install_young_filter) + damos_destroy_filter(filter); + applied = reclaim_pages(&folio_list, true); cond_resched(); return applied * PAGE_SIZE; } From patchwork Mon Apr 29 22:44:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13647841 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 57BEEC4345F for ; Mon, 29 Apr 2024 22:45:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D48636B0092; Mon, 29 Apr 2024 18:45:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF7F16B0093; Mon, 29 Apr 2024 18:45:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B991B6B0096; Mon, 29 Apr 2024 18:45:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9CFF36B0092 for ; Mon, 29 Apr 2024 18:45:01 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2D8E0A10B7 for ; Mon, 29 Apr 2024 22:45:01 +0000 (UTC) X-FDA: 82064051202.22.12B37C4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id B3310C001D for ; Mon, 29 Apr 2024 22:44:59 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DbJ0bdvv; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.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=1714430699; 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=I0kweNF+ZVAxhTt9RJD9A2Y4xwOlXjmGClkeDC8Y6oQ=; b=O6kcnDfp8JCvjkyt0ax/F7QPkOfk/SeuZYE1UNYBsWgj0jt2PGQsn49XCuRfNkjFNz4ys/ O1FgxcZDOhy1MqwFUX6XFK3hK40JGRuOEl7WwaJJF3Wa+d94aZFLpVcQ9huSXwEFPieU3n 9vhs4JqPAltrHhbWfD2Nw3QQGLl56Zo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714430699; a=rsa-sha256; cv=none; b=Z9lxVQN7dEh/YGihpIEYAJ686Y8YfZ/94tOaIVxvotWsjC9B7Jwde9DKxsCqP/HDtXA9Cp xeS6KavzNu4SiRs+d1ta41TTHpSJzTioznfgWX0Q+tC5JrwT9EUDA2Jw7/gnDXuproqJ3J SNSp68iqBzmOg27fV+b5k5V9oTARWw4= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DbJ0bdvv; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CD76D6115A; Mon, 29 Apr 2024 22:44:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 449E6C4AF1A; Mon, 29 Apr 2024 22:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714430698; bh=rwwV4wTGLuB7cXfIuHMVaw/1/iqBkA9IvJM9bkgx3iA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DbJ0bdvvJr2AhyvwGW00oQOrnMQxpSdiFdku3EzCB5Pf8qz+KnEJFsIAVPLJBn7LI fOmyoYPY5MRuwZBCR4WOPYYORsXzorDi6hZCCTY3ru1Roc99UOGEbt5PTsJSlX/pnH 2redK7kxVZ2sOhiba6ZfAHri7YUTXSUDxn3qDmziId7BKHORNZ9aiMm8QskuSYduu9 MRbV+SnE0GV7XVoDV142dQ3T5d8IXuFLGuaud4T5UEBhwFbJAeAYHQgYOzW23RlSV8 qlmXHL6C1cICKky/VRmu1IKaIVZPSOHqyfco/70bB7Psw5rlpb5iCxgzlWwiBiMrfN cRbHEA0E3zluQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] mm/vmscan: remove ignore_references argument of reclaim_pages() Date: Mon, 29 Apr 2024 15:44:50 -0700 Message-Id: <20240429224451.67081-4-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-Rspamd-Queue-Id: B3310C001D X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: k4jhaac6ndig11xsipeyiwxi5q8e4moi X-HE-Tag: 1714430699-858566 X-HE-Meta: U2FsdGVkX19LI6AsqTU7xJXmLxuejek8bYQhpg59aHDoGK9pK3QTJd9CakAGTuDpbKcoHXAzLbL5vr2aBhqtp3jbDkGm0SHtyFO1r4Niz+24DBYVMRIb3tYvOsR8QJ3eUAWpaaqJ6Myr2Z6Kie6Q5VTregf257ihXitrr2zjmZEBKYbvsuutWoco/MeiqZyqO3V5BseOTqdC/A669P+55EmVmYFhXWqu1YXxoCRPEQmAVkig6CeqFMbLuZG0M733n+YeWHIdg4vfTIVpaxzhcQeFT8F3Vm+eq+cPRLi344nblSw8aE4qTFBHUMOs0s16yc22lO3gzShZR+UBauIlWs2V6BTdoVQ/6LnMfFxYdm/4StpeF4V2VbnV5IsjPkk8As/nHvsDUuhCM0E1pHJ1Xm+/6IM6PVYnInrzgTfwdtT/0cT2tPZ3x+JepeE/YAecWEhfc0CXe9v6WwUOlb3nNUxPqrVs+A4SQWReNDQ1/a0NW8yQm2PPUdhNsIuXPipK79Y283XHQM4v/hkwCB8EzKOriXjBkcbOTl6Lw0NnIUfJqYX+uA4zj3/E1/pqD5bR9BOtl/cXVy0EOdN/5e4QzzvRJEsNTJMu3Yd8XZjXYOYiu/mOMNw7z8DEQNpPJkp6CxKkCkhvkXta+nQEYQLNcyNBUkDE6fkdPehcvIiOlYN5vcqC8Gl2TZfkWbI3qPHvFrRTDHNg0mjkDmYX3vTk0zTHGWLovXNHHBYZ4p1nD22m39UMhb8aw/cAs36oFOhPYoTLJzalgX0yBJluCSSagD7TCrpFa4vpMgOr8RrLK+my7TkoHhlAR+ZVOauWwJIoaG6vv3gkLH0EsvDow3h73El2mIj6GSve2HKl6yXaCD6cjB+yHGn4hYl3/+LHHmRazdeLKpgPKmANJSlZ+bel5HPXaX1ymDiGaVwWRuO9PHLgQ1kYb4OZw4AsuREH4BM6z74OHIVDfm/s+lRnvIT NV59xB8y OhYvm 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: All reclaim_pages() callers are setting 'ignore_references' parameter 'true'. In other words, the parameter is not really being used. Remove the argument to make it simple. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 2 +- mm/internal.h | 2 +- mm/madvise.c | 4 ++-- mm/vmscan.c | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 974edef1740d..18797c1b419b 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -283,7 +283,7 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) } if (install_young_filter) damos_destroy_filter(filter); - applied = reclaim_pages(&folio_list, true); + applied = reclaim_pages(&folio_list); cond_resched(); return applied * PAGE_SIZE; } diff --git a/mm/internal.h b/mm/internal.h index c5552d35d995..b2c75b12014e 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1052,7 +1052,7 @@ extern unsigned long __must_check vm_mmap_pgoff(struct file *, unsigned long, unsigned long, unsigned long); extern void set_pageblock_order(void); -unsigned long reclaim_pages(struct list_head *folio_list, bool ignore_references); +unsigned long reclaim_pages(struct list_head *folio_list); unsigned int reclaim_clean_pages_from_list(struct zone *zone, struct list_head *folio_list); /* The ALLOC_WMARK bits are used as an index to zone->watermark */ diff --git a/mm/madvise.c b/mm/madvise.c index c49fef453491..a77893462b92 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -423,7 +423,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, huge_unlock: spin_unlock(ptl); if (pageout) - reclaim_pages(&folio_list, true); + reclaim_pages(&folio_list); return 0; } @@ -547,7 +547,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, pte_unmap_unlock(start_pte, ptl); } if (pageout) - reclaim_pages(&folio_list, true); + reclaim_pages(&folio_list); cond_resched(); return 0; diff --git a/mm/vmscan.c b/mm/vmscan.c index 49bd94423961..fc9dd9a24739 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2150,7 +2150,7 @@ static unsigned int reclaim_folio_list(struct list_head *folio_list, return nr_reclaimed; } -unsigned long reclaim_pages(struct list_head *folio_list, bool ignore_references) +unsigned long reclaim_pages(struct list_head *folio_list) { int nid; unsigned int nr_reclaimed = 0; @@ -2173,11 +2173,11 @@ unsigned long reclaim_pages(struct list_head *folio_list, bool ignore_references } nr_reclaimed += reclaim_folio_list(&node_folio_list, NODE_DATA(nid), - ignore_references); + true); nid = folio_nid(lru_to_folio(folio_list)); } while (!list_empty(folio_list)); - nr_reclaimed += reclaim_folio_list(&node_folio_list, NODE_DATA(nid), ignore_references); + nr_reclaimed += reclaim_folio_list(&node_folio_list, NODE_DATA(nid), true); memalloc_noreclaim_restore(noreclaim_flag); From patchwork Mon Apr 29 22:44:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13647843 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 8EF65C4345F for ; Mon, 29 Apr 2024 22:45:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57F906B0095; Mon, 29 Apr 2024 18:45:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 52FBD6B0096; Mon, 29 Apr 2024 18:45:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F8366B0098; Mon, 29 Apr 2024 18:45:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1A2966B0095 for ; Mon, 29 Apr 2024 18:45:02 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C161F140341 for ; Mon, 29 Apr 2024 22:45:01 +0000 (UTC) X-FDA: 82064051202.24.F3CFC2F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf08.hostedemail.com (Postfix) with ESMTP id 30B12160014 for ; Mon, 29 Apr 2024 22:44:59 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=JTjkOLRZ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf08.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=1714430700; 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=5n2rrgpLyVIJX1+QKss1cT1kREjQbq7BJIeXYE8zFfA=; b=OrQHRB8j3N9RnXys/OrAlQ98NT7FW9Nxy/tGfSmOSU5wWTN4AvbiLs95NAJuaohSagzE3m /iQziYZaIh08GcIEtLNpDV2Yv4d1ki8y3ssDafdov7AoPdBG1+KzKgrlbHFQKyoAxoh/KX TP5jjFkekugFp0GwdlnxDKjcjOmjqRU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=JTjkOLRZ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf08.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=1714430700; a=rsa-sha256; cv=none; b=WR7BrJiUp1Gj4Nm2WxLy35fWWvVXMPWgYZJ4ZVtByWksYOOjI/BrDhgrhw4aitnVnmJpid NwrEONteV82QVWj9nJ0Q8QJ5t0GCQBuFJTLC2i6FpiHlh1CqHHepv0b1SP5OQhJvvJHYSv XK8Wt/WOQ8vYR6RFkLtQ8fK7E/W4Nuk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5771261176; Mon, 29 Apr 2024 22:44:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D15BBC4AF1D; Mon, 29 Apr 2024 22:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714430699; bh=c5R6Q+jjynMcjdwz6qj4TecKkTHs1L5RszRXGVX69qM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JTjkOLRZE9RqeCYWNPbhtB3eMRNA1PWdYKagaygW3idDe5DF9DoUFJlKXawa1JTc7 FXrLTXWf1G5A4F6yyy7KeJSlzNz4sRCP3ri+aXxImbHD7+fxJ4QULrRGovvhbbB22y IoPHoE8GkyPAIekuzdETf1v6rweXYfpDa3g2ZtsDelCZCaWUQcZp9CzEPa9ZEEjIQ8 VARWTl2bWuYKJiHNVmIEnZwE2T0i2038cRvt7hIAQDIajci0r/UACkxR5HE5IAguPz GDxxFNCaFeHaJNGWszvbnwZN2khwABDsWrqnAZT4K+bOf98Vbw9C/VQiIcHNHeKgwQ Dg/OtCgjYSG2Q== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] mm/vmscan: remove ignore_references argument of reclaim_folio_list() Date: Mon, 29 Apr 2024 15:44:51 -0700 Message-Id: <20240429224451.67081-5-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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 30B12160014 X-Stat-Signature: kyys414jgu59tkteytmjnrm5eascn4fh X-Rspam-User: X-HE-Tag: 1714430699-271308 X-HE-Meta: U2FsdGVkX1+HS3v7L26h1LhJg+vWs6EtRFePU4TxIPCILKpPLCda+PWqavdbiFyUjGGoPLosSjIGaxVASItSAgaSn1Hf5AtO6hHaFBXPBqskX1z1RrNsT6EU7CGlE/Ce6lXVeuI4il+vksAngLxUvJCmRCWUZCvYAUE0nc53f4FeKcREraI4CSXZ8X/h8de+RRxrlMloAoYJB+UPjzJ30EqWZSWW9+GMYlpeJtU/GBskpn5dSMRLIg23Hw4cwC8TiwsrBAj1RHQGG54StZY8xS9neDOzsvT+FPBZN1XauhBO605I/WyyW/gs84nzKUZLdXHxFlcKHfRbmejX6ODrnpqZoxn/DeWcRefpGgeinudeFACMCldjKa3vjOvD3UZ0nPhBp6wSRaChVQWaFIMTSuGS+HAilSTZPEZLwCG4jLLt2LdTzKrgUTEO4LUSpbwvwqwlq3X4hC4nUbaK40X3YG2lVFWIP8Y0PtkRIAn/hWghdA8LtMzft89lpkxf6AtVwvMsxqyIw2aSvGfO21eD1J51CcxV3WaJjUzyqQKZMwdrZJC6Lf4pJrxgG2Vbiamh3Yc9BIwLd+vOcx6Sg1cetT8cw1pq278LdcHZvNBEWK0VyU0TlV1xnJnuq2u7QRfXgpyBDIfp59XsloKRK73H/soCb0b6U6MC8atERDGo93wb7R0sQVvQNTTXj3oBLL4iBklr2vC6duEkRKQR5WmsLMlqLAVWB7NC9smN6oGftTjiS0TxQX/dXqRyUHAOb+mA/Qh28hFXPIIhKsNLc3kU+AeeM8VUyxSeOpGOk1zcJWC64WVLRbCVku5e44t3Ahk7XqxbwA81R0fKtgqbpbEVbcWzRaDmzgxu5t4xOTz7xiG0uBLAKl4ngBVZFgvHiureJJbwnljELvBf307cgVNbw7A9z29prnGUB2OQ/hfqWDr3B/RbNQynMqEYXBRQVM/zXUebtasnppztPWhc3fN 3sNm/b41 zYFenjbe5VMOvA9OEvEGHxwQCD/dSnyHU7255WH6gPTQYlOR7jowEdjmYZfBh+jw0cwBBjc7De0vSnwHetclPPG08U+JYb9qQP9XRWnqJh3Uz6EOO00RPsw3lVFkSz9ympr4bCeYc/vlotyvAHvvwdqe1inRgVleGhHNn6MJDasAte66DoGWJuyxMYjpdPNADbRwexRhj66u5dM0CkZXjGxoTvfdYN326hfaraTeBn9IJcj5g4WkYFdA3YPNi6bT9Rzigb0DZr9CNIRa/ucPdaR5J6thmj5ob6+pr 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: All reclaim_folio_list() callers are passing 'true' for 'ignore_references' parameter. In other words, the parameter is not really being used. Simplify the code by removing the parameter. Signed-off-by: SeongJae Park --- mm/vmscan.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index fc9dd9a24739..6981a71c8ef0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2126,8 +2126,7 @@ static void shrink_active_list(unsigned long nr_to_scan, } static unsigned int reclaim_folio_list(struct list_head *folio_list, - struct pglist_data *pgdat, - bool ignore_references) + struct pglist_data *pgdat) { struct reclaim_stat dummy_stat; unsigned int nr_reclaimed; @@ -2140,7 +2139,7 @@ static unsigned int reclaim_folio_list(struct list_head *folio_list, .no_demotion = 1, }; - nr_reclaimed = shrink_folio_list(folio_list, pgdat, &sc, &dummy_stat, ignore_references); + nr_reclaimed = shrink_folio_list(folio_list, pgdat, &sc, &dummy_stat, true); while (!list_empty(folio_list)) { folio = lru_to_folio(folio_list); list_del(&folio->lru); @@ -2172,12 +2171,11 @@ unsigned long reclaim_pages(struct list_head *folio_list) continue; } - nr_reclaimed += reclaim_folio_list(&node_folio_list, NODE_DATA(nid), - true); + nr_reclaimed += reclaim_folio_list(&node_folio_list, NODE_DATA(nid)); nid = folio_nid(lru_to_folio(folio_list)); } while (!list_empty(folio_list)); - nr_reclaimed += reclaim_folio_list(&node_folio_list, NODE_DATA(nid), true); + nr_reclaimed += reclaim_folio_list(&node_folio_list, NODE_DATA(nid)); memalloc_noreclaim_restore(noreclaim_flag);