Message ID | 20231220224504.646757-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 F263DC3DA6E for <linux-mm@archiver.kernel.org>; Wed, 20 Dec 2023 22:46:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2500D8D0019; Wed, 20 Dec 2023 17:46:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D7518D000D; Wed, 20 Dec 2023 17:46:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 003418D0019; Wed, 20 Dec 2023 17:46:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id DE25B8D000D for <linux-mm@kvack.org>; Wed, 20 Dec 2023 17:46:16 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B6A57C060E for <linux-mm@kvack.org>; Wed, 20 Dec 2023 22:46:16 +0000 (UTC) X-FDA: 81588681552.30.40F842D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 121C540020 for <linux-mm@kvack.org>; Wed, 20 Dec 2023 22:46:14 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Qzx6VMY9; spf=pass (imf04.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703112375; 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=I1ebH8KFDZAwQmMcpL7CVfnw0D0yWryPChREMd0TJrI=; b=T/MEKdcZMN+u7Haeg8FN1f35cFD/QhLNOKoxzfo7200qU5U38LpF2rpP2/6kfyKCYeIDtW M2Zz7N/rR3AVerbEQSWEGTKgjXHpkp9z0sdoI3CKJpAf98rnC5+rOd7tRYI4TbKYGftSYr 6HA3JbvpLG98L/1sTb9EUvhbw64AsFg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703112375; a=rsa-sha256; cv=none; b=ct6isK95d5CzKPe+N6QItB776YnSL2Wv2/7VRMDXYt8X1qzoVHKwXsTdgIGv4yTZa4/2yk yGihGPQ3p+HWBGmzXOz/h1EgECEPU1LmQDw/+Ryut+nZWDFVQshPexWsYVjcqVxNAgel0m t8e3HqWNqqIaG0Koka3Hb+RbD1NKM/M= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Qzx6VMY9; spf=pass (imf04.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703112374; 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=I1ebH8KFDZAwQmMcpL7CVfnw0D0yWryPChREMd0TJrI=; b=Qzx6VMY9tescPO2U+WA1J5JTpUj1KyWwlVb/yOuneqg2Gz6TXVSe0eYcJwjIPMdNo/HREX u4UXWCKRyaNJH/V+TBYhcb5yU4u8hcgrVzRqMlbLu2Ul/+4OJRQxVmkmK3/FupCxHsNZcW I/zuC83P557ziqa5pPnaj4qYwjsCZTA= 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-102-rl_PLPfaOFO5EtohbY1EwQ-1; Wed, 20 Dec 2023 17:46:10 -0500 X-MC-Unique: rl_PLPfaOFO5EtohbY1EwQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 AD8D4101A52A; Wed, 20 Dec 2023 22:45:54 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.192.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D45040C6EB9; Wed, 20 Dec 2023 22:45:52 +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 v2 18/40] mm/ksm: page_add_anon_rmap() -> folio_add_anon_rmap_pte() Date: Wed, 20 Dec 2023 23:44:42 +0100 Message-ID: <20231220224504.646757-19-david@redhat.com> In-Reply-To: <20231220224504.646757-1-david@redhat.com> References: <20231220224504.646757-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Rspamd-Queue-Id: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o7 DZ5b7IJm kI9oH+rpxfCh1RTaglQsf6CTTU9xUGM3R4nRjtnVzykGccRG/yey5IZDoGagOaNXvIoYzap7AFGsSALSNwFnpvMcGa4OxiDZYK0OUrkL5Ax6rvCzPhRKdkl9Ffre7UlzHHM6ttmOEHuzIlTxbh0wSPoAKMyvCPPhTh8vBHKWss9KBoFeUb0zmKEKyhEIXjxjHjGwOxtl3Qy20Gu72iTRLtTnjGQ== 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 8fa6053a225d9..146aa75fa6ff7 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1369,6 +1369,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; @@ -1408,15 +1409,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(-)