Message ID | 20240409192301.907377-9-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 8BD38C67861 for <linux-mm@archiver.kernel.org>; Tue, 9 Apr 2024 19:25:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E5C16B00A2; Tue, 9 Apr 2024 15:25:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 196146B00A3; Tue, 9 Apr 2024 15:25:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 05D846B00A4; Tue, 9 Apr 2024 15:25:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D9AE76B00A2 for <linux-mm@kvack.org>; Tue, 9 Apr 2024 15:25:20 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AAC9E1602B0 for <linux-mm@kvack.org>; Tue, 9 Apr 2024 19:25:20 +0000 (UTC) X-FDA: 81990972000.19.63CAA66 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 1662F40013 for <linux-mm@kvack.org>; Tue, 9 Apr 2024 19:25:18 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="A5/9zM/r"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.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=1712690719; 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=l2g8VbuF2c0rw+gA2SjXZjA9kizkfkgdJ7YGUNRZUqA=; b=ZwJgPuI9vDw16QX6AYX+n1yM+GoEj9oAnqjLTtVPsRZn0kKG+rppW4Pva6CzquI8hLWwW5 6Gygu4Dly9LsrqJfk3adgB5Xj5zpJVaIsSb9QdNgD4BawgiZWnBwoyIuZXsg1qAB+e9rvK /YPR3dJNBekjgNnYpSo7y6z4+yI7aY8= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="A5/9zM/r"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.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=1712690719; a=rsa-sha256; cv=none; b=NTNVsBdqN7TOzp8fB/hPTjveVj4+YzXoYApSgAex8lAvZzoaYlwYqFKvX0bkFqzklmHZWT tHy9VP7ae7EXOcvlP+9MxJst8x2+S2gK7sCYEXZh8VMvmDK3qtcWj0SlAqGw712JR2hqMT WBY60XLykVqk/WiMcCBVVo2hbDKPxT8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712690718; 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=l2g8VbuF2c0rw+gA2SjXZjA9kizkfkgdJ7YGUNRZUqA=; b=A5/9zM/rM7JBKoNLt24FNgKWH++cfxED7fGDqn/iJdK4yEgqQcPq9p26ewUj/RhN9Lpzmu i1YIS8Jh0jmhQ/ApPJ1Pmi3GP4so/XtM4oygFSQG8MHWGUj9wL7sOxvKSEMSdSxjzt35qC P4wjhcLth2ixmeZ6HNcLf5S6uxv0hF8= 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-61-9JpVPi_eMcaHlYj18Lcjpg-1; Tue, 09 Apr 2024 15:25:10 -0400 X-MC-Unique: 9JpVPi_eMcaHlYj18Lcjpg-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 9AB78806625; Tue, 9 Apr 2024 19:25:08 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCB3B40B4980; Tue, 9 Apr 2024 19:24:56 +0000 (UTC) From: David Hildenbrand <david@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, cgroups@vger.kernel.org, linux-sh@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, David Hildenbrand <david@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Peter Xu <peterx@redhat.com>, Ryan Roberts <ryan.roberts@arm.com>, Yin Fengwei <fengwei.yin@intel.com>, Yang Shi <shy828301@gmail.com>, Zi Yan <ziy@nvidia.com>, Jonathan Corbet <corbet@lwn.net>, Hugh Dickins <hughd@google.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, Rich Felker <dalias@libc.org>, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>, Chris Zankel <chris@zankel.net>, Max Filippov <jcmvbkbc@gmail.com>, Muchun Song <muchun.song@linux.dev>, Miaohe Lin <linmiaohe@huawei.com>, Naoya Horiguchi <naoya.horiguchi@nec.com>, Richard Chang <richardycc@google.com> Subject: [PATCH v1 08/18] mm/huge_memory: use folio_mapcount() in zap_huge_pmd() sanity check Date: Tue, 9 Apr 2024 21:22:51 +0200 Message-ID: <20240409192301.907377-9-david@redhat.com> In-Reply-To: <20240409192301.907377-1-david@redhat.com> References: <20240409192301.907377-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-Server: rspam09 X-Rspamd-Queue-Id: 1662F40013 X-Stat-Signature: qjh6471fs19yrhz7bfwd3p96auhwupjg X-Rspam-User: X-HE-Tag: 1712690718-271124 X-HE-Meta: U2FsdGVkX189NOYp0miDr9rX2Akx4PGT0GG2+A9oj39/f1GXck9lIq0LsOjDrrryVG/2z/g58Q4nhl9sTG3JHr8zmYVFgzBtcwUZP6C+toPEfmtmrDS0eyinORndWyIZgT+rCyclo8dGA/wLDUZNASFHhA+DQmHt0U5FgUEbO13h6Ga4s34AhD9qHraBWni2pDJeTtqxlqfx/5rOHwr4h5MZ1Vwx0bGtCMR/EHtYqyEX+edKbeE9VsIqtF/kFIYQoF/nLhgsgoX0sY/i1LsnHY2iGPKbY4F+DEPuDuKzDkblkT3pPeyieNkHTvw2TDEQzhJFwppbGHKXOvEHRpn7fHzik/R6DBb9HQ0Gn4C5+nM17Tx0zbu0ohAL0SsgBlMvoonyV46g8Ptfb4bS+OKeD5MVm2FTJvISDwzXViYXIO18xIvJdkCvNZnrNjRuKcOZLVbLb7ThdSDp5teF9uSyA9SJhoePUJ6fd/cs3KPE1C97ApRJ4+wc9xDgcqXeQqmYMQFUryJnL68q/VLopbRwuR9/Rv6YhYoYrKpgDNsL1+a+tnaakHkRcm+xAEn9leJPTE25F60gLZcSx3HouLiLXkRtLY4CF3as/RpxcR75wAe54V6wDZWmvE5f50UF0HXybPXcXNxcFOkc48/RKH44OudrsmjheVe+XDpyOHOUjJizphjNl6mFqV9iOJtbcFnPo8U28XI72aK3PgAfpcPBOv4TzzbIM6g2q5cyHTcKsQHyU0u6NaP/8U3gU35f58EdQhr4wcyT4ZgO4HSEANR+TNphJ1CYQLWMvtZ78TeZ+iC+DdfK+Gfw7mtGYJIdGqJTnBv9vqMv48dFyIgziXi/1YWOPM6QywAPA8Ef3/90lZaWG1z6ueD4XMBpmXVakjMDc1w0eNYFeZim0Jx58bsjwTTGwRXasTHNsCCU6rZPtnTQYO6rcohrgR4Yilk5z1Ts 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: mapcount for large folios + page_mapcount() cleanups
|
expand
|
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index d8d2ed80b0bf..68ac27d229ef 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1851,7 +1851,7 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, folio = page_folio(page); folio_remove_rmap_pmd(folio, page, vma); - VM_BUG_ON_PAGE(page_mapcount(page) < 0, page); + WARN_ON_ONCE(folio_mapcount(folio) < 0); VM_BUG_ON_PAGE(!PageHead(page), page); } else if (thp_migration_supported()) { swp_entry_t entry;
We want to limit the use of page_mapcount() to the places where it is absolutely necessary. Let's similarly check for folio_mapcount() underflows instead of page_mapcount() underflows like we do in zap_present_folio_ptes() now. Instead of the VM_BUG_ON(), we should actually be doing something like print_bad_pte(). For now, let's keep it simple and use WARN_ON_ONCE(), performing that check independently of DEBUG_VM. Signed-off-by: David Hildenbrand <david@redhat.com> --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)