From patchwork Wed Mar 20 07:40:38 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: 13597416 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 7C1DFC54E67 for ; Wed, 20 Mar 2024 07:37:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0C236B0093; Wed, 20 Mar 2024 03:37:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EBB7A6B0096; Wed, 20 Mar 2024 03:37:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5AFA6B0098; Wed, 20 Mar 2024 03:37:46 -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 BDB9F6B0093 for ; Wed, 20 Mar 2024 03:37:46 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5465B120351 for ; Wed, 20 Mar 2024 07:37:46 +0000 (UTC) X-FDA: 81916612932.23.42DC8D5 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id B2E0F1C0006 for ; Wed, 20 Mar 2024 07:37:44 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UxsXOdDy; spf=pass (imf18.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 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=1710920264; 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=P3PwTI3lC441cH7scUPR54+kprIKpSjAWFlcAfP6FSE=; b=7Iqdvn1FhVFwUFOrZPanhzUZko56V2brz/zcnhXu3S91ByY0+xPBTQun4L9NrFRBj9WSGR 0+IblzsmEPvjrBIH2a2gTHmfa/JDIt3ceNYzv5xjaFOJQ2QhdUd4M9ibvVNqbg+8ArqjOt OeCnNLbxAYsSTcPM96ypawQbGdeX81I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710920264; a=rsa-sha256; cv=none; b=3Qc2u98QMOvCK54MDaQOXp2xxLYjeAHQ5idPrA/YB6GbInur4IdkqOIS8PcD71cPvMEDQu itEBlszqhxTNDjWnnGUXmV7fJjT3p9OfgTippsoRN1iwXQSve9B5rAhzRX/US120Zr1YH/ wcdbygrfzrKTQEvY5JKLbSmB5HqQ2ek= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UxsXOdDy; spf=pass (imf18.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 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 dfw.source.kernel.org (Postfix) with ESMTP id D329160FE4; Wed, 20 Mar 2024 07:37:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 565C8C433F1; Wed, 20 Mar 2024 07:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710920263; bh=ogVdYvzWIODvepKssBDhcBjAFm2MyCuzb8iad0ikR9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UxsXOdDyeQz/LeOFJ5thcrVWPFUWSF0xAf89HiGMSe1y1BQ5CAtLaFvVrMHInOuCX n08x7z24gQKQo1Cys2BHt6sOQ0roKLbru2L4miwJv5QpKzMF0f31/Lm2LEH6kR523t 20RATbtX0L90o6l3JGyxonZhk3vkJOCXrcafdQzlPDTPVbAFVtXtB6Tv1vhu/iEyVG G7HhTffwrFbNX6CMK4TGBGryk31ciBggJCmbLm/iNrVqu7JvPkUAnhs0cNnxl4w+p9 pej6aCsV5pTOSmF5hEJTHfIxd7MPpkAe3JtPHU6COh7OhEJLXeBnUgbRwgXSco1Jsf EYGDO6JVtUAnw== From: alexs@kernel.org To: Izik Eidus , Matthew Wilcox , Andrea Arcangeli , Hugh Dickins , Chris Wright , kasong@tencent.com, Andrew Morton , linux-mm@kvack.org (open list:MEMORY MANAGEMENT), linux-kernel@vger.kernel.org (open list) Cc: linux-kernel@vger.kernel.org, "Alex Shi (tencent)" Subject: [PATCH 02/11] mm/ksm: use a folio in remove_rmap_item_from_tree Date: Wed, 20 Mar 2024 15:40:38 +0800 Message-ID: <20240320074049.4130552-3-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240320074049.4130552-1-alexs@kernel.org> References: <20240320074049.4130552-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: o94zx48145aybyqybks4xisbup1i17qz X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: B2E0F1C0006 X-Rspam-User: X-HE-Tag: 1710920264-872909 X-HE-Meta: U2FsdGVkX1+w3D/vRSgUX4seTLP5j4mb56svTEc695gDSGtah64DVomJJCfO5JauQxVujcHkQ6K6GmWwiB1JN5nY6ahHK1Pu8wfiBSaT05MoaMCksGLhMPFFjk5jUrRVUs3+jq7E9+Y0RD9zxEcqFXkuO9vh/p1JZZqmZkRlNgn2xq11Wq810h4r5WLsvIXNsdjoBuOQou95A6+nOgAaI4ZepZRhbrL9Ndf+TULVncuRmrdyvH+5astqPZ7oRdOHZtIX9PEpqaxHYMPWPmqCUg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+xkXomY4PToderxe9z+9EqgXqwL/XwrB9hYk3aK+2o85C5hcTAFr+9WL4FNf1lnXSrjrQCMpVR8mg1RVEIg4L1GI218QR0dMB15s/VKxjHEgNmb3unGv+Szx+J6WBSHyR4RPKocfJ 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 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 --- mm/ksm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index fda291b054c2..922e33500875 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -998,16 +998,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 = get_ksm_page(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--;