Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1665393lqa; Mon, 29 Apr 2024 15:45:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXaiBzXfYKRppVAKDHAkIWdwfQg4di22h61UKHrLhIYyett/fSLSlmP7YUT3wA32hioND5lA0vxj5OeoaIgB1gaGow/KhHsNSPPn4iYPg== X-Google-Smtp-Source: AGHT+IF+YzicP0jPWRHKUss2w8Y7eihN2bEjN8W4WZA2g8wjSbTi1es7uy8QHS+DwNpTofFB1f2i X-Received: by 2002:a05:6a00:21c8:b0:6f0:b67e:dcfb with SMTP id t8-20020a056a0021c800b006f0b67edcfbmr1318558pfj.7.1714430711542; Mon, 29 Apr 2024 15:45:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714430711; cv=pass; d=google.com; s=arc-20160816; b=01vgx1rp2vZ6MSuWzPr/bW0kPqduP3+dAbFJzKHN8w+DODNHdP57oVfJPnHgzztxdN OO7970zb5QICen82jMxH6t99NalF405Wi9zxd1Qfbrns00KDrB85qpY2nkeYcnh0XGeW PY9iB0oSmLy47TU9V4xn6Tm3q5HwTQLArJb/tGA4VrqLrGQvClEt5ymVcaMMagJN8esM 6p0nHkcvnFVUKx487J982GdFSDvxjDeYP1uMF7D67ffx0V/SFfO4S5obGytcGSNHPCfE +R9Dm3sYR8K5mdSxYCMsp67PNtlRfxbMf+FKNIOJoEIKmXilkq2aQ6YNWrpuPmtzEmHu Fq8A== 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:dkim-signature; bh=SsFSfT6coOLT2VWhr656B0/8phVOmW2YGLApOd5HafA=; fh=BzdeVYqZhG5iuwuKJRNLP969rvCput73lx0iwx2zu7A=; b=MpFJOGLIYjN8aujiqqf+RXfqbDpdfq74Vvn2xHZYt8GsyUTvq+LMB1NOL3PGGw7K7L /1fovB83qoUiWCoQRDqzopZ4s+8RDrUPn8Pqc3P8kP3TBJEnk+EYbKwH1b28JzPffZpO juZLVzsArIIPhMNEgVjZFUXlNXylpLK6rNMO4lf3Q4VwD6xVOnudAfLDQP9X8cKv6m/s nfnlWyt0Ok9QBRJ6qHu/Wx/nDKL+7XJP3XypmF1ZMWCl1bhpn5kMHDfIoYgfobfmJquQ nNpya/mLIooMCyzef2zP8nkq76Byv6jlifoITjRSwjpMHd6EQ5JHM6gxBgmbxGwMmhpK Z6nw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lOVb+7he; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-163110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163110-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 84-20020a630057000000b005e438e9677fsi20562429pga.616.2024.04.29.15.45.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 15:45:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lOVb+7he; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-163110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163110-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2D79E282AAE for ; Mon, 29 Apr 2024 22:45:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF1387BB1B; Mon, 29 Apr 2024 22:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lOVb+7he" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E776F2561F; Mon, 29 Apr 2024 22:44:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714430698; cv=none; b=hB+H8CsmXfdKiObRlUcifHJhmv41gFOE3n1uAanFA7Rr31jbHDxvuMM9v1T1DeXg83BfA5ftYuCW3WG8TMVc+0OIPpCQmZMM2iGgjSoFEQUMuy6RyIod799blz6+gmrQ+8LfaL/n8nOpS5u3yZpidmbyiuFdtCwfWZJFxcIGpVQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714430698; c=relaxed/simple; bh=mENk5G88cYd3MXH884J6VW2xQ20zMe3RoStwvahKaVk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ENXXgzRVRvJ2Tpbx+VEJh1TnLpsUIDyTfxTagMfCobS32jTN+rPafo+siuKzJmg2mnpsyvaXo1PdlyBAtGdJRUOD8QwXtHTFFlU3KgpI+uHdbVbhN+NJx07SKbPp8GCnEsHUgHGNIPC5lmLf2js2lRxXkY5ULpfosi0QjhlEta8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lOVb+7he; arc=none smtp.client-ip=10.30.226.201 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit '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; } -- 2.39.2