From patchwork Thu Apr 11 06:17:03 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: 13625440 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 8789ECD128A for ; Thu, 11 Apr 2024 06:14:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 054ED6B0088; Thu, 11 Apr 2024 02:14:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF9F16B0089; Thu, 11 Apr 2024 02:14:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4A766B008A; Thu, 11 Apr 2024 02:14:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AD88B6B0088 for ; Thu, 11 Apr 2024 02:14:25 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 719111C0EEF for ; Thu, 11 Apr 2024 06:14:25 +0000 (UTC) X-FDA: 81996236490.06.6F21531 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf26.hostedemail.com (Postfix) with ESMTP id 961F4140011 for ; Thu, 11 Apr 2024 06:14:23 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RG3iMi2h; spf=pass (imf26.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=1712816064; 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=IjYVnJ5Hdf+yMGGai65+HBktlmyEg7+Suk3YKRYz0tQ=; b=eLIIyYaJhaIe4GGTdEBjVQRJdshpmCwRx46wycDW8P8drpsn/RlMbX/y06OORLyZ3O4jPJ s/LJ/S1kISI3K1H2dKG9vzhPSdQnKkLl/RlxOWQHPzb+ARAYPyFCDh2jqth86oi/1SWacs Bk+ODf2U8qEVAnuM81fplGKD1F1Fc9I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712816064; a=rsa-sha256; cv=none; b=xN7cSWVdMjWpwixr+YMJs57VYK5YwjvGyWybxSxk8bZ7cH1GFPmW6HdX+WmHaHSVLH81gF V03RiPA6Jk7oHpNrDQG2UzbTElJrYTDExnLCGRYLDKY4vUjwdMMsu3HBtMdkmQjEeKJ9mx 5lu6xDjnG74SUbEoeSsFs6vyFpkp8ac= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=RG3iMi2h; spf=pass (imf26.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 7D50BCE2F0B; Thu, 11 Apr 2024 06:14:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA75DC43399; Thu, 11 Apr 2024 06:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712816060; bh=Ti8omFOFkWyaGFVyRP2niT/Lsh/B9sgK71P36pfGxwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RG3iMi2h+4rJwzgmeoyIiZZmtvBYfoMXgDfJJgFS9lv62v+NcgJ4l1yZGNF37CwLt GLu7qoK1rTHy87WRBFLJeFfla6DXdLbnWVXmoHo+vutb25QVE7gpOvhH6sy4suZF7c fx9Xgk/iQscsOVBNRzbjxgLRYzjBEOdqoJfSq8ukSDTLbzmYjo3LRgVcgpPrJWJWPQ 4NwI6Vo5VI+85LFXnMpvl8FG8Ku/0SSrkpA9NTN1372DphlJLHBWeaEp+JxGd2Ml/J DYmWnmWPezuUFHIF1lxEuOA9TTvygMuWSBPT373PdQ/xEctBKLJkB1euNR1IV9NiWV UCWIpZCc1917A== 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 02/10] mm/ksm: use folio in remove_rmap_item_from_tree Date: Thu, 11 Apr 2024 14:17:03 +0800 Message-ID: <20240411061713.1847574-3-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: 961F4140011 X-Rspam-User: X-Stat-Signature: cztsoudcfhoxqruqub8qcpghfst4jiuu X-Rspamd-Server: rspam03 X-HE-Tag: 1712816063-696906 X-HE-Meta: U2FsdGVkX198dVFZM8Hl5Nqwk3yvgHK1mXi7bZzLnzKtduB6RuK9lhkwZkJuuxBZuBJlTSqbUTH5pJzX0M6i0VmjhBA/9icXOT1FhgcoVqCcXfs7OAb+WtlhiFS59v/wNXJhhePye4bnc+9Sf+JMPDf0e8S/4KZWjGHUD3sSV6CC0COsP1K+AJkBt3j6yypKfosYlXzwhjNHHagFFwylTOrOetJs5rAbPFrJpiMwNLMPRO5GGCCnW2ERkK+UaZ7jEfqWuk7W9Au/4hIBNilHzhoNE1pcIzbOLFsLl0odGd+RWIk2Eq2zOjIWhsj2WmAK6rMXyC2i7675EIyGQb9aptnzx9LYoW//32W5KWLcCTmJ5rvEUtzPukSZJ7qSA8wu4jOnsQmnrHOx8IFdYuV4OzMfLjTxBHPIk8PpJyUf3uhV43JI3Q6Fv7ArmzqD0DepJovOpMG8ro09/Vr13wJDI/wWWmhwiF/dbM52u/OkgdQOhTfz62L4tFSTZUQ7bb5DRyppaKmQPstt7AwL7sMXWHdctLXCmb9KWIqTXjjYVZjE1wNhqbGA/0UcZnbA4IeoY3OArImHhj0RkpMjpF1XoD/50eIZalQUEtJazR6bfI63B4exCNJdff/G0NaBoEkSddUGIQPlvXKVqlfRKQJzVXvjvl8DZ6AIu4DV4n8DhjfYRi+6JD2Ih2JYpNsnOeMCtSy3BJq8arAY2abuGxRXjoxa4JUealtU45LUD0aguNwtil9pIak5xh9eiQRiAThqCu1yyVv/7IgzRlEoAYpofVWtieWZUxfWO7huHXRkfVMGIFDsM1udRsb5RstNU98Ok11r7O/q/bk4yNR+n03yFbDYHHeaftj1VguMlJLGK8b7ezHmRRZoM/1VduqG9q7kL51628MbVMIoGp0Sk5Oroe1U0lz1lnNq3VcSUp/15wKuuNtjPNNDX5ShobWmZiVjdgRgj0L1+A0s1LCOIsH vZHbaOwS QIIPf 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 ac126a4c245c..ef5c4b6d377c 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--;