From patchwork Fri Mar 22 08:36:53 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: 13599732 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 B3979C47DD9 for ; Fri, 22 Mar 2024 08:34:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4905F6B009A; Fri, 22 Mar 2024 04:34:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 41AA16B009B; Fri, 22 Mar 2024 04:34:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26D3A6B009C; Fri, 22 Mar 2024 04:34:53 -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 0F5D46B009A for ; Fri, 22 Mar 2024 04:34:53 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DDB301C09F5 for ; Fri, 22 Mar 2024 08:34:52 +0000 (UTC) X-FDA: 81924014424.23.F13527F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id 4513A40009 for ; Fri, 22 Mar 2024 08:34:51 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZymVidz3; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf17.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=1711096491; 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=LxZK19S2i+sGKx9/CjW/VzjA82ar5TBD7OJl4v0Q18I=; b=0DdkraljH6rs4fMSVLjK4GzSqjjPeFl/WVv/9WLFEnPpq1WKiwuZPtPt/FseVy8UtD/TI3 lwU82DLXbf2B1YhWLqynz9uPQRR6nMvnaOjvSy95BoTul1FvVGZXT1uiXRReQvXYLZj9iu RoraNhWrhws+3yKfQDjfnXtkQ97tDLw= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZymVidz3; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf17.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=1711096491; a=rsa-sha256; cv=none; b=o7CLucMq0GiYjbHvTElVavsiIld89/Pru4ryxnPINmBWvgDklmP2lMq0dvQHEoq2VmT8d8 Lst11AM2KQf33hqjeAA8HX3mSFzzX8YrARkPTSIzjd6M9yP2K9u28m0XsFfywRxZ2saGyn 6+mWn2AzBcNrGsq68Q5vvNYDdgmQH70= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id C6E4D6140C; Fri, 22 Mar 2024 08:34:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61807C433B2; Fri, 22 Mar 2024 08:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711096488; bh=mMH/7is2PyQdNPPcgd1XKt1tQVN1U+t8U42cK5CGbhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZymVidz3av9KUT6Go6vA7X/x8b1ArdeFvYp18yRZGRi7LFSF5BGygSy2nSAuNS48N oV//U8dnoMVOjWa0BZ4rHVLr0EJ1qsYlNQfQ9RbKxZMY2/ATKY8XT1JCPMhq2ivANK u/nMXB+FYxQ9VgJFCSrQ+X7XAr1LA5u2XDrmtrwHXsB1AFYesR/Vm1xs/IKR5jygoU n2X+VDFIExCWPIFpToJPdrk1bWwaZmv3OEEGmZ96CEje5LCAjnu9xki4q/3PG0umlS B12ZuA20VXl0otZBh8fT6hYqd0DzBi8jxdsBwcVHmIBZBPffkFvku1uFrC1z8tcL0h oikhkdgIYR9Rg== From: alexs@kernel.org To: Matthew Wilcox , Andrea Arcangeli , Izik Eidus , david@redhat.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Alex Shi (tencent)" , Hugh Dickins , Chris Wright Subject: [PATCH v2 06/14] mm/ksm: use ksm_get_folio in scan_get_next_rmap_item Date: Fri, 22 Mar 2024 16:36:53 +0800 Message-ID: <20240322083703.232364-7-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240322083703.232364-1-alexs@kernel.org> References: <20240322083703.232364-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4513A40009 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 9g11ua4415wyg9wxcozr5kwfdfhpjdtr X-HE-Tag: 1711096491-667357 X-HE-Meta: U2FsdGVkX1/KUL2yWuuhUtBmO1v5l3ywo4Z2H7X3QOcxATk3FDBZw83iESRQLcxRPQkhoaGWgUWHz8MONVfXQvpMQIX1axWj5CSEUqkugg4OhHOKl4oN23J4Y1QvRq3i1cSlt84bPiRb9YMi1DUsFobRPAtube89bVjI4o5Yzo1szS/nnld3ley+qhXdNAJWubg/7rYd0UAEycl2b9qhP5C0Z0U02m80Wz1P4U8d4xkaRuvjwl8F4LOYkkQWCOcpcBOURvL8BLo4zybdhLX9e8iOtFIGeBZ0R9Cfj2tZkmfS5IdjK3Ccl1B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iyu0l7WsH2fAqRElxIxgiaAHMfKUELv9GQlFl/3Tw9aUFAak+tAHQZASIuXEinE7mYGIn24NOoWOLDlYKyM7J6ViMrNqrf5hxikg0GPO 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 --- mm/ksm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index a1e382ecd501..cd607b942c26 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(); } }