From patchwork Tue Jun 4 04:24:48 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: 13684610 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 6E2ABC25B7E for ; Tue, 4 Jun 2024 04:21:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E55996B009A; Tue, 4 Jun 2024 00:21:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E05EB6B009B; Tue, 4 Jun 2024 00:21:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7E8E6B009C; Tue, 4 Jun 2024 00:21:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A7D096B009A for ; Tue, 4 Jun 2024 00:21:52 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3FA79A0B90 for ; Tue, 4 Jun 2024 04:21:52 +0000 (UTC) X-FDA: 82191908064.29.5112557 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf21.hostedemail.com (Postfix) with ESMTP id 997FD1C0005 for ; Tue, 4 Jun 2024 04:21:50 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=f0kDChGN; spf=pass (imf21.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=1717474910; 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=5D2cnaClGiUXa1btfWrU2w9JyrvIrp3p/yNIHBcKdpY=; b=CnadBQxTo3rvfNBBC0thYc7bYisGyL2jqOXPt93mYuYKlm+W2Yr1RirFWp7ytc+SkO+De6 gZie7fW61iWRYas2lTEz2kyd4GCJVGzhOON4sYgb1gNwe+WAElExHvq+XNzpq2dWATOs7T H+hoCV89zl+PVZcPaXwrXNCLrVJ3gHI= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=f0kDChGN; spf=pass (imf21.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717474910; a=rsa-sha256; cv=none; b=hzs1SDD+MbNpo3GSMvDcFK950JxRPcQFYrwFIta+0vdToAoPe7WjhFFHE6OozRlAq2BrS5 P95ATH6m09zF/pKaWY88KQfLtSSjwE4fvDDyMpy9YD828gQuTJCEzJYzrzurBWq2FFZoQs DDRPKitHF/hMbrb0EaDBQCD+wG56nUc= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E1B7F61207; Tue, 4 Jun 2024 04:21:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C2A0C32786; Tue, 4 Jun 2024 04:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717474909; bh=r3mq/HoGLqusQ4dyUdx5DxYmG67Uuzo2XB6s67qh+EE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f0kDChGNADArwjFTu0Ecxn/z6ERtbQhoafRczm2xl1DKivY/FBSpOu3M+FIXHE6fF 9Q0KEuEWhS6uMtUMtCAR4SdvOqzexhe1KgXmnM9iLbGsMsGOhrlExEnyIhzDOgWHGL cDtkyQewEf1KcrjO6fI9ttmJUheFSRDfKyw5Y508mgtq2AIqf6Dcd037olbbAV+Nct Oojtpd89prXDc+dzsNEoIqTpc7ewALNrTL2+F1hmpea4SqHVs2ba3fufnIKMh5xfPB lykxIhWDHzdJ/3dNwpJ+heYxTFMd68/BX7l3eRuP3lfSY4mAibw2pQq/it3pAyAEGs GYPBMNqRZPP3Q== From: alexs@kernel.org To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, izik.eidus@ravellosystems.com, willy@infradead.org, aarcange@redhat.com, chrisw@sous-sol.org, hughd@google.com, david@redhat.com Cc: "Alex Shi (tencent)" Subject: [PATCH 06/10] mm/ksm: remove page_stable_node Date: Tue, 4 Jun 2024 12:24:48 +0800 Message-ID: <20240604042454.2012091-7-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240604042454.2012091-1-alexs@kernel.org> References: <20240604042454.2012091-1-alexs@kernel.org> MIME-Version: 1.0 X-Stat-Signature: fbfgbtyuscg1rqnyu845skte83zthd8f X-Rspamd-Queue-Id: 997FD1C0005 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1717474910-915264 X-HE-Meta: U2FsdGVkX18mClrChC7fx7SS5+AVyx5S3l0cnLB35x7kjQLpTo4K3fYwR9M1r1Uecwzwf0fSh/668We5L41xW+zme/zbZJgzB3eDKLlc0gADKEAmbb6rxccpi/Eg9NEaGi5fjZROK2Qye78DYL49WotdC2ye4CE0bE9+FZWFP8+mrik/Jm+ljLWvml6OEWBaZ9YP5lGIA8N/7/iKfZ/JPswpVGV8NDTAvdOS+N2MXogt2nlr5f/4ce+lcpcYF2hm1oJZ8qrISr3EbYlcxszN1kKj0bbtKqVXu/QOaioAnsqT/+Mhl68aBG3okpweRHnTwaJ7UU2bzaRxV2dgB5LEp3hJxI37VO7lR2Zg2oBXenTJGAsN/6zFmPrntols7yTq67ofhwvDxaJM9Y10EQ3clLAH+shTRC9yID3Lt2hD31GgYLxHtI76EV+Ef14oUK5zSMTQ/lurJ5V0NkKOW4tXzS+FYN4gVUGVO9l6++zcJK6BKAHORVAF8/pSHEZp0ExhP0/e1sSpfAtvOvvnCskqI9dvdQsbFb5wVs8mNSE5buhG2scAlLm9hjOg9wWH6baGH6DiFMD5qmHEMy9o0RgchGkp70rsn+eGYywafuoDCd7r8rV22IifI9MNz+ZdblxCZX7XPm7NBuLKW3UVG4CTMdkE4r69zumrshJ/sqUh4bD7uMX5Ee/8I1JdUEyHuk1o0/oevYDvUVqz9fC9Oye0JtyP+vq1q0tDCOwSyZN5c6gf7CmEy80cBAUkk0vvdYIPIHVLbP/y2G3f5G6d5pbiYdhQDKnwZBlEitGuUWEZgquWeeRRyGNFpyLYGm9KFtDfTmEEw5Qsvnn6HNNvm2s7lpxlXtZUKJY/wMy0ivHhuhlmgujEFN0EqkrhZxJ6k/1IWLPWcmm7stsquGmBL+/CTMbbnt63Zhi6a8aMU6o07O0ZxFTdIrr81T32qNXELw0p7OUky82ggmtfsASd/0E 2YgtND3R NZ11TbeGRlThmsuy1SPJSIOgC7XWSLtxNZD0RMWaWeOzQDeRX4b3Yk37XkbjEqpRntV8ga0awAnl87E8VlS8YCjUaOkseBk9529xoJ8QC39pSCWCdEwWtQNt1lT56d9AHtvKL6T7SRnELECfcBmSp6gXHzx3AG9Dsg+73k+gtEfJAT0gc6/2C6vVXCJOVgf3Cxx1A3Jc8CMssmzaiZ64FrctfrWBWDecRaW+kAWS+CwqIt5eOJm1wX/4hd12VwMdSm6B+bCClLXsu8h0miXZc+U7xpn4uXIYYZNLcsdovuAud2Xw012FNzxT7zjhtwVjePtZMwUMsZcDOP3I= 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)" Since folio_stable_node could replace page_stable_node now, the latter function could be removed and save a bit context. Signed-off-by: Alex Shi (tencent) --- mm/ksm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index f68779651841..24de562b64e1 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1086,11 +1086,6 @@ static inline struct ksm_stable_node *folio_stable_node(struct folio *folio) return folio_test_ksm(folio) ? folio_raw_mapping(folio) : NULL; } -static inline struct ksm_stable_node *page_stable_node(struct page *page) -{ - return folio_stable_node(page_folio(page)); -} - static inline void folio_set_stable_node(struct folio *folio, struct ksm_stable_node *stable_node) { @@ -2324,7 +2319,8 @@ static void cmp_and_merge_page(struct page *page, struct ksm_rmap_item *rmap_ite bool max_page_sharing_bypass = false; struct folio *folio, *kfolio; - stable_node = page_stable_node(page); + folio = page_folio(page); + stable_node = folio_stable_node(folio); if (stable_node) { if (stable_node->head != &migrate_nodes && get_kpfn_nid(READ_ONCE(stable_node->kpfn)) != @@ -2345,7 +2341,6 @@ static void cmp_and_merge_page(struct page *page, struct ksm_rmap_item *rmap_ite } /* We first start with searching the page inside the stable tree */ - folio = page_folio(page); kfolio = stable_tree_search(folio); if (kfolio == folio && rmap_item->head == stable_node) { folio_put(kfolio);