From patchwork Mon Mar 25 12:48: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: 13602019 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 EDAFBCD11DD for ; Mon, 25 Mar 2024 12:46:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E2536B009B; Mon, 25 Mar 2024 08:46:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 48FFE6B009C; Mon, 25 Mar 2024 08:46:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E43B6B009D; Mon, 25 Mar 2024 08:46:02 -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 F37996B009C for ; Mon, 25 Mar 2024 08:46:01 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8FA22160314 for ; Mon, 25 Mar 2024 12:46:01 +0000 (UTC) X-FDA: 81935533722.18.909FF47 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf15.hostedemail.com (Postfix) with ESMTP id A858BA0019 for ; Mon, 25 Mar 2024 12:45:59 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Whi5pHJZ; spf=pass (imf15.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 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=1711370760; 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=ABgoUDx4kQC8DPP1uIFB29k1u4/nr7MchoGfP3NlrxY4fC4FS/s0fArjjKKvS8MLKfhS35 njHx4oAt+We6+3wj9j/Bffd8cLj2D5Dz2mheDrgJh6S8AH0iM1hHqzsQS68bzZlGR0A6u+ 6vFJGIwto+05qbTp2JvoP8iHC5OgXGs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711370760; a=rsa-sha256; cv=none; b=MljczajELPSu2EVXzv6/bucQJqXKTrvXDrzZAoLwmsRXgg2WGw6GiZtFnCYf/uGILY1/fv htPK9KgxreX3GPBlUGP9wC6FZNBC2ZWhvtK7n8h74hF3PvcGxygqRe3dZJJyjVNn9JkicP 4CNN9uP3o49eVORQXJSwwivuBGi+2uM= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Whi5pHJZ; spf=pass (imf15.hostedemail.com: domain of alexs@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=alexs@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id EBC49CE1799; Mon, 25 Mar 2024 12:45:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05091C433C7; Mon, 25 Mar 2024 12:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711370753; bh=JrD4352jMaYHyAz8IW4Sk3DaQV9z/B+p1XK/ErSE0cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Whi5pHJZTUlUd6zeuH0lUbmTWwy8sj968vK2RQbExjSv4J927iQXRAax2+zqP3+8Z syH0Miydew3n+dIqfFQbEdodShg6okCztcVT1q/0589fuGXcfUyzduK6ZLpruSDHQG 3ZJJAaqW+jGIx0FmJUNVsuUy8O+V183kQWq9ZI5P+NnBZUHq4iLWx8Si409N3S33xo uUtJvUSWMGqZ0Dn4M3kn9lOThpHWghQ3aPLhvV11Zk1dkPmeiEWNNzvj1Zp9e2UbXj ga9Fu+iazyMERJXJ+ZWG4V/8cwEH/THIP5vbAm67Aj1t2p2C3InwRy3kCtGkNu6HGD i24BIgprJ7qvw== 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 03/14] mm/ksm: add folio_set_stable_node Date: Mon, 25 Mar 2024 20:48:50 +0800 Message-ID: <20240325124904.398913-4-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> MIME-Version: 1.0 X-Rspamd-Queue-Id: A858BA0019 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 9o69xdw57x5w9913kbshdik3nj8tde9w X-HE-Tag: 1711370759-728307 X-HE-Meta: U2FsdGVkX19eK3xHK8xgbq5wXubEsRcaJA6dR+8qRK+QtU0tp8QRK+Rsjb9qWjHvaw1v8RHJruVBGrVM0qh5jDDaFURT7ShHR6J26B5vwYZ8yR/iLeLF3dUkMpBG0e5II8hsVh2MZwejccHyycjHEb+mRRgAPWQCj0aPwOwRha5uQ2MT7IShZ/W1blbD+gx5ZgZxTY5vaZNkOnBiTIda+QZd7RpIsl/oKYiFg65LACaV8vPD+C8ClhK+YN5FdpgJtUrg9cVE5SNKJY3c24V6nLtWYWTFRmHSqJSP5XBoIezAJqZwGUVp0ScO11+H5/jJiMGYjdhDGVPBxIULYy7FqDttyk9HHRcq6glhbvCFm6JLFPNie/gM1FRhOAqNtVZSOfknYAszEJCErfO0oAv7NFXi6c+hHgxaM/zrkTWx9r/Bgyn4Id6vdpgvpGb8wlezCJrKh/nleImTwKmrxlt/KQS8HA3QehL7X3K9MpteM2zv+Dd7A6cWRyUY6qqQFavul+M6rKm24uLQWexvP/IoCoHndqjDtNAqG3DR1lOh3wHCw8+b1wvyf9AMW++Qbjce0602494/vHY944hRAYG8tuuXUgCDPoI6fAeAL8m/IvchP0VrEGeYlkDbcfRUTrEjYl2JslM24MJGPdLnXtlSmaE9oBpML5Gbc72VamM7cm1VEjQA/m2Fe5ak+xVO0ydMCUfh8EZ0g1TtctMQj/x5eAdapaIx1QuHDekOo3VwfMTjluZpAmwjObxcW36AIJVM7JhDTkUXfiU24eGHxooLhh6lSlNdCeDbjeCp6HKQkZZQwzDz7w1JQI2aDIVnXTQmZA5qAdT5L30fodkJwlR1P8JhsGFvLp+GTqxsxTTZv4hFMmkDeKb+3jxu5Zc4Bz4asY6Q96PY/phT1jyssLZC9mt7fEKZHx5I2Bo0slGL8E/u0E8oPvzb0hhhSGgJc7UK5zTyoNTHPuV6ty8dMXJ B1OgcsQW s2ThV 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 */