From patchwork Tue Apr 9 09:28:18 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: 13622062 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 B7B73CD1297 for ; Tue, 9 Apr 2024 09:25:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DC616B0096; Tue, 9 Apr 2024 05:25:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4642A6B0098; Tue, 9 Apr 2024 05:25:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 303C56B0099; Tue, 9 Apr 2024 05:25:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 04BE66B0096 for ; Tue, 9 Apr 2024 05:25:27 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CDD27C02F5 for ; Tue, 9 Apr 2024 09:25:27 +0000 (UTC) X-FDA: 81989460294.19.3837401 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf09.hostedemail.com (Postfix) with ESMTP id BBCBF14000C for ; Tue, 9 Apr 2024 09:25:25 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=cHW5B7MG; spf=pass (imf09.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=1712654726; 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=jtkdWevEu3psN02cr3rISCmZfj2it3cnlRAxu8k3HO8=; b=S4xEAjN4n3JD8hT2qx5LgKhJU9ZDqxttvFvUqJau56e5NZgP9lhzs302IGIkUSZJdtvlnR 4VA5lytgyXVgb8uIo09/ZWvSUVU9fswA8YEUhv+UwlPGLOv2TIGf6GvZAXPkNnyliWvzBA gzzQe3VCgr3F5A5SEUiACdPXrRn/QYI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712654726; a=rsa-sha256; cv=none; b=1FX/XHxmt6Q7ohrwc7Pzb9YE7YWf/0I2eU6Z/inHoac0JDpVFHKRQ2rPTBHNeAexquTJuu iKD+frSxipIRvqhU7smFlcs7dx/21UScVF2i5ITEv4nTKL+x6LHUiQkveE5hgdotdKC+Uw sXOu3f3mTZoMv+qMZUg670c5/dSAbdA= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=cHW5B7MG; spf=pass (imf09.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 D9A9FCE1DF8; Tue, 9 Apr 2024 09:25:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66ADAC433B2; Tue, 9 Apr 2024 09:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712654722; bh=h5mTUeVzSSO40P/dqunWDfKwvbrZ6ROf/OJsSV/+/Tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cHW5B7MG3rTIH2E0eZCzzevv5RY2jP8XktDsl8WLKbwItLlisGdKj492muL5NV4mm av+RdTMeEMaMoDsAGubCuRkp+hARu4OGfmFTc85AP7jc7sAxULjkUcM7mdviojnabW 1H9tHT4Y8NVSSOFaPSkMeCychOjudYI9JrQaQ3D6p9Q5kdA3d7F2Jw0WxPEVL771VY CIJC3gE5IJ3yIRUl1QFORzLz2EPuU1CDn00wT4HkyOjJ3kdBDjeOyZ8OPD/tcw9G9I JZWAIQHvQRvw/67Tmt0tYZYZtispL4c2DpDAYtoivh92pGDWgK0hFcj8zklPe3q91p IPnjllxt9U90w== From: alexs@kernel.org To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Alex Shi (tencent)" , Izik Eidus , Matthew Wilcox , Andrea Arcangeli , Hugh Dickins , Chris Wright , David Hildenbrand Subject: [PATCH v4 3/9] mm/ksm: add folio_set_stable_node Date: Tue, 9 Apr 2024 17:28:18 +0800 Message-ID: <20240409092826.1733637-4-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240409092826.1733637-1-alexs@kernel.org> References: <20240409092826.1733637-1-alexs@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: BBCBF14000C X-Rspam-User: X-Stat-Signature: j57y7xfpx395or7d17faya5y5u7zkqha X-Rspamd-Server: rspam03 X-HE-Tag: 1712654725-438422 X-HE-Meta: U2FsdGVkX18MY4BuZf6SiykxpN0ANsivHRZg+FcMoYDGPvWG4m72H+bWrccFozhviR3ZBAtHK292CTPiA9nz0hHONsXZ8IiVaEbDNp8lKs/EzpTLkwzKAcExsdfxioo9Nods4FMMxoSpy+zZMezjni90FWj9TILD43a+McBzKg6nUyaBH4E8/MrziLj4wuH++Z5deA7p6SPQmbjHxzD/e8f/+yl3+g2LVhBJ37lttPOXrXh1N2NUZxLQONPE/94vnFU7PmNj/xNSs4esAFwo2nhXOBQwcd3qpSoLIg2UP7/MebQSIAlwm7xu3Fe3DTDfAbBNTJTXHsMJ+EX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i2FH5e3GukZfbIXCy86pkYyj7OPsAg9Sl/HkwvL3/eZaC4QCBVYX8dHQ5WA5R5lOeNsrYXEOi 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 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 */