From patchwork Tue Apr 9 09:28:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexs@kernel.org X-Patchwork-Id: 13622065 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 983DBCD1284 for ; Tue, 9 Apr 2024 09:25:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E2AC96B009C; Tue, 9 Apr 2024 05:25:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D636C6B009D; Tue, 9 Apr 2024 05:25:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B426E6B009E; Tue, 9 Apr 2024 05:25:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 872D96B009C for ; Tue, 9 Apr 2024 05:25:33 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4E73AA08E5 for ; Tue, 9 Apr 2024 09:25:33 +0000 (UTC) X-FDA: 81989460546.28.D0D9CC4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id B9EDC120002 for ; Tue, 9 Apr 2024 09:25:31 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Gic+mMF2; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712654731; 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=pcZg1c5VCocn3Bzg9z8DaXxlAUkYxtwMcy/PnEDZf40=; b=qx3+zc8W6Bl8r7NxYhKMojilGShG8tiIsC+VjKcaQhbHZSoR1sLKHpgkBZdEB0rd3axcKI afQcKVaneOhSyY3ehh8/yBVWyN5ut0qXUT43iZmLEmsOPZURPWuGWxTsCsba5S+lqbgUf1 fnsorQSGxZjaKbSe9YmGXEfFemqq6gU= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Gic+mMF2; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712654731; a=rsa-sha256; cv=none; b=1RL0uowmh2B46JsuoBY00F1hWuOqNYUOIOeEfLPG6/4vHejTplBDqu260PB3pu4wMMP3FQ FCINpz7noZPgvynZiq5Hmcq7nM/3avR6SU8/OWGjaIJcs9qh0d+zrJEKAUviXRCHRg3LQv jWxeLhuYqWKfp4WPL5zf4fEXDrSRaO0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EF0D361683; Tue, 9 Apr 2024 09:25:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86B23C433F1; Tue, 9 Apr 2024 09:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712654730; bh=dJ5DRDYCIT+gow/J5pRXi3ey1ZJ/tDnBvGy0lEgeqkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gic+mMF2M3oHglqJidfptsSOTIB5WDDSmFo1b/2IAIsAgt8Oz447ET1mybxFY1INy BgMffSGcxZEVDBTTmnHAZjUoxh3ayyAO9oI5fOFrMQIfWYjbl1kbAUnVI3tgxFAA1t WX6cYtXy20umo9u/uX+OznEJ9GemIxIa3Z1iYuqiNvdEQpTVsR0UbaCYphrDbKI2+k HCvjTjAm2AEyo67B3Vrn9+TIOQ6OXfMPFuEwHROErNbWDFkU7d6feG8hxPQ45Y5gti H8yg8goUkxXPDhDblpLIV2sIpGyk3ZceEplmGuo4cF1SvDwiALUVKeZYYN2/DUah6u aHaCRd7rZJIlQ== From: alexs@kernel.org To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Alex Shi (tencent)" , Izik Eidus , Matthew Wilcox , Andrea Arcangeli , Hugh Dickins , Chris Wright , David Hildenbrand Subject: [PATCH v4 6/9] mm/ksm: use ksm_get_folio in scan_get_next_rmap_item Date: Tue, 9 Apr 2024 17:28:21 +0800 Message-ID: <20240409092826.1733637-7-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240409092826.1733637-1-alexs@kernel.org> References: <20240409092826.1733637-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: B9EDC120002 X-Stat-Signature: sbbuscqb3m3yayckbitobt8yzmpjwcms X-HE-Tag: 1712654731-566154 X-HE-Meta: U2FsdGVkX1+vrkTYSTs4/TS07B2JXuQYD6vgaty+9rX28B8SJPKs9oML66JpRi0icy3e73qiC1P8fto7M3Sw9uCXGh3PFvpiSTtrJdwXobv2wJWcMxsv2Keb4ZomUX4P9vw3Nwm7Cgd3WeAShKX/4cIBeDy032bZUyl4iNMDHrRxZcuRS0wxE/47kZWkVl7tg4exULs/C+uq7nG0jeZlC98Ie4xdtmVNgFf+1wUHrMyyaiBDOAyCJXTB8fBpWlaJsvi8G5fpWWBvstEH3pGrbpP0wGS1PMS9NMXUt9u+FXbntqaN1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oI7dcOJjQsq69/yLXJKODKTIT4zCquL2YKvKJFzb9sZmcZEoWlS4Nic4c5VB4cNiS0EwdS3NPumWq3RFkcdX1ykYOnf5Dlw2IyMC3j+IwBtF6x0mVywCgIjv2x 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: From: "Alex Shi (tencent)" Save a compound calls. Signed-off-by: Alex Shi (tencent) Cc: Izik Eidus Cc: Matthew Wilcox Cc: Andrea Arcangeli Cc: Hugh Dickins Cc: Chris Wright Reviewed-by: David Hildenbrand --- mm/ksm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index aa80fbf3a8e0..95a487a21eed 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -2611,14 +2611,14 @@ static struct ksm_rmap_item *scan_get_next_rmap_item(struct page **page) */ if (!ksm_merge_across_nodes) { struct ksm_stable_node *stable_node, *next; - struct page *page; + struct folio *folio; list_for_each_entry_safe(stable_node, next, &migrate_nodes, list) { - page = get_ksm_page(stable_node, - GET_KSM_PAGE_NOLOCK); - if (page) - put_page(page); + folio = ksm_get_folio(stable_node, + GET_KSM_PAGE_NOLOCK); + if (folio) + folio_put(folio); cond_resched(); } }