From patchwork Thu Apr 11 06:17:04 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: 13625441 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 3C38DCD1297 for ; Thu, 11 Apr 2024 06:14:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC5FA6B008A; Thu, 11 Apr 2024 02:14:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B75AB6B008C; Thu, 11 Apr 2024 02:14:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EE656B0092; Thu, 11 Apr 2024 02:14:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7EBF96B008A for ; Thu, 11 Apr 2024 02:14:28 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 135A1120A2D for ; Thu, 11 Apr 2024 06:14:28 +0000 (UTC) X-FDA: 81996236616.30.416C55F Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf24.hostedemail.com (Postfix) with ESMTP id 38E3A180002 for ; Thu, 11 Apr 2024 06:14:25 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=IeCaLcCJ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf24.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=1712816066; 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=bB4WH2pM8jvLy/cxq8hHZnYa/Dl93OmWdGl0309FAUY=; b=GBzS65xkT8nJ67xtwe3ihJLR68N1R41csf23sjedAspI2cVc+Qc+DNak6cCA3LIXHhP1u8 KYUBJv8aLMdcPR2Jphfzjv46dzVT9mG2AinGiJ/TQ4oJ8coWtkJ+UscgXlIHNw6Kymf3sp TQxutb/SHRp5xJVhk88PiQNP5kHdVyo= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=IeCaLcCJ; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf24.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=1712816066; a=rsa-sha256; cv=none; b=3Hh2e5xJDvg6mHBE4FzmCvOat2azxIuuZ8kK/PnclggOFJYR/0DO4sA78Q0KpYxAGsVdRZ 1BTqmUoLE4VyUhLq4aYnuuewnDlLKjajAHhgE5Nq/Yo57a61Ncl8CQ6aBR9xEZENST5IVV ocOQ7PSehfHkmLmtroh+HeDCTvKdhXw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 43A7DCE2F10; Thu, 11 Apr 2024 06:14:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF6C0C433C7; Thu, 11 Apr 2024 06:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712816062; bh=qC1mthl25nwOp6y3rOKx92fTxAINpkUFXHoU2+YaTrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IeCaLcCJY1GT60Q7AK9seqx+UVCi+HEDRS5ESPdYFwWmaoRyhC+uf8a/tp1U0dwjT wt6uBhs92tZ7dBvQAr+9+kTUJhGOXqlsZ006oR64EZ1MC85axd3cARsi2cW3k23YRX uLnA3kT7VS+kVAk04VJJBr4LxERj6mfwFZ+2LoOMpc8wlCYJgEKWVGTgQVENb+Mems C3vD9bBLeWtulpk4I7Wa+g01SjslvX8DWmJvfnMgz8WhRM9emVqFyfZSEQpbnQzwTX lMZCl8JaL46hQAO17OlxhJS3dshevOSZB0qc9ifR5HdY5RwAu5x3ZEfH+wU6dzA+xI +s6u98GnpUpOw== 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 03/10] mm/ksm: add folio_set_stable_node Date: Thu, 11 Apr 2024 14:17:04 +0800 Message-ID: <20240411061713.1847574-4-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> MIME-Version: 1.0 X-Rspamd-Queue-Id: 38E3A180002 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 8mwuzjmcc5nfqa8wkk965dc4xxjspn15 X-HE-Tag: 1712816065-322878 X-HE-Meta: U2FsdGVkX1+RH8uv4ipMrzlntoAEFXWmKFuN1W0pbq4ghwRoudpieXQJBUzSVn9YgyILb5u7sGf4GgvAn2dSeNJ6Ve62zlMMHAlXzN2b1VIaeeje7JFyLC7T6UCpkWLU6iyZiKLdax75roZ+b0rFMSbGl18hifFK73XBqiLh+PhTYfvGEk+N3N8KjfogoL0ABwQsTvA21yOJ1sMVFUIbWjcKzRtTJIw9MiZxdw4SvK48Kg+MtJQ62H5yZx9MwHYOrl0rV2i9aKsjA0lzaPLV8SUjfvUxBWcrjQ43Tq+4wYr4twgupp2y9tyvctKtU75FFSvSPsgWcFaBKkL/UjqMlbBjoG8OEgUODGSlFhwJu713tGVs6SKJjTz0xNH96YkY34bYCnhTLNkOiEk+YMtsWM7ADMCQPyf8mGJPOVeUz45jtfng20njOlTW0xzt6fyKrmzLUn6DSJVlDw+VJ0qJh9FJk95TbTmaSkmXY5YH5HKQIfK93KKH9wHndBuFT+2/XXq/PJz2ocTnQnacqr/WWjohgGkIEz2ry57YptsqVxMrDIF9u2FKdw+z8NGZExhi9Ne2eSnKpymlfXceNiV2od60MC7WwDi9tFmzbecqNVIxbvZsMXaMXqCcnXTMB+R1Lw37iqa9+LXlCeArVl2VmJiJxsiguhTFk7XxTKOZjiJznRfC7syd/jWt6Y0cyuJbAK+R73h6U/pC+ZRuuZpzUkIj70GKLTLBpthC9v2ESnxAi1ScG45u1fR2A9PFH0OnVsRuv/B/ia9W/Qv7s5pXUXY6lwVMLgKn9IIwhlIVOMDjIbWZeXOxKxw1dsE3eU43royZRZRk4wzgNQAtGNa+uBu/xfUFinN6nzMQ3J44lBOxqmdQ20R35LibNiz+Ylmpe+19Fi8xJlBdhka3wd8txDjvFsQpyAnVfibJMqLgOyhNoXETL2xy+9n0leiC0RpyIDl6toDJcZkWFe5E9wL Ry5gyvfH df2tu 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 Reviewed-by: David Hildenbrand --- mm/ksm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mm/ksm.c b/mm/ksm.c index ef5c4b6d377c..3c52bf9df84c 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 */