Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2757607lqp; Mon, 25 Mar 2024 08:25:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU31JKwUs6GqkhEyFHnHLIUk+ElA4g7PGbMVccp+Jun7ZctZr4U9xJdcErJtkOfI6rozNgeZS3AtjlUK2J6QnwP9OKI1XI6XJMVGinohA== X-Google-Smtp-Source: AGHT+IGqC39CrdDnUKWtDs51HoHodfZPjpYiV/X4fWhTni1wAiOcnQqrJDP3OsWzlqr+FAIvIixF X-Received: by 2002:a05:622a:1ba1:b0:430:d1c6:8cd with SMTP id bp33-20020a05622a1ba100b00430d1c608cdmr8699838qtb.24.1711380327820; Mon, 25 Mar 2024 08:25:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711380327; cv=pass; d=google.com; s=arc-20160816; b=fzsIKusQUOOkWkVWFuQy9MGAMiUiPyrAB95taBnBTjmp2h1yn4h8daWILwk/XSo9+e F2ZBx/rph/L3TLBCxSpFi3l3ei1gXcSeza4I3sJe0okul9Zzfd/lJe9VXxmpKYAL+rnD PZQlGyHmBtlH8IsTsXBfmorKhGAOdjykk9oKNgmLWU4JAbSzoyNthPwbTqoATtAenfSv c0iN8RE3Shuhv87SqD2lBFZzM196N2vyR6LYiEjUq6guu1d3vrSPOT0dZApQ+YoBxfCj zYJzT/nKqnp0eBrropJDc0j1n/Gq4VtPxjqwu0KXJFmdpG+01KbZ9Z+UxQY4t5QAmMwL D8HQ== 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=CgdU2ldzb6Q1lsQxi1OyvuCL84QsEiZRjwXqHJ8gUzE=; fh=82Tkto9wLAThGWFPjMOHQAMNM/SHGFFIudThbRSmfJc=; b=Ve0hCYGWIGgWW7VDAsm8etMJfDwmJwFNCbZ3IhiuiJdWN30rL7DEN/41FX4M/CTYgD I465BRu+IC5lhubgR85kYIVuxLa4BTn14jKZXSoaDWx4OZMW67GqOcEwezSIe9bNbpDT szdkuumEiDppD+7VrvNvb7EzgGYXicX5N3MGTU2XAa4VC01JCKsXegZ1dFu59MSXQm16 hFRSmnZzhg4bfc0i+YaCXCTgUYA/Fc2GH5AALVsh7bBLlgjnaowxtHHO22hhNfhDoL7t NHBAsMo8TTPJY+3pxdaVEkBYzeaCOfME59IockXmGrhCOljEHsmJ2CYSmEth/TXWdFNQ GClw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q6AU0w0G; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117041-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117041-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id cc10-20020a05622a410a00b0043120a9c6d2si5873701qtb.318.2024.03.25.08.25.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:25:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117041-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q6AU0w0G; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117041-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117041-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 8053F1C3A3B0 for ; Mon, 25 Mar 2024 15:25:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FED115EFC1; Mon, 25 Mar 2024 12:46:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q6AU0w0G" 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 C00FD15EFB3 for ; Mon, 25 Mar 2024 12:46:07 +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=1711370767; cv=none; b=KnN9ClpG3suHQela3qbH3vZZ6o55uYJIIvHGa577axp310k8ubgRnKD/PlNGotFXbeZOdK7d4/yhRrtDBA5y8whH+57A6LE8cgkD3UKX8kFZXxFSWubTtzs47JaB4qA0dEJjoIJEBtlEjgAbu05Aqwzw6g5MCpPoDf6bkzFi/PY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711370767; c=relaxed/simple; bh=1FMqhrTGzv5mI88ql04GgunChyuiZ5EvE2fgo8IbQMc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KVQej9VM4x1cD/m8Hjr1FnDIAztOpwXvScaZd7qGbcx1BF0hUeIwTpyNjHq6vKMXaedkwr9+iT5VehGzldvJv2o1UzS5AQTRYgp0KUIGIdjbAQgTytjFBF98MpH/Fmg28xJ8LHi+8mxNLLEn46aOh+pE8rkagtZ5MAA+zCjzcKQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q6AU0w0G; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71F09C433C7; Mon, 25 Mar 2024 12:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711370767; bh=1FMqhrTGzv5mI88ql04GgunChyuiZ5EvE2fgo8IbQMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6AU0w0G/erVGHeJFCX8w/EJeqQFE15Jq05PpOfDQBhQz0mLQRG3ULcPNL3SLertO hm4n2HJMGH+yHfEe8vGRHIR/elq9l+W/2TbpJZ2GhGaruVJ01wKwR0R7Cmca21hYkV xFOaBsAKY2ZQPFpe4yhgc4Rzny2PfvvMx/gv6TAdu0j3fMV7kgXUoDoZaBVb4GU+2y /aPGy4PlY/7p0uinoDfWfyGGQWsWOd+zgrV+h+f2TvnIx5fTUhmTu7a4xO7oracQtb ZQnNvcIT7N/spzY9RL0DCzzdiFMFj8Q99B+mVOCimWgsSOHsYZEdx6ErXYixa63Cz6 YAE22wFF72Aog== 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, ryncsn@gmail.com Cc: "Alex Shi (tencent)" , Hugh Dickins , Chris Wright Subject: [PATCH v3 08/14] mm/ksm: Convert chain series funcs to use folio Date: Mon, 25 Mar 2024 20:48:55 +0800 Message-ID: <20240325124904.398913-9-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240325124904.398913-1-alexs@kernel.org> References: <20240325124904.398913-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)" 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 5d1f62e7462a..7188997437d3 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; } /* -- 2.43.0