Message ID | 20231204142146.91437-19-david@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 A6398C4167B for <linux-mm@archiver.kernel.org>; Mon, 4 Dec 2023 14:22:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 337FC6B0293; Mon, 4 Dec 2023 09:22:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2BF916B0294; Mon, 4 Dec 2023 09:22:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13B116B0298; Mon, 4 Dec 2023 09:22:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F30FE6B0293 for <linux-mm@kvack.org>; Mon, 4 Dec 2023 09:22:30 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id CA90D1A026A for <linux-mm@kvack.org>; Mon, 4 Dec 2023 14:22:30 +0000 (UTC) X-FDA: 81529351260.09.52E68C8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 16282A0025 for <linux-mm@kvack.org>; Mon, 4 Dec 2023 14:22:28 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="W6/d5Sg6"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701699749; 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=MP2FAIOx2jsvMIhG8WePR/5GNOuXZxiB4Uil9+VePO8=; b=F6kdxPPaS8raMR7asZTQ1G8trK8JuuaRV5YkwEZW70kU4iMmlyNwg7RuB8E87EBRuSlram 3ubwfZITdw7lKMdhWiDNt3vXy4p4NL2oyKhKsCKr5DCvLsb2+3UpGHHpt8iW7VE+SqNZyl Lwdd1ZhVpHXZctJcIucDsXZ1jvgNrwA= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="W6/d5Sg6"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701699749; a=rsa-sha256; cv=none; b=BAg1XGqrhIDhiWtAjQtLGQtlOAUfyKpFf//6F9shznZ4D7IRt1Vb3kphlLyccd+mOmpG1o EIzrDBOe8vlAAJ7bgQJ1o/U8slhY3kYK8nT+d058VnhfXcij/vffrnvhStFK5cb/qbF6yd xAgaYoH/RDNJGK+EIM5EHApilGidsLs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701699748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MP2FAIOx2jsvMIhG8WePR/5GNOuXZxiB4Uil9+VePO8=; b=W6/d5Sg6AE7Kq96Q+vn08Ly0rsw/Ju/G+T+TWQr9Veqk71ZZuPBCzHWZvWrTfUpyd4eY9R 3nQvKj0K9XitmP/5mJvTa5FJfv4+TaKhtuipv0q9jpS92AuFlGO7DfcOUT2J4b8zmgMReN 6HS0iP4nTaIAjiBsE2101zu1uj/3gkc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-81-b962mDT3OiSU6I-NXCof5g-1; Mon, 04 Dec 2023 09:22:23 -0500 X-MC-Unique: b962mDT3OiSU6I-NXCof5g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B19389CA0A; Mon, 4 Dec 2023 14:22:22 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.195.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0BAE2026D4C; Mon, 4 Dec 2023 14:22:20 +0000 (UTC) From: David Hildenbrand <david@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand <david@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Hugh Dickins <hughd@google.com>, Ryan Roberts <ryan.roberts@arm.com>, Yin Fengwei <fengwei.yin@intel.com>, Mike Kravetz <mike.kravetz@oracle.com>, Muchun Song <muchun.song@linux.dev>, Peter Xu <peterx@redhat.com> Subject: [PATCH RFC 18/39] mm/ksm: page_add_anon_rmap() -> folio_add_anon_rmap_pte() Date: Mon, 4 Dec 2023 15:21:25 +0100 Message-ID: <20231204142146.91437-19-david@redhat.com> In-Reply-To: <20231204142146.91437-1-david@redhat.com> References: <20231204142146.91437-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Rspamd-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fys4pbSQ6zm/ MfvYwdlx TMhJj2t9JgVRrqdWIQ3EnTYgzxbc6WKLzTG6UuNomsyfSMGxSLu871hnjX0+0EgAZxAWBe2HlShl0PMK56eBr1dv6HJS4AGtNO+aZzdp3h4TOK+EKH69FdeMsu+65Sgu17dq3m7JO4os8/Im7a+eFXUfgE1/03fikoQ3seQ0Vfqw+/sKHAAfn83tguePnCXakY4SqSmWNbPthQz4ehHfV1+Mi4Q== 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm/rmap: interface overhaul
|
expand
|
diff --git a/mm/ksm.c b/mm/ksm.c index 6a831009b4cbf..357944588a9a9 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1199,6 +1199,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page, static int replace_page(struct vm_area_struct *vma, struct page *page, struct page *kpage, pte_t orig_pte) { + struct folio *kfolio = page_folio(kpage); struct mm_struct *mm = vma->vm_mm; struct folio *folio; pmd_t *pmd; @@ -1238,15 +1239,16 @@ static int replace_page(struct vm_area_struct *vma, struct page *page, goto out_mn; } VM_BUG_ON_PAGE(PageAnonExclusive(page), page); - VM_BUG_ON_PAGE(PageAnon(kpage) && PageAnonExclusive(kpage), kpage); + VM_BUG_ON_FOLIO(folio_test_anon(kfolio) && PageAnonExclusive(kpage), + kfolio); /* * No need to check ksm_use_zero_pages here: we can only have a * zero_page here if ksm_use_zero_pages was enabled already. */ if (!is_zero_pfn(page_to_pfn(kpage))) { - get_page(kpage); - page_add_anon_rmap(kpage, vma, addr, RMAP_NONE); + folio_get(kfolio); + folio_add_anon_rmap_pte(kfolio, kpage, vma, addr, RMAP_NONE); newpte = mk_pte(kpage, vma->vm_page_prot); } else { /*
Let's convert replace_page(). While at it, perform some folio conversion. Signed-off-by: David Hildenbrand <david@redhat.com> --- mm/ksm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)