From patchwork Mon Jan 9 21:33:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13094372 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 C3F02C5479D for ; Mon, 9 Jan 2023 21:33:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3B7B900006; Mon, 9 Jan 2023 16:33:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BEB8B900004; Mon, 9 Jan 2023 16:33:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8B3D900006; Mon, 9 Jan 2023 16:33:54 -0500 (EST) 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 976F3900004 for ; Mon, 9 Jan 2023 16:33:54 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3F327AB4E5 for ; Mon, 9 Jan 2023 21:33:51 +0000 (UTC) X-FDA: 80336563062.11.FBC1A63 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id C06DD8000F for ; Mon, 9 Jan 2023 21:33:49 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Q25whl2K; spf=pass (imf30.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=1673300029; 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=Gp9jxI98TdehfVr+BQlKXHYvyV+gppw6/OlU3NW3LPk=; b=TFYcmEcfoouWuwCc04ehzqLhhoKQr31Ils7eM3t7/jBnrkDEyo+T1qzzhWkagIeMkpNKwq Hp9Xz6qwBPWoUG0MROp8tD0C8+MDQUA0lmpcOU9P4lT+3rtBPc10qcS57TXNzBhBvFUKbj v76cd6clbHYw7irApaik30tVaEOpTj0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Q25whl2K; spf=pass (imf30.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673300029; a=rsa-sha256; cv=none; b=fNMbVK6OyygG2BCHQEOMbkcmlfFhAp5blf4BtgNp3BOMjuSWtGXohBzOkwpfrEYofHY7Er q/zdKn43tctWyFAqhfJflIml7l1upOaUZVoD5dFiVe8zryOLqCujKQkw+Jx4x2hq04cdEH PYaqD9VJjuhZ8xMtDrff6kRaDWyllWo= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F0B5061359; Mon, 9 Jan 2023 21:33:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 673A3C433D2; Mon, 9 Jan 2023 21:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673300028; bh=SYYr0BTjmOo642m5NR3wSprE6Rj/MW96ULPD1Kbq3N4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q25whl2K6ubCd0mSRCAhV2abNV6arYJzypS9C6dgW1BHriuFbw8yu2UNtObHkGoo5 gFh4wNew0WdzD5BDISr8G2JEaOWrmiWYJgLs/1Aqt8Nz50eVSW7uGSGy/N+9aXgEi4 6zW0OwgSDQ7zGALkkf3vCQx5muQaAmlvxH4ry1T+cYP8sS7SXLaxvgSoXehUok9YU0 UQsVBtCxtIJUszstXt735cqzC5YQJtPCO95WNtN0kf2zXGXXExj0kBoBkwAYFQPXDs AjPDe8OGaczVaic7Pcma+e9e/jShrhySjFSw1EUGzgUl5hJ7PZczmNBCXnoEIgfmFe 2+MH0CMWBrBUQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] mm/damon/paddr: remove folio_sz field from damon_pa_access_chk_result Date: Mon, 9 Jan 2023 21:33:34 +0000 Message-Id: <20230109213335.62525-6-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230109213335.62525-1-sj@kernel.org> References: <20230109213335.62525-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C06DD8000F X-Rspam-User: X-Stat-Signature: 9ban7me89cdeqtg7x6dkeyoghrwaexth X-HE-Tag: 1673300029-414535 X-HE-Meta: U2FsdGVkX19O+P7K9CWSXinSwM0revicpfl2mmJGOXyESNXBkLiyqTcoCd5M8O+bk7+0PEaqjIM3gicvq1CM39j7ntrGBw1fiSnW7xtQTU4aoyp4EE37DDTujbbXo4GVXV9gA/UUXIdmDTl+nBoBiMJaMtWPb8zOmWH3E9ctRQeaXuKB8cnKI3jTorEJFam44ac6nY0kJslzNRMI54XEGH91eHNWOcpcJhDKEhp9gKzBKpVQacALt0JQEH4MvlOW+e1B3I+vRAXKouvmn6ubeTVh2XZl3OXtlGADGswXtxCI5HP8cseOa7nAFNVw/qZrqALe4r2GdEt5yGhq5VX0iaY1Xktkb0esas6cCCF7xnUUROh+pbE5HnSTua4pON0Lb1Uh7pxX0jnac/hWuvHPQqy+mfXIBJ6O7vLwtezLoGQIcHD/bE9tuaPSliXwhjknbhZKUOBjiqhQ+XQUlxE2WcZ5nzr52sW+X9riD/e0CZOuo1iRIRcg30v9rDikEWbX1ygww6ivQLMe8rsrERtmOQBau8FVg+YNaYfOtkON1xJ6lNXEX5XnCk5Sv5jN8uz+JTDdm4WXvfqG2R3iPB1J9To1CHWVk9emhlET4Iz6yJWjrbgDri0ByMN9EzzFbY9E73nR8Gs2svh4m1OvPkvEhWlI52A+TVC1CTvzaPNbp4mDqzgMMawOJNdLj1h4mu/DN6lScLBeF70OfTWVAWaG5ZCskUMLaf8yL70YcN2lrqWfpwV5L+vqCPN4oak58nTZ+MuhBjJ51Z0wQPT0QQxTQqlNJ2tJ3U/YwcyAZbRhwgKAM1RJb9aBR7b7rBDjNY8GSE4o3zsy6z7n4vMUCo0JeqfzOTAh6SwNnCZwkaT+qLB3+xFV5mxMd8kPacVm2HqO6mhHHtedIuF/ncbVGVOiP7apP969XpIfUst97Gw6sFqFwgjqXPaDkhEONaXAPjhD8E4Dvrn16f5m0wMle7M M/S4B/iL TDODB7giTaczpu1dIfL1VrrQL3/S5JDJX6HN0TAyDFMxrInhmRTxxQy4Q63LXnpxqmyPJtQIuHG0/HkMwXFWbWYQSzwKcBiYN2T92EnJyV39fg9W/JA2IPstWDA== 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: DAMON physical address space monitoring operations set gets and saves size of the folio for a given physical address inside rmap walks, but it can be directly caluclated outside of the walks. Remove the 'folio_sz' field from 'damon_pa_access_chk_result struct' and calculate the size directly from outside of the walks. Signed-off-by: SeongJae Park --- mm/damon/paddr.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 65c1e0f91535..b51606519bbd 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -80,8 +80,6 @@ static void damon_pa_prepare_access_checks(struct damon_ctx *ctx) } struct damon_pa_access_chk_result { - /* size of the folio for the access checked physical memory address */ - unsigned long folio_sz; bool accessed; }; @@ -92,7 +90,6 @@ static bool __damon_pa_young(struct folio *folio, struct vm_area_struct *vma, DEFINE_FOLIO_VMA_WALK(pvmw, folio, vma, addr, 0); result->accessed = false; - result->folio_sz = PAGE_SIZE; while (page_vma_mapped_walk(&pvmw)) { addr = pvmw.address; if (pvmw.pte) { @@ -104,7 +101,6 @@ static bool __damon_pa_young(struct folio *folio, struct vm_area_struct *vma, result->accessed = pmd_young(*pvmw.pmd) || !folio_test_idle(folio) || mmu_notifier_test_young(vma->vm_mm, addr); - result->folio_sz = HPAGE_PMD_SIZE; #else WARN_ON_ONCE(1); #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ @@ -123,7 +119,6 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz) { struct folio *folio = damon_get_folio(PHYS_PFN(paddr)); struct damon_pa_access_chk_result result = { - .folio_sz = PAGE_SIZE, .accessed = false, }; struct rmap_walk_control rwc = { @@ -158,7 +153,7 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz) folio_put(folio); out: - *folio_sz = result.folio_sz; + *folio_sz = folio_size(folio); return result.accessed; }