From patchwork Fri Mar 22 08:36:50 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: 13599731 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 7A022C47DD9 for ; Fri, 22 Mar 2024 08:34:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 09BE26B0098; Fri, 22 Mar 2024 04:34:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F3BFA6B0099; Fri, 22 Mar 2024 04:34:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE3356B009A; Fri, 22 Mar 2024 04:34:47 -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 C19266B0098 for ; Fri, 22 Mar 2024 04:34:47 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9E75D161325 for ; Fri, 22 Mar 2024 08:34:47 +0000 (UTC) X-FDA: 81924014214.29.252C322 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf11.hostedemail.com (Postfix) with ESMTP id 98D7E4000E for ; Fri, 22 Mar 2024 08:34:45 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=oZsUV3DT; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711096486; 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=XGMdmYS1oT7AtfIwzwhYVurhrnfmW9Hkdz0PxTq4TG8=; b=DJ/6hVTwm4R4Dg96iKRpSWO0N2Uz+NhJBizWootQv5kAo6iiWqiNvt3OpcXCadsrGp6Wdz DndlKyh+4i9ePCbuVTOQZgW7r1NchZJcYcK6n4E0fAb5iNlz/c+KBB2GCIVIkCgjrIMjK6 9geCvuMgKC0/NcKNLRKdiLcDmY5T768= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=oZsUV3DT; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf11.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711096486; a=rsa-sha256; cv=none; b=qLkm2lFxiRfoikL06aoqMvV6VElHg1ikfEu9gSpE+cnj+FmUU0S0pZFuTSNo2e0SJo4CPw swL1Gog3ECac+86KRlPnjLPQdpmIQi/QJYR6carZxJt3sA0Ovi00HtPSWPbRzeCtt4XRkP N58X5/6SAMMtEYXxDid93t4x6I4Lejg= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C7711CE175C; Fri, 22 Mar 2024 08:34:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6D24C433C7; Fri, 22 Mar 2024 08:34:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711096480; bh=JrD4352jMaYHyAz8IW4Sk3DaQV9z/B+p1XK/ErSE0cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZsUV3DTdJGLOu3ArzMd4oBovBPkSTl3ExBe2TyrGm2/jsGBl0k10Tvb00FSPq3S6 HrYImJ0RI3HDEKE7ufsczVtoViNfJEwZN9YIkae2ZLk6e3LzCTFevFL5JDTvjrfEi2 1Krww+MAEQwxg1AHgGsJp/Ixwx4wJqSIL3gSdw6vxRe5OKsZC9Q1IKRshBGsMmOMOI CEvi84IPNAKHdOC78TlZvwbMIAMRx/CYz+BIm3cTd59Td9FnlatulZGWWUAh0h/2Zo QrPXJLuUfcwuY1AVKIhMNeokjf9qdt96JM8SbuxOL/2KIkf6uHch3y3hWX9UK8wv3P OYqn8jLHP5OCQ== 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 03/14] mm/ksm: add folio_set_stable_node Date: Fri, 22 Mar 2024 16:36:50 +0800 Message-ID: <20240322083703.232364-4-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: 98D7E4000E X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 3jnbxomfgahmswkfyiqq8ngt4qgpt51g X-HE-Tag: 1711096485-74302 X-HE-Meta: U2FsdGVkX1+BtBuVR2u1qCdDTo7LfBHOwJE4wpXZL4roQAaijIQvlp4aYDEGU2rdqJPR3YX7HuEvouvkSLMiqE6JVc157nrOOSKZQctguodfadUsGMGf8y+HHDThVSuPAEP3CGL0Vrba4W2PbiGU+l5y9Pangs/mIfWhhlAe50NkFYtbwgggKbeQ9CJV8/76E/a2qdOP5hCL/2F4U9lJfXVJD+CBFoXL9g1oOPFqmYsIiaDYYYZbxh1SEU5PE0bIQ1fqZmWK3TZZ2DVLxSIkQdAZSaOrYNxhBOXhR16m7/1yIWzpy8ReD8sdWL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Rsagy3g6vaZOva99gFbajq/E4ayayUNVsRd1lcUU7HElSIzv1cX6oUfNa+dbHeFh+WF9nI9FK5fwDehrdfBcW7qohiH9gj8Xy2UHX+plur5xbqJeg+aTOv/9 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)" Turn set_page_stable_node() into a wrapper folio_set_stable_node, and then use it to replace the former. we will merge them together after all place converted to folio. Signed-off-by: Alex Shi (tencent) Cc: Izik Eidus Cc: Matthew Wilcox Cc: Andrea Arcangeli Cc: Hugh Dickins Cc: Chris Wright --- mm/ksm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mm/ksm.c b/mm/ksm.c index ea3dabf71e47..c9b7c5701f22 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1109,6 +1109,12 @@ static inline void set_page_stable_node(struct page *page, page->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM); } +static inline void folio_set_stable_node(struct folio *folio, + struct ksm_stable_node *stable_node) +{ + set_page_stable_node(&folio->page, stable_node); +} + #ifdef CONFIG_SYSFS /* * Only called through the sysfs control interface: @@ -3241,7 +3247,7 @@ void folio_migrate_ksm(struct folio *newfolio, struct folio *folio) * has gone stale (or that folio_test_swapcache has been cleared). */ smp_wmb(); - set_page_stable_node(&folio->page, NULL); + folio_set_stable_node(folio, NULL); } } #endif /* CONFIG_MIGRATION */