From patchwork Thu Apr 11 06:17:07 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: 13625444 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 77F74CD1292 for ; Thu, 11 Apr 2024 06:14:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 137D36B0096; Thu, 11 Apr 2024 02:14:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 013D06B009B; Thu, 11 Apr 2024 02:14:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D71426B0099; Thu, 11 Apr 2024 02:14:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B4F9F6B0098 for ; Thu, 11 Apr 2024 02:14:34 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 75052A0A5C for ; Thu, 11 Apr 2024 06:14:34 +0000 (UTC) X-FDA: 81996236868.06.4F3E4F5 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf09.hostedemail.com (Postfix) with ESMTP id 70710140018 for ; Thu, 11 Apr 2024 06:14:32 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qrF2rdtE; spf=pass (imf09.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@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=1712816072; 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=MsTQMsgVxf0dLcXEf4xqqAMX2k3L86zSBL7Zs51WxIM=; b=cko36JoMxP5P8mLXx7XaOtq2ePi7Ylkp+vkow06ycfmyP3x8FQRpA1NoVXMvjzMf0wa5Q6 cJhjmVhnwlc9oZTcJhwyGdkG3oYxuZkZZzemmPF7mn3yHcx9YqXWEO84LS8ShEYNcAk93T YWyOg4tR9cCCCIDNT35v7JES2KGnRBU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712816072; a=rsa-sha256; cv=none; b=tRWnuSas9rgj7lsL1/f7Y9Z8c76ZEde+Q+pNPABdb1DslPMRAV5PyTdexbLMLCTlqdNLmo kYxakhpFoBtpt5VnwD5T4XRutvfWbxieciNfe7nGefYqS99UtSaoE4gzsciJzYbkyQA40c /39N6zrqoBurgOzlE6SQFu2kZ7R4oio= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qrF2rdtE; spf=pass (imf09.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@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 7F6ECCE2EF7; Thu, 11 Apr 2024 06:14:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED760C4166A; Thu, 11 Apr 2024 06:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712816071; bh=AGS71Z17Hu5djhgaE9FvKpI+lMFnYwLUHMLt7uG9UW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qrF2rdtEXCaBbJxjV8S9drLU01OLf5ihIeBBhb8Xl/1R3u2e1+jNFOQHsgdzdnX/c /9dnAtjbA06xzJ7rdG4i6UHkCzg4bXFPhC5813GaUDWCrEDUDslsnKoU5MDzlxVJhe bQCIBihwPd2Yf6WqwLk7a/krz164Iyqhl7cguWbc+gN2CSIdqycaiZ3uvV4syIwWR+ OXLmzBAXdeJ7ihn/uRbrBCamUfBPTBOKUJhPH4u9x3jsuvLltT9DtBOtQqh6LWg+y1 SRxVpNTshHI8KEdoIV06pJfSrWMH/GZw+buDUlIu4gRdDDu7bDH4uAd9mjSAUmXkgq x2DLn4gkEPyOg== From: alexs@kernel.org To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, zik.eidus@ravellosystems.com, willy@infradead.org, aarcange@redhat.com, hughd@google.com, chrisw@sous-sol.org, david@redhat.com Cc: "Alex Shi (tencent)" , Izik Eidus Subject: [PATCH v5 06/10] mm/ksm: use ksm_get_folio in scan_get_next_rmap_item Date: Thu, 11 Apr 2024 14:17:07 +0800 Message-ID: <20240411061713.1847574-7-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411061713.1847574-1-alexs@kernel.org> References: <20240411061713.1847574-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 70710140018 X-Rspam-User: X-Stat-Signature: uqztzshacb8838cmtme7ncc41my6jr1t X-Rspamd-Server: rspam03 X-HE-Tag: 1712816072-3571 X-HE-Meta: U2FsdGVkX1/YEMtolmicz1T36Q5V0KdbTNgCKHLgfQV0oDwA06XGchvVRk8r1ZKHsTYGgFMYUu20E608h9SFFFSr8lFFx8yoCaQNMsQBPkUb06EkatO40Lwy6M7mJQMWOpGJYzhejM+5ch/i3fYw5wrVKgtFS6mDLEsz9OstxX+T9/g3LA9iH+uHHPqkc757dshOvB0ODZ4p5PIY/xTZVvwOrL0svrtyWLHsRrlDJRdkFVMSqSQ8OXwD4PVHppfz+dWW+QOoT7ksk/Ikc8y6hXV00zpDBfD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izX0rh5Ut0DxG9sy6rFakhZgrkISNmOYoajzI6pMLY3CRJ/3GvJhf/bFtKf8+Ca/T0zrOjci/Rkb2+0XAd6t/v7Hyk1aOo31gp1QDS2P1DPCC80TaAdm1kmS+/Gzu4Y/nfC9jBDBCQS4 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. Cc: Izik Eidus Cc: Matthew Wilcox Cc: Andrea Arcangeli Cc: Hugh Dickins Cc: Chris Wright Signed-off-by: Alex Shi (tencent) 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 654400f993fc..b127d39c9af0 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(); } }