From patchwork Tue Apr 9 09:28:17 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: 13622061 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 BE10FC67861 for ; Tue, 9 Apr 2024 09:25:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 725336B0093; Tue, 9 Apr 2024 05:25:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 639AC6B0096; Tue, 9 Apr 2024 05:25:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43DCB6B0095; Tue, 9 Apr 2024 05:25:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1B07F6B0092 for ; Tue, 9 Apr 2024 05:25:24 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BDBDCC02DC for ; Tue, 9 Apr 2024 09:25:23 +0000 (UTC) X-FDA: 81989460126.12.CA5944B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id 2175C40016 for ; Tue, 9 Apr 2024 09:25:20 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="a9lLnck/"; 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=1712654721; 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=MqIPFBc7nbtVV5KfBtO4U0LYKxmmn3vpAgivZBxfJEY=; b=3kloUFdZulN7ltNhlYN6XsoFOKAX7yi1pW2NRcpv3xWG2hgpKPqUO9+msNQKwKWaljrqj/ 5RSfp7qZue8vk5SXJ6c0Apm0COuH0RL7+PoDcfQmt2T+U2HLjmf/VPmF+Yy0tkiiI7CT0H yxIVRPPyfhh0GJ7jLTePnoVTR7Cb43s= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="a9lLnck/"; 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=1712654721; a=rsa-sha256; cv=none; b=QDugc/DRUR9BsAO5xOSjm7ajUk1FJHZLDxGOlCDdttb+OtUL9QCGMdLT6NMnrz5S2GHy1I VI+rWvn4j4ch7pmN09jrLVnr2FSIiGHqS/t/OPmL0p+jEDC/M/4F+dVY8Njsr5kgFk9kot /AvtCED6ws66U44CsGikeAi4FGlt7Rs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 06BC761654; Tue, 9 Apr 2024 09:25:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF8F0C433B2; Tue, 9 Apr 2024 09:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712654719; bh=IVhAzlnf/FbFRG9PEnvDGIGtbMw8j3OJiDaE0yo5KvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9lLnck/EFYB51Ch65extYs7iz20UjcwqKAleLCh5etxv9i7HDqZ82ImyRakGRseu Pdlzye6w9+SFe5lw0GRFLowvE3JZCKwRDpuDXnI423xC/rQVfyxivcxkonCU2YVLTZ 2qe9JsD1kGKPTfSBViXa6XOWcf8pGLz+iiw/9OhSA8ppiaIwqsb6LY/eLX9h8GRGMZ ouoAZrQy0bfnG8+DQJTie69CTdAr7lBswCvZf2lf+z10wMqKOIUAzDDDoQwAq59hxC xcaQY3pEymd7znTG4lG1ZvZvSfQkCx6XZZhrKLUNpbrA93wB6X1eTHGuwUr363y/W0 UnqUoiDYz6M2A== 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 2/9] mm/ksm: use folio in remove_rmap_item_from_tree Date: Tue, 9 Apr 2024 17:28:17 +0800 Message-ID: <20240409092826.1733637-3-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: 2175C40016 X-Stat-Signature: b1squif7cem7us59hmz1a83mhohuyq4p X-HE-Tag: 1712654720-495888 X-HE-Meta: U2FsdGVkX18hlUDv/JdE3DtTWva9tz8+42d3llhPq7v6eheHNLc0Bo6gZyRjiceoLJJyy5XI443h6X41P8htjYxu1cmqXnxBYKOryLXWSMvv+H7SSONsQIdQRaww+ZxnGrE7m4aksmjx2OZfw31QCG5PUsqr+WGTl9CSNjRXG6xottaGsU92M90YaiEOgKxnWaJE2XfLzpkh0BzRpCiJCa+5nTcEHiVp5VXMPM12jyqo/QWUfNob8ZRBcIMDynPXpas6bF6cgVzQjmh9z4UVuCP1eK6CgcI3wdhVXKKc6cVEJGiRXYsXTWCfSMffV42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H9pywNac8b8u03hdiTzXbJiblsb+aILIAADlT/gcHSwfy07jlyDyyBdAyWomoCDatI3f2VFBfP4m7PFdTUotnnPqS6GvvrbP 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)" To save 2 compound_head 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 ac080235b002..ea3dabf71e47 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1006,16 +1006,16 @@ static void remove_rmap_item_from_tree(struct ksm_rmap_item *rmap_item) { if (rmap_item->address & STABLE_FLAG) { struct ksm_stable_node *stable_node; - struct page *page; + struct folio *folio; stable_node = rmap_item->head; - page = get_ksm_page(stable_node, GET_KSM_PAGE_LOCK); - if (!page) + folio = ksm_get_folio(stable_node, GET_KSM_PAGE_LOCK); + if (!folio) goto out; hlist_del(&rmap_item->hlist); - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); if (!hlist_empty(&stable_node->hlist)) ksm_pages_sharing--;