Message ID | 20231204142146.91437-21-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 E37DEC10DCE for <linux-mm@archiver.kernel.org>; Mon, 4 Dec 2023 14:22:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A3BA6B0298; Mon, 4 Dec 2023 09:22:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 24B836B02A1; Mon, 4 Dec 2023 09:22:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F1C426B029D; Mon, 4 Dec 2023 09:22:33 -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 D377F6B029A for <linux-mm@kvack.org>; Mon, 4 Dec 2023 09:22:33 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B5CB2A0216 for <linux-mm@kvack.org>; Mon, 4 Dec 2023 14:22:33 +0000 (UTC) X-FDA: 81529351386.09.ECDDC82 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 16EE91A000A for <linux-mm@kvack.org>; Mon, 4 Dec 2023 14:22:31 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BBNBL3QW; spf=pass (imf19.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=1701699752; 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=YcgEyKtjLabsj9Cw4VckjmMQxcp5kDVs71EjXlBqC+E=; b=zeB5IZU1G9mXK+/8H+DtaP0ZrBOy4sOxIXzPDr30Ou+rYZVkO7gY4vzQDowGaXfXQ0tbno cJta8OcqmTZxVgUHD8aOI1uVp+ZYU0HhjcZOr2zFf+Oji3mdyHV14WEw2obXGeEMlrJCbn ZLfCLbtHZjIawSSTrkWFJ+OflD6W4JQ= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BBNBL3QW; spf=pass (imf19.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701699752; a=rsa-sha256; cv=none; b=Rb7dtR54n9QPk04WXMRNPOo/UToTrlhOf291CL95MV5p4qYJtJvOcgBCGA+seX7hT/7c+u yzS3ZW45rg8qzg8S1Qc3j3eAe/C2MjTCubdzeH5j1ZRJVmJq+t+wMvLeaeYwu/NfWOngpy 8LvjBtKeVqUmengTn8oihyF1F+Ebra8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701699751; 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=YcgEyKtjLabsj9Cw4VckjmMQxcp5kDVs71EjXlBqC+E=; b=BBNBL3QWhxrNegllyxURZlMhK5hkYA9nbW2PMgkNBJ69gpjZm7Id24NOwODrJlj0ga+TRT UiF1OcKkhs12NSjlred/OFhWPPu3S5r0kiiVfp1bew20KTLlIJ8Ww9CN9X4jw4Yd+RkeH4 tGpjx8JxkVptn988OGeuOo1Yle7tEVA= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-600-YeNg8xp2Pg69b3ArcI-xHw-1; Mon, 04 Dec 2023 09:22:27 -0500 X-MC-Unique: YeNg8xp2Pg69b3ArcI-xHw-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 464973C025D8; Mon, 4 Dec 2023 14:22:26 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.195.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5C672026D6E; Mon, 4 Dec 2023 14:22:24 +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 20/39] mm/memory: page_add_anon_rmap() -> folio_add_anon_rmap_pte() Date: Mon, 4 Dec 2023 15:21:27 +0100 Message-ID: <20231204142146.91437-21-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-Queue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dFb uMI3SrzU 38bhIYlKIi8gRrFPjCQLwWh6Z+ZBPxpcT1+gZ3OnHCgUvKNJv+nJtS0XNI0aXLtW0EXjY90P2PcsbvQxTR21w+6Qzy+Dz7jiYcB/Jbe/Wjb+l3VqL8XiAOGLxjQO3uoky3Q96BwfjA8kuIgoE67Hje3DqKp+2GVb2V1OdYLbLBRpHh39K9n9g27DN/bA4IYkxvjGx9VAkWqJ1Q8FN0zwiuUTn2w== 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/memory.c b/mm/memory.c index be7fe58f7c297..9543b6e2b749b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -706,6 +706,7 @@ static void restore_exclusive_pte(struct vm_area_struct *vma, struct page *page, unsigned long address, pte_t *ptep) { + struct folio *folio = page_folio(page); pte_t orig_pte; pte_t pte; swp_entry_t entry; @@ -721,14 +722,15 @@ static void restore_exclusive_pte(struct vm_area_struct *vma, else if (is_writable_device_exclusive_entry(entry)) pte = maybe_mkwrite(pte_mkdirty(pte), vma); - VM_BUG_ON(pte_write(pte) && !(PageAnon(page) && PageAnonExclusive(page))); + VM_BUG_ON_FOLIO(pte_write(pte) && (!folio_test_anon(folio) && + PageAnonExclusive(page)), folio); /* * No need to take a page reference as one was already * created when the swap entry was made. */ - if (PageAnon(page)) - page_add_anon_rmap(page, vma, address, RMAP_NONE); + if (folio_test_anon(folio)) + folio_add_anon_rmap_pte(folio, page, vma, address, RMAP_NONE); else /* * Currently device exclusive access only supports anonymous @@ -4065,7 +4067,8 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) page_add_new_anon_rmap(page, vma, vmf->address); folio_add_lru_vma(folio, vma); } else { - page_add_anon_rmap(page, vma, vmf->address, rmap_flags); + folio_add_anon_rmap_pte(folio, page, vma, vmf->address, + rmap_flags); } VM_BUG_ON(!folio_test_anon(folio) ||
Let's convert restore_exclusive_pte() and do_swap_page(). While at it, perform some folio conversion in restore_exclusive_pte(). Signed-off-by: David Hildenbrand <david@redhat.com> --- mm/memory.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)