Message ID | 20231211155652.131054-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 0EC22C4167B for <linux-mm@archiver.kernel.org>; Mon, 11 Dec 2023 15:57:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DAE356B0119; Mon, 11 Dec 2023 10:57:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D2FD96B011A; Mon, 11 Dec 2023 10:57:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA7C46B011B; Mon, 11 Dec 2023 10:57:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A335E6B0119 for <linux-mm@kvack.org>; Mon, 11 Dec 2023 10:57:51 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 81DFF1607A7 for <linux-mm@kvack.org>; Mon, 11 Dec 2023 15:57:51 +0000 (UTC) X-FDA: 81554993142.26.098F554 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf30.hostedemail.com (Postfix) with ESMTP id AF9E18001B for <linux-mm@kvack.org>; Mon, 11 Dec 2023 15:57:49 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OZB2h8yN; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of david@redhat.com designates 170.10.133.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=1702310269; 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=6EJB9NGtrAo1f2+F9yoIp/qkcy9rFrccif86+rqYixU=; b=vjLzDHv+UxTTqEaSODEtIFLoxfopIjszMEf3vyQz1QWpKW7Zy77mj/ra0D2VJHM25KIQwV SDJApePI/1xmvGH4mGmb3vIWSLjDfBohZ/NdwgBDlAlNvrgsszTBOEip9O59LI9G3K8QXX +4xKt9AZoc+/4kyr6b1BqMWnCoAtV5k= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OZB2h8yN; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702310269; a=rsa-sha256; cv=none; b=Z76zrAmoKMCRIzp21c06kPrt+sPd4b22W2kZ7X16Mok/gTJ5kpPV2cOG2fDiSYxsvRf/UT UzlHGC8MU/L56Iilk0PDh7z3I/+HaV4L4CZ+aYkQ8nTW1JU5sS75sTSNz4DmSV5zbP7be8 FeryjSlfHEei4vAqKIkIFtGYweJrDaA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702310269; 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=6EJB9NGtrAo1f2+F9yoIp/qkcy9rFrccif86+rqYixU=; b=OZB2h8yNR6wjBuya4G/w2HVruSvog7S6Z3Zq5ttjb0EY3haMICk+hPf7zV2INahKI0+UqO HuT7kkLy365cPFUROgP3SAEZGn2YP9pkrzfKMaoq91Q5MDMxJMVKTpPO/95ntdjx4jmmf7 0R3s+s8SX5hA7pbR58y7leuokn1TsZ8= 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-418-_8Xjipn3N8OVVf8cQocN-w-1; Mon, 11 Dec 2023 10:57:42 -0500 X-MC-Unique: _8Xjipn3N8OVVf8cQocN-w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 9971B101E155; Mon, 11 Dec 2023 15:57:41 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 587D01121306; Mon, 11 Dec 2023 15:57:39 +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 v1 18/39] mm/ksm: page_add_anon_rmap() -> folio_add_anon_rmap_pte() Date: Mon, 11 Dec 2023 16:56:31 +0100 Message-ID: <20231211155652.131054-19-david@redhat.com> In-Reply-To: <20231211155652.131054-1-david@redhat.com> References: <20231211155652.131054-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Rspamd-Queue-Id: AF9E18001B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 5a8gf6i5hnbf59yikzedhry41rgh7x8a X-HE-Tag: 1702310269-988896 X-HE-Meta: U2FsdGVkX19IvEaknkIbnKIma60CdBcS2YgFCM9+UXuBeJH+6Usi9mg2Eg+BiBRQiLQk00CKeFZK4I59nxjETk6iM9w6ZJkubbUtLNX/+zS73HeFXsI2u4+hREqORucCgjpYXem4bJhGWqBUcBYwlts3LOMmiirItm7VYgpvEy77oaYvtO9xGmvXPIZDC96t3RQbdd/3lOLh4D2OFrx7M0I8ubTvJShaQV/OPMxG6l6HnQdiv/oLJ2p1PbJLrCBbkBGGbm4GugmSQg8q82A+6hB687gZRHG7vyr7dilBSqGxYOYubH4CicDTkBc1ipnCnm/lWxjg8YEddV03FpYZlI8CKlgZVkwRQdsWi5R/GDC4ZdzIL54rGO4Ydw1NL6lBYGG5fndmr0agaGe7d/SIa3VtlR+TzzJOtkafw5pA0ZuAJtKVIFwfRqo13IwvN28kpYD2tv5zrNE8U2dTew7GeAZCRnL4no+OiZ6PchnK4C+d6tbcKjiZaE1lm4qH0McM90msavrOMgv+eOUkVDqoKVDc4Mso6xMklzXG2D4EFWMNw1XGkr09od+nAjyZMIDCfZDR3EzQQ6qI62Be47yCamFx9VW+6RY6lIZtXz8i069ZRtuqcNjf8mpTulk6ndox0/L+gkAurSJP1gUdRmk9ieeK1iIFrXijIxdLFu26xkf4vhORJQZVnVK2U7UVLXTsQIdKils8VPR6n/9idWmoJDiPXRMO5i/xM5tWQeGh8VOSUOj2dyVWqtPZHeuoUNxYtQY5FnhVoXVjPicacQn187ZwLdyV7bQTvCfsam8mEaJ0estX06FzE5WZR5tjii5mYheyhl2ry3GrKFDgyNBC7C2H3c53lA+3Z14G6Zo06pHnNd63su2+46ORcGW7DEDBKEFrIWy2EpDNvrpwv68Kq6gHfhQev21e9z68TOncSAddgwyiAwlglDiJ00MPjKo1Fs6CaPDHPKBIZg6SG67 M+K3LvI4 j6Nkp+3gllpSloXHi/3d9eNMVWR6iSW+ZaOTgVhyPKiz/GUm4wp02EzHPfnVMf2ac75c06UZzut7wG/MIxYHvRHzGSV3Y4/qAaxiJ+uOgBqOGmVGpdrHrr9tzn4he96UO/O+2mMDaBlI8K1Wb1BnSNaUg9SQaIq0FHKkQgQscERXH+5klaRMPNH7asXICYq6n343XXSbnD6pnRWFW9KJvz5WVlQ== 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 b93389a3780e..2b6888ad1470 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(-)