From patchwork Fri Mar 22 08:36: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: 13599729 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 EBD0CC47DD9 for ; Fri, 22 Mar 2024 08:34:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BCA86B008C; Fri, 22 Mar 2024 04:34:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 21D776B0092; Fri, 22 Mar 2024 04:34:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 070316B0093; Fri, 22 Mar 2024 04:34:39 -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 E3C536B008C for ; Fri, 22 Mar 2024 04:34:39 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B6C7C4131F for ; Fri, 22 Mar 2024 08:34:39 +0000 (UTC) X-FDA: 81924013878.13.20864C2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id 23CD52001C for ; Fri, 22 Mar 2024 08:34:37 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AaBhc3oW; spf=pass (imf13.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=1711096478; 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=zpQpQ5AduNCUw3vz8O0m7nv2b5QFG6bhMkYGwKcOJxjk5ukSU+21GdIvDtcsgBv6ici0QZ 0VbzgNznsIpYojrW0kLdEvp0l7xI7CHea3bWJcYWPG0ZEmm8GNWhHmBYBo1BDtavazL7Rg xXytMpUJpR4ppFoykjLSAP5Dd7WIceM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711096478; a=rsa-sha256; cv=none; b=3+ltad1dUEChC2+7N9Q+xFLx8MjncouEy/CKrQ/B0tW/pnFJGJkVoPDxHBMfXTrf3wZtXx JoyugYkayW0LfvD+9zH5qu4qwKJvuShfsLQ1YmYZReM1vyHII1bI8N4Lvflyo5AXiYuIwp 6/w3uuaqJgb4wZbLuTsUG7fWHc/n7Wg= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AaBhc3oW; spf=pass (imf13.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 5AABA6140D; Fri, 22 Mar 2024 08:34:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4E41C433C7; Fri, 22 Mar 2024 08:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711096477; bh=u2CpON+ylVsyq590GuxgPX8aACtNcQ54tsZFdjhyaWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AaBhc3oW54M2fVP4zko3bI7wwqPbKFrZpITxoE8zMB09nSGioEQ8ciGrhyoNVw9dl 5YrCQpT1pseBVwA33cgDlGFOx4FQlanhgK2UjNScC+SZBglLPfDqK1UofWxdr47roq 6GMyA8MaGGHVqiCCLVMQRL+VqScXIDmuLZrG9NMJ66kWpS40p0Zaj/cm+2GbhOMhTu e0ethnI0isP9gkZHmiQAYCHBVOZaM2T/frovkexYNf6fSyJbKzLJGhv/JOGivKU3Zb RCqpiaOpNDTHCBh4+Tx8KnVwnrqI1pqgWU499eH8OT7ssfyiP0MU1lfCoLJ1RBaMHz M4RaK8HjY2+1A== 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 Cc: "Alex Shi (tencent)" , Hugh Dickins , Chris Wright Subject: [PATCH v2 02/14] mm/ksm: use folio in remove_rmap_item_from_tree Date: Fri, 22 Mar 2024 16:36:49 +0800 Message-ID: <20240322083703.232364-3-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240322083703.232364-1-alexs@kernel.org> References: <20240322083703.232364-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 23CD52001C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: sgaadugk73kwypq7cjdf9c7x3txb7k8u X-HE-Tag: 1711096477-701864 X-HE-Meta: U2FsdGVkX19uxr+8Bi6ICi2HKAtCd8UvXorAI20g1SXsk9skPQZCG1pABx87AvJB0W8Kj0YSbdDiJGtRbIEmPvde1mmC+4/bHyBBeg5G0UttoEq6wY0GGmwTlDPd9IQRkDyEFi/DovFOS6twClTAy1VWx0pKtlJLe1zh8/QGA9L5VIDbHwV2gbvunvZ1Hahf/EzgYPzcznaDSMM0djGD9nAOsMBf3xjezIz1C78hGuL2QAuQQkbs23aCnfwu2/uHYthTDkA5Wm7vgZNmW6gTrdvidXjHJzsVH5B0zNmjKo+QR1UedBsWDpWkdW9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V6/FtrKmksKaY45saHef8OW8RAxLayH0HA3rYPJV4ATwWAKsv4hqou+IienGnHPAFjOPU25gMsDuJD5eIF4TWA69t3VOZhzCweudVG3pDvPqb3N 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--;