From patchwork Mon Mar 25 12:48:49 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: 13602017 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 6C965C54E64 for ; Mon, 25 Mar 2024 12:45:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04C6B6B0098; Mon, 25 Mar 2024 08:45:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 005F66B0099; Mon, 25 Mar 2024 08:45:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E065A6B009A; Mon, 25 Mar 2024 08:45:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CBEF56B0098 for ; Mon, 25 Mar 2024 08:45:57 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id AF3751205F8 for ; Mon, 25 Mar 2024 12:45:57 +0000 (UTC) X-FDA: 81935533554.21.2614A72 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf21.hostedemail.com (Postfix) with ESMTP id A04FA1C0009 for ; Mon, 25 Mar 2024 12:45:55 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eVV1IaWV; spf=pass (imf21.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=1711370756; 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=35bf36rVzZCfy8oUlmgzrKLRW5lsRT/GT0/CEZQ4A3g=; b=fi0TIBh9wWxrOICVY/YImMH5NPSVO+uycj7LBjzS0hi87Icu+eTiBaDfuUOGt5LG2erWeG Sf7NhOK38hhhGga/T/xgQTNko5G7EVnU3Af9VFtDo0WhCNWkAd0+9EWjyeACVH27jdg44v NO1BF0taPoBvsSNCIl2CX+NTPw/HEac= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711370756; a=rsa-sha256; cv=none; b=Hxk6+JCHkvsIdMVfYuv4w/fmDt40JiPdscM+8e2zFljDt0uMOlQwMU4qjdAPPXZfsEfu2+ q2Liogw4IYUF5tkMXfLS+u512c77/wQzUQ4jUAIf47Uiuk/NLgda3+cgRhcMpJTqXwzPXi VqB9JjvSOiK39BtSipopkksUZ49DLRg= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eVV1IaWV; spf=pass (imf21.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 6D29CCE178C; Mon, 25 Mar 2024 12:45:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3302FC43394; Mon, 25 Mar 2024 12:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711370750; bh=u2CpON+ylVsyq590GuxgPX8aACtNcQ54tsZFdjhyaWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eVV1IaWV9vRcxYwQUums5xqSP5Wq1JaDlgBpGgCe+m6yPpVz9ksbPoP0pmrHEZuu0 v6WWcfakc0/tzBGby00uzvkxjcOBYM6cHLDbWRpFTq94slZHx4TcMPDwKpMzYzzNz0 BMidSuGaNRhfTXfWCVNvqoZqUh4twz18njVGGXwvDUBvTVjq/UvN6fFPsMhX3Vrt7z aY3IAz2QpBy1FzTmFMmrd3Uzk8u+vLRLScq0kqqqEtzy66GpBwBQSuYmEXIScNvKzt 52cbGX7TGYSEhHydw6YfGvD4iY7cColqeIklQDrrLO+owD9mzzFk40BeiXE0DAfH40 jkgADT0ieNvdw== 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 02/14] mm/ksm: use folio in remove_rmap_item_from_tree Date: Mon, 25 Mar 2024 20:48:49 +0800 Message-ID: <20240325124904.398913-3-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-Stat-Signature: p4fsjjza1e9wuiue1xydf3som69doe9e X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A04FA1C0009 X-Rspam-User: X-HE-Tag: 1711370755-85169 X-HE-Meta: U2FsdGVkX1+NYIiaLPi/o6jBy6z8cAdnujJ0WkU0N9GK6+hcObGXvqFpBZFmIeGeRzeYnzuG7v9FLi3HCx40AvRW2j9s/5F3Kw4KZ93oc7VMcac00xj7X+TPbb+kBD8ay283YxXn5IIFK2BlohHW+ymJJhtHIqrxu7glz7jYM+tHO4A1raQrvu3XmE98d9zccyElxg7UMKV76WNPbfX8uf7SFqmjjBwMF9VUZocgrR/kWJJs9/F3wFqdPPiODQNOPAThuAvSG+h9lon7Go4oewK1qZNIHgZyzwekWEUk52b+P4ChEr91dWdDa4WPc5P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WQ0WzdXQEW7xATCob5XxJ80AyFSTMN74GALk9DvXkdErsyMUw+KfIlqmmE6Xq8LP2HpWzGQlPgF6fpN3G24xqaGetNa+YHj9sBwaSHodHcgDLH6HN 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 --- 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--;