Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp206133lqg; Wed, 10 Apr 2024 23:14:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVdDWuj3VLi4F7rjJuT2Duqsm/J+DLPqXWD/734BCejvjdvy89WXsUYc57/9RDbkFW6Mm4SI4FelNBNg70iX32E4TnEtyozbVSeAjz4kg== X-Google-Smtp-Source: AGHT+IFw/y2rMdiXcruIz14waH+1W2HeQ8J8mfFGVU8Qe+uWvJvVSTlLFh6/FiYXhMKGbWCqtAMV X-Received: by 2002:a25:c805:0:b0:dc7:483d:5903 with SMTP id y5-20020a25c805000000b00dc7483d5903mr5102720ybf.17.1712816097982; Wed, 10 Apr 2024 23:14:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712816097; cv=pass; d=google.com; s=arc-20160816; b=DKwVE3p8L2yBQDR5RN8s5jNUVjy8WOikIqGEP80sJ7CC4zOfg8DUMq8BUQUvm3m6c0 jCz0YxX7knVknFvz7ziiUYEStuJZ+uoMk5o4qJGiOmoC51ALp5fwM7tWLCNKY3WCtplu jmTJWZ1TudPqCFxMPXYF/cwn+DI+qpxTVJU+pzSnusMB9m3gnxXkQ53moTun7iMpexWx IEK13STnjvNY0TWbEYOZqj9/tsm35j6/IB8aOc2BV4vfFkqwDZKqRuDT+3qRA/nL0L61 lltl4CWD9ClonYjlK8RLHLyQnSQSYPVdUP6XRNzeG5BnyleUi+jVfw3E3G4DhfCGyS2h 0k5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=IjYVnJ5Hdf+yMGGai65+HBktlmyEg7+Suk3YKRYz0tQ=; fh=WEMOZDYzhROtJ53Nx6fHy9wYEqwkxnRo6fKhqlB4aEM=; b=QyIb2nJCoV9dl+dI9AheZkS/pjCY2ImcE0Kd0qa9T0AXJzB6YwxCE8GJohU3ziHJ8S onsgS8BLsrNMF42m7HUuZe558Y3GD9iC4BDrgj7gMTEnSZQX06sJnDn8JewzfCYpa67T EQ2ldbYTR4SHc/vns4d96WBa4JgDAaKIKdAcvmh5nEs780dXRfF2VCCkK0ro2/jgWy8X 2/rf5hOsLsTa/IshFraGWvRpwVks+b0CfOwe4yvMy9HKmGQcP18IaQqBTP3lpt4NZQK9 WWO9SHnLi+MuGf1j4dCCNvN+HXL2GkWzQwTDjBqWR89hF3WM07CDb9O9ke7VGI2+bp1N SmeQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RG3iMi2h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r7-20020a05622a034700b00434a778fb59si857306qtw.496.2024.04.10.23.14.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 23:14:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RG3iMi2h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139825-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B15961C223B1 for ; Thu, 11 Apr 2024 06:14:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6096113CFA9; Thu, 11 Apr 2024 06:14:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RG3iMi2h" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FE9C13CAB3 for ; Thu, 11 Apr 2024 06:14:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712816060; cv=none; b=O8jKn9I/G5A4yNhv+7UEOOfXLRxjA6e7HIxep+kcoWZ8qHLiamspZyI4Bah/rrO+Xee3jMLBNIMTKsagctm/D+rF/LUf3Yr3dfeTZFokuDo7j4xjShzf27qlDHlKTaVinjX4AoC8iZ0z0wovKiqxBwzQ1nH+3nVm8oeknx4KjF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712816060; c=relaxed/simple; bh=Ti8omFOFkWyaGFVyRP2niT/Lsh/B9sgK71P36pfGxwA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L8JLFC/ReexoLeMp3vm8nem5H6i3vZu0tjBfFtuL5ej0iUorr6XoqAROwaSVL6SdX0ZR6xszx51/j5NEyoK4GGXx3Q91/XAyW3Q+lVXs419T1QbB77ki86dnYlxyuuUBNQ7HrMIILf2ZcgnnokyUC97BnFWzRpoHBJIREB8OP/k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RG3iMi2h; arc=none smtp.client-ip=10.30.226.201 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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--; -- 2.43.0