Message ID | 20230913125113.313322-5-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 0293AEDEC49 for <linux-mm@archiver.kernel.org>; Wed, 13 Sep 2023 12:51:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4C3326B0187; Wed, 13 Sep 2023 08:51:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 44C9D6B0188; Wed, 13 Sep 2023 08:51:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C7F06B0189; Wed, 13 Sep 2023 08:51:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 075406B0187 for <linux-mm@kvack.org>; Wed, 13 Sep 2023 08:51:33 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C760C140277 for <linux-mm@kvack.org>; Wed, 13 Sep 2023 12:51:32 +0000 (UTC) X-FDA: 81231560424.03.7CA9998 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 2F3AE1A001D for <linux-mm@kvack.org>; Wed, 13 Sep 2023 12:51:30 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="P7/lLqsf"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.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=1694609491; 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=iURFDA2RdJWU1H9IedgFZuHwYBnEAwvtokGRQic4P+w=; b=5RXzCqPuRJ0DW4enF8/PJRBGRZh4/SNYcJJdSHAJZrIg/3ygqssXX5n8IdyF0MNPG7rudz qZcyWsCRowihyCNSrTjis7DPb/bA2zV8YYMHsimFicQJvnKqZiMZg7j2UE1ZcR0uP1VW4p SPHCkgYOCor7InAhWImdxv6xztHFOJY= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="P7/lLqsf"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.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=1694609491; a=rsa-sha256; cv=none; b=t77NZWaVgD+/tw072g+iKAPcHNElGC4cdlXJYz5ZZmXVLbnszQHaUoTW5mWdE200CYHiJS DuhTF9lzkvHXSr87sJQoZp2OAaHwueq5vXirxEfRMzx9UcNgXvhis/d88phrr+n0aEVdNK FLWniYImPmp4KTsY78UhXqk1ReODxtU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694609490; 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=iURFDA2RdJWU1H9IedgFZuHwYBnEAwvtokGRQic4P+w=; b=P7/lLqsf6vWFk0ZOmZOsqOr9riYNo2cRU10YJ7PrKpe9kqeDqAyKzJwuqLDnLG0t1QCmDi sIcdZz1dyI5kxErfOOyBdfQ/5BBp3QGFMuB7GgQEI/rksIxl6f3HRCJfApCP0aUX+fObAS lbeYYIMA2ou76/ebauyMO7gwZ1qdwXE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-480-uy6DAjTwN3CYPzjjmN_0TQ-1; Wed, 13 Sep 2023 08:51:26 -0400 X-MC-Unique: uy6DAjTwN3CYPzjjmN_0TQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB2A58030CB; Wed, 13 Sep 2023 12:51:25 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.193.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A94721B20B1; Wed, 13 Sep 2023 12:51:23 +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>, Mike Kravetz <mike.kravetz@oracle.com>, Muchun Song <muchun.song@linux.dev> Subject: [PATCH v1 4/6] mm/rmap: warn on new PTE-mapped folios in page_add_anon_rmap() Date: Wed, 13 Sep 2023 14:51:11 +0200 Message-ID: <20230913125113.313322-5-david@redhat.com> In-Reply-To: <20230913125113.313322-1-david@redhat.com> References: <20230913125113.313322-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspamd-Queue-Id: 2F3AE1A001D X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: pc9j3z7swjqiz6p5zzp4afpbyfuw4wek X-HE-Tag: 1694609490-425938 X-HE-Meta: U2FsdGVkX18G74s2erUOtIubUrNzNFAXg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X9XSixwQlgY/YwoLqOZOuL//fbC+KdVkW5sxp8Td33M67orr858OLzk9HAT5KduZCBO5FdpGPkmohW5ZZOKkvjaJLXlGToyGepmfNaA== 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> |
Series |
Anon rmap cleanups
|
expand
|
diff --git a/mm/rmap.c b/mm/rmap.c index 1ac5bd1b8169..489c142d073b 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1238,6 +1238,13 @@ void page_add_anon_rmap(struct page *page, struct vm_area_struct *vma, if (unlikely(!folio_test_anon(folio))) { VM_WARN_ON_FOLIO(!folio_test_locked(folio), folio); + /* + * For a PTE-mapped large folio, we only know that the single + * PTE is exclusive. Further, __folio_set_anon() might not get + * folio->index right when not given the address of the head + * page. + */ + VM_WARN_ON_FOLIO(folio_test_large(folio) && !compound, folio); __folio_set_anon(folio, vma, address, !!(flags & RMAP_EXCLUSIVE)); } else if (likely(!folio_test_ksm(folio))) {
If swapin code would ever decide to not use order-0 pages and supply a PTE-mapped large folio, we will have to change how we call __folio_set_anon() -- eventually with exclusive=false and an adjusted address. For now, let's add a VM_WARN_ON_FOLIO() with a comment about the situation. Signed-off-by: David Hildenbrand <david@redhat.com> --- mm/rmap.c | 7 +++++++ 1 file changed, 7 insertions(+)