From patchwork Fri Mar 22 08:36:55 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: 13599734 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 660F1CD11BF for ; Fri, 22 Mar 2024 08:35:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF3B16B009E; Fri, 22 Mar 2024 04:34:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E7A896B009C; Fri, 22 Mar 2024 04:34:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAAFF6B00A1; Fri, 22 Mar 2024 04:34:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A429A6B009C for ; Fri, 22 Mar 2024 04:34:57 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 80031C0C64 for ; Fri, 22 Mar 2024 08:34:57 +0000 (UTC) X-FDA: 81924014634.22.6E6927F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 8B3E740003 for ; Fri, 22 Mar 2024 08:34:55 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iSqvlKnQ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 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=1711096495; 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=fH8PCU7tcCjvM0wdZXSe9Jm35IXTtS/JFGEFHAYLlnc=; b=UC8EscLa8t/w0MPfuiDiSazCUxxbYr/fiRyZmGPwYv7cyJ7sgW/ungj6IPxCzfvTRAkJFR 9xAqpsbPzoi903m6TYhc2ZvFPaWECgwMypma3wwvaZDJFyhPg+CJm88KK7LgaWXFYEPxin e/OYSEVkIOWFqi2K3I+xOU96Fg84Hr8= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iSqvlKnQ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of alexs@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alexs@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711096495; a=rsa-sha256; cv=none; b=V1cwyzB3v3i3bSb8RUgaDcQPobMimROIzONsy81DRbFE1v7NORz7+strxFTkEA1vrzW+GY bxK3NENQZ5PsLRsPk9KWwwCR42re9UsZhlZaz3VxugH/uiXdD0KmVksc4nf42yFrNqtLqB 4pj9sM+JWSxM4dGpMoiciiyXSADsWjo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CA69A61405; Fri, 22 Mar 2024 08:34:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45184C43399; Fri, 22 Mar 2024 08:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711096494; bh=Czj2cXDjtWaQ7qWM/ntpEjf7pxB7Zlc771aFb0A0Wn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iSqvlKnQKbuzNlo/1UqKPoPip2scXPO84E9+9X8dNblrtlYt2FWgou2idLr2Cf624 8JDv38d4rMAdgz4MTUUko9xkN20vVseInMkafo4ridyT8QrSEK6mUIMSW1s2bGoCWb 2oA1/SD9crmzZec6ZPZSk2pUNViw39caL5q+bQOFPvg7lP7aJp0rZC7ZSkDGyd6tr1 fZxBXpnGQ83pK0lK/Su/GbJrSrPEaS2sLnmOcnErBD6joRlbQsbF4sqsMRfph6EfUs EJCIbyKNVbuK1tMDzHm/u1kuRYEqAnEIsJ/orGgHG7dy/Yqe89xaP0SuprV37NcFFC 2Stk7Cot+7HvA== 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 08/14] mm/ksm: Convert chain series funcs to use folio Date: Fri, 22 Mar 2024 16:36:55 +0800 Message-ID: <20240322083703.232364-9-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: 8B3E740003 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: z6oghs4s6y65r6oa4epfeh1u6ti53rui X-HE-Tag: 1711096495-258365 X-HE-Meta: U2FsdGVkX1+nVVa+E8omuxBKaeSTrKBD9qsqnmgheULhv1qYN4dloWYMELKD6Qkyf568zGREmtAwdm4G97aslsuVJ/58WVAovSXOH01yBpnGXkJ2xaGmaHeaMgXhM+x4fURH7wGfc4RjT3P/OAeO+bg58G4OvOtCuumV95kycM/9V9aEyDdxrcYf/r/JizEkZIJLs8wTRuJusmChzyuL91a5B0HB/vVk4k5QVgsl545E8hw+73a94UEKaQqOBdR7QJFqz33SWu+Ij34RQ9CwotdfyHwBk3GkMQtQ04MOjymeqaI6/yflilzbmNFjI9ZcuwZTCZq9p3zllN1Vw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0TRdQ7rwhST/gN6FODZYX0o+DhQKiw= 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)" In ksm stable tree all page are single, let's convert them to use folios. Change return type to void is ugly, but for a series funcs, it's still a bit simpler than adding new funcs. And they will be changed to 'struct folio' soon. Signed-off-by: Alex Shi (tencent) Cc: Izik Eidus Cc: Matthew Wilcox Cc: Andrea Arcangeli Cc: Hugh Dickins Cc: Chris Wright --- mm/ksm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index f41491cf13c6..30570e1f68ec 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1777,7 +1777,7 @@ static struct ksm_stable_node *stable_node_dup_any(struct ksm_stable_node *stabl * function and will be overwritten in all cases, the caller doesn't * need to initialize it. */ -static struct page *__stable_node_chain(struct ksm_stable_node **_stable_node_dup, +static void *__stable_node_chain(struct ksm_stable_node **_stable_node_dup, struct ksm_stable_node **_stable_node, struct rb_root *root, bool prune_stale_stable_nodes) @@ -1799,24 +1799,24 @@ static struct page *__stable_node_chain(struct ksm_stable_node **_stable_node_du prune_stale_stable_nodes); } -static __always_inline struct page *chain_prune(struct ksm_stable_node **s_n_d, +static __always_inline void *chain_prune(struct ksm_stable_node **s_n_d, struct ksm_stable_node **s_n, struct rb_root *root) { return __stable_node_chain(s_n_d, s_n, root, true); } -static __always_inline struct page *chain(struct ksm_stable_node **s_n_d, +static __always_inline void *chain(struct ksm_stable_node **s_n_d, struct ksm_stable_node *s_n, struct rb_root *root) { struct ksm_stable_node *old_stable_node = s_n; - struct page *tree_page; + struct folio *tree_folio; - tree_page = __stable_node_chain(s_n_d, &s_n, root, false); + tree_folio = __stable_node_chain(s_n_d, &s_n, root, false); /* not pruning dups so s_n cannot have changed */ VM_BUG_ON(s_n != old_stable_node); - return tree_page; + return tree_folio; } /*