From patchwork Mon Mar 25 12:48: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: 13602020 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 55C95C54E64 for ; Mon, 25 Mar 2024 12:46:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 427C96B009D; Mon, 25 Mar 2024 08:46:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B0586B009E; Mon, 25 Mar 2024 08:46:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24A076B009F; Mon, 25 Mar 2024 08:46:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0D3386B009D for ; Mon, 25 Mar 2024 08:46:05 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A374E403A8 for ; Mon, 25 Mar 2024 12:46:04 +0000 (UTC) X-FDA: 81935533848.14.F6CCC4E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id 0D70D1C0017 for ; Mon, 25 Mar 2024 12:46:02 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QjoZ6FgV; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.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=1711370763; 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=L+qO/XcqcIKAFhCFoyPhJG1UhlvKPeV2i/jpCfuNQwc=; b=4ZoO7BtjFtAgy+wQ+tkdDFsbzmLHEa10QTI0MP0ST3S/JMat/Cq9WmgdCX6NVYgy2AHo6k XQEZ3etEzRjpIBYLWnLEeXUt0JMsw7ig7EEAhWDxrDRVZQLktxQRPnQjl77Gp3i+ktV+6Z JkRgfEh15k0JjxgLA4tzQz0ptZpaWfM= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QjoZ6FgV; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf18.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=1711370763; a=rsa-sha256; cv=none; b=psPIhnIzHLn8DUiAVjYKkUQDk/CVT15mhkdwI0IDdvD6j0z1/hrfD/7hWoGE2V14Jig2kW neAAKlk6djjQrrfGKxultQsvyphcbMCyt6nluk0Nduehpsli2nmlyEj7mnMCT/8U9LqL3m ccvDV/rm3ZOwq2p4Oe5qOBQFxBxYIHI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 3D6A360FA4; Mon, 25 Mar 2024 12:46:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAFF3C43399; Mon, 25 Mar 2024 12:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711370761; bh=3EngGDxtSZrFY+NPFGnfYU0Kocquv/KpfYgYZYqOFCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QjoZ6FgVlpIls85bdewPna6oDmn2WQIkdvXxVa0PVuSTOfSnoi2GS67/7T2yzLGTU pqP+ZuzwlR93nUViU+yT+7Bo1vkuR/mInu4r5dalOt34sGCZ9YT8pBFxsswAhrUScn rL5f6uni+PSLCcHF3+sBGjcIr96ZecpdJaqpTwIBsEZo94tASOiWtA52AAQHG9ymA8 LQeACgbCBpU4vPjteVHgegKWJPmSOubP0Wr5v9+rVr00SleMoJB8IZu30VbCEFdf6y pg5XBGAOTY31Ro0NURQi8DmQmS+ykXp+MXa0O55h72zSE68tY9uPF5QTHq+1A4Hbeu 5pXqw9a5deBMw== 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, ryncsn@gmail.com Cc: "Alex Shi (tencent)" , Hugh Dickins , Chris Wright Subject: [PATCH v3 06/14] mm/ksm: use ksm_get_folio in scan_get_next_rmap_item Date: Mon, 25 Mar 2024 20:48:53 +0800 Message-ID: <20240325124904.398913-7-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240325124904.398913-1-alexs@kernel.org> References: <20240325124904.398913-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0D70D1C0017 X-Stat-Signature: oyntp65qsn5mm14ji3grpfmesbreiw7e X-HE-Tag: 1711370762-610081 X-HE-Meta: U2FsdGVkX1+O2FPnQiQer75hd8VviEbnxyodcr2elviXLrlgp7doNSdJyjYaT8vXYQ9wsb348E54W51bSad9iq5UNcYo5O12X3IqU6TgL1JeaicXxcegfiY7RWGLkP6ISzeDm9eMPJHm4jnULj80YKey1vEjCwfPBLZUkSpm20e4Kgz1Uc9+9eMK8WA+dOOo8GoXBGhqM5hEU0Kd1Mnwhe2kHORv5Jqg8lYUPHAM7gV0FdXcEbFK53UkXCF+pGvMNEKusofprJs4mrnrD7ktdcPVmJ01U2dNCtv/N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e68tUZUvwC5DSgnOsbrlBZSB3TcBAyDFzGXLHjmhuLwAs142Z6Toifyi4T2F47L+tLrXkjyytLIgRg/Sovs7CJIZ75a4tFH8OCNcLamWOclHwSBcWVHME6jYAY4QL7+9QZpJJSCu 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(); } }