From patchwork Mon Feb 26 14:13:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13572246 Return-Path: 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 32B56C54E41 for ; Mon, 26 Feb 2024 14:14:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9878344016F; Mon, 26 Feb 2024 09:14:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 938E7440147; Mon, 26 Feb 2024 09:14:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 765C644016F; Mon, 26 Feb 2024 09:14:11 -0500 (EST) 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 5B5D2440147 for ; Mon, 26 Feb 2024 09:14:11 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B1D1440892 for ; Mon, 26 Feb 2024 14:14:10 +0000 (UTC) X-FDA: 81834149460.13.86AF144 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 1988C4001E for ; Mon, 26 Feb 2024 14:14:08 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FO+OY0YE; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf04.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=1708956849; 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=2GkNOw5QpbIjcnEa8hertH5KYBOVS1V90XYQHHukH+0=; b=XMUp628J8vMkxGnbQp0yTWXcNhigYeXAQliAaOHbUDp2FhZr+X8WX3zgR4fzyUA8TKPBvD Jt52A1LBWrWpIyIefiqN4QijIFEorqKZccACFkFb9PDtTCV+IDFwH0jX1aJPO7mL6QOebr DtYtPmWOsxhX4su6q074Ek9jYCdrD/k= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FO+OY0YE; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf04.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=1708956849; a=rsa-sha256; cv=none; b=JLivS7Uf1R3vgUco9Zz2jArEdiHqkNSKMVJG93xE8Cx81yELL1svFtdVi3slTDSlnTCIaU qlT1bZICPRALdPUCGfDrQp+fLM/Rqi01uNPanMkP3Nr6voIuYHTbA+FMLu4Xco31f/jhoF +T/38wnvZfmX7kBCFCpTcglu+xQp7sE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708956847; 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=2GkNOw5QpbIjcnEa8hertH5KYBOVS1V90XYQHHukH+0=; b=FO+OY0YE7/v3F5zmkawZ6ewR4/zGn5c9ZeHumWIwOT+Dgm4i6giVU/j1h0Wf7harz09U1D wMlS5ejG8mIc/UhQTgwtNaG/xyloXvzywIWs01cvwccynn1i0w5tqQU0gVzHEvkGZTQjA/ NUGTvFgfgGBa5n3V36dIEE5vNKVv/Ec= 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-53-xi-W6UmKPPiav4O4IAf97Q-1; Mon, 26 Feb 2024 09:13:38 -0500 X-MC-Unique: xi-W6UmKPPiav4O4IAf97Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 8E6403C025C0; Mon, 26 Feb 2024 14:13:29 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 072AD1C060B1; Mon, 26 Feb 2024 14:13:27 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Matthew Wilcox Subject: [PATCH v2 1/2] mm/memfd: refactor memfd_tag_pins() and memfd_wait_for_pins() Date: Mon, 26 Feb 2024 15:13:23 +0100 Message-ID: <20240226141324.278526-2-david@redhat.com> In-Reply-To: <20240226141324.278526-1-david@redhat.com> References: <20240226141324.278526-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 1988C4001E X-Stat-Signature: jc5p59g75nox8frrbk5hbjnutc858z4d X-Rspam-User: X-HE-Tag: 1708956848-684787 X-HE-Meta: U2FsdGVkX18o42ZTDGKedChAPH7WGQU3IDpAIytHFGBrW2mvFf+cCH0/4+iuONBUqsz9HxCBwyNPt16J4ar+4rh60mxsH4k7/lvE/5RMUxvbpwcztlpwa3vxlXeTONHkBevr9b7xiEwgwmrwVRM0M2gWg0VPKOTPiDOZM1LYtaeGZH1NrH4NFVu6sHzvT5sYChFvQQJd+r0aT3euctvcgdY3qUSSNLowfrw9fvoLj1GDrChagLlsLQJNA1O3Nb893KBeth611UkMe07gt2bzQzQUD+V9UdCnMgEfzJdahnOJmqSEjWp0dmfvMqYKuFFQSywos5/tlGfDY7s7vCQldg/bcTYy6gEc5WqqMgTgDlrtIa265ztVuCJJaKZCwv5+Hiu0pS54IPdQOY8Uh2ZrHFpUqgwoq2rJoCL7jXPp/R5IClM8Ir9/Vk8Rrf1BgTBR40ZqRj6wwmCuhztbGyAvFsWqyUc6h7x6MXloBJQMTl2PdPyy1VHCR3ZG3AWvUEbbJHPqqbo2Z4IYucqH71J5Ocq+lhDv74/CVtS9ifZLFGKq11fXoZxa4auIisJOHX5fLLfNBTIwhVGtR4Il8UxxF8ylNGHWogSDn91L33SmHFtl7qKKVs43TYHNucCyHn5+/nLA32Oj+p/JOMvrhbG1ohq1nnqZGktp+6MnVy19Nb2X6gMVvcNOAVqoxUNxriG86uD2e2n7r+7nmJuM4Kj3Wn9MJVRqnKhuNMVLSIYuWK+hJI5enW+T3l+gRZz3wB3EMe16Uz/h894zvVczFubEi0BjO8Btw4x8s8O6bbg5NvJCZvQD9jqhY4gsFHtRKG02SC2gJ8mGvSSDVUg6+1u1J4W1Bpg+Bcm9+h6ZiQLnaPHuddQvV+imrZh7sHrL5umFKt6ksTdsKU3h/XQ/nryR+8tWQUxnU7M04MbjPB638lU6iP0kmDFTK/FLmt8o9VOy 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: List-Subscribe: List-Unsubscribe: Both functions are the remaining users of total_mapcount(). Let's get rid of the calls by converting the code to folios. As it turns out, the code is unnecessarily complicated, especially: 1) We can query the number of pagecache references for a folio simply via folio_nr_pages(). This will handle other folio sizes in the future correctly. 2) The xas_set(xas, page->index + cache_count) call to increment the iterator for large folios is not required. Remove it. Further, simplify the XA_CHECK_SCHED check, counting each entry exactly once. Memfd pages can be swapped out when using shmem; leave xa_is_value() checks in place. Co-developed-by: Matthew Wilcox (Oracle) Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: David Hildenbrand Reviewed-by: Matthew Wilcox (Oracle) --- mm/memfd.c | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/mm/memfd.c b/mm/memfd.c index d3a1ba4208c90..7d8d3ab3fa378 100644 --- a/mm/memfd.c +++ b/mm/memfd.c @@ -29,29 +29,25 @@ #define MEMFD_TAG_PINNED PAGECACHE_TAG_TOWRITE #define LAST_SCAN 4 /* about 150ms max */ +static bool memfd_folio_has_extra_refs(struct folio *folio) +{ + return folio_ref_count(folio) - folio_mapcount(folio) != + folio_nr_pages(folio); +} + static void memfd_tag_pins(struct xa_state *xas) { - struct page *page; + struct folio *folio; int latency = 0; - int cache_count; lru_add_drain(); xas_lock_irq(xas); - xas_for_each(xas, page, ULONG_MAX) { - cache_count = 1; - if (!xa_is_value(page) && - PageTransHuge(page) && !PageHuge(page)) - cache_count = HPAGE_PMD_NR; - - if (!xa_is_value(page) && - page_count(page) - total_mapcount(page) != cache_count) + xas_for_each(xas, folio, ULONG_MAX) { + if (!xa_is_value(folio) && memfd_folio_has_extra_refs(folio)) xas_set_mark(xas, MEMFD_TAG_PINNED); - if (cache_count != 1) - xas_set(xas, page->index + cache_count); - latency += cache_count; - if (latency < XA_CHECK_SCHED) + if (++latency < XA_CHECK_SCHED) continue; latency = 0; @@ -66,16 +62,16 @@ static void memfd_tag_pins(struct xa_state *xas) /* * Setting SEAL_WRITE requires us to verify there's no pending writer. However, * via get_user_pages(), drivers might have some pending I/O without any active - * user-space mappings (eg., direct-IO, AIO). Therefore, we look at all pages + * user-space mappings (eg., direct-IO, AIO). Therefore, we look at all folios * and see whether it has an elevated ref-count. If so, we tag them and wait for * them to be dropped. * The caller must guarantee that no new user will acquire writable references - * to those pages to avoid races. + * to those folios to avoid races. */ static int memfd_wait_for_pins(struct address_space *mapping) { XA_STATE(xas, &mapping->i_pages, 0); - struct page *page; + struct folio *folio; int error, scan; memfd_tag_pins(&xas); @@ -83,7 +79,6 @@ static int memfd_wait_for_pins(struct address_space *mapping) error = 0; for (scan = 0; scan <= LAST_SCAN; scan++) { int latency = 0; - int cache_count; if (!xas_marked(&xas, MEMFD_TAG_PINNED)) break; @@ -95,20 +90,15 @@ static int memfd_wait_for_pins(struct address_space *mapping) xas_set(&xas, 0); xas_lock_irq(&xas); - xas_for_each_marked(&xas, page, ULONG_MAX, MEMFD_TAG_PINNED) { + xas_for_each_marked(&xas, folio, ULONG_MAX, MEMFD_TAG_PINNED) { bool clear = true; - cache_count = 1; - if (!xa_is_value(page) && - PageTransHuge(page) && !PageHuge(page)) - cache_count = HPAGE_PMD_NR; - - if (!xa_is_value(page) && cache_count != - page_count(page) - total_mapcount(page)) { + if (!xa_is_value(folio) && + memfd_folio_has_extra_refs(folio)) { /* * On the last scan, we clean up all those tags * we inserted; but make a note that we still - * found pages pinned. + * found folios pinned. */ if (scan == LAST_SCAN) error = -EBUSY; @@ -118,8 +108,7 @@ static int memfd_wait_for_pins(struct address_space *mapping) if (clear) xas_clear_mark(&xas, MEMFD_TAG_PINNED); - latency += cache_count; - if (latency < XA_CHECK_SCHED) + if (++latency < XA_CHECK_SCHED) continue; latency = 0; From patchwork Mon Feb 26 14:13:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13572245 Return-Path: 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 F1810C48BF6 for ; Mon, 26 Feb 2024 14:14:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8270244016D; Mon, 26 Feb 2024 09:14:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D5F5440147; Mon, 26 Feb 2024 09:14:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C5A044016D; Mon, 26 Feb 2024 09:14:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5C6D2440147 for ; Mon, 26 Feb 2024 09:14:10 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 386E01608A3 for ; Mon, 26 Feb 2024 14:14:10 +0000 (UTC) X-FDA: 81834149460.15.FD45C0E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id AE8351A001B for ; Mon, 26 Feb 2024 14:14:08 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Q9lxCbt0; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.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=1708956848; 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=fzz4oIdsJNeqF+PoyUnhajnBU3sMK99bnWW/MxMH7Ys=; b=6vWDI1DL727tfht+EH+5lYeicSb2FXaNOs2CAlSsQU4AFz/44gjcH5CYKWrPRtX16TX29a dlsBqgeZB4YyyLmFpg96iAt4CLbZDmaF6woTkENFgw7dq650LqrSLu7pRGAdZ6lobD8tND F9JaE1KF7sV7m2AZ43M0DNXuW8BZMtQ= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Q9lxCbt0; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf19.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=1708956848; a=rsa-sha256; cv=none; b=6CnYQgxWzjAMZFxcfggcRGl1lUKq+xWFFS0PdMPDgBMiyCte95uxpiTFM1IY6fHkP5Rq2H GhZJ6nZAcYQrSIwnQ8I1KZGBw0WbIIdejCrZWfbi/skOSyb43nsF7ZSZ1UOZiSWjpV22HN da8UFdZvLMQcE+Sg0TZBqX2PavLZbaU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708956848; 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=fzz4oIdsJNeqF+PoyUnhajnBU3sMK99bnWW/MxMH7Ys=; b=Q9lxCbt0MEHadsa1VBLIoQbLEOlr+EcnLg4NSfYCQy9rRSXdQJGB5dSqAbc8HKtsWwQ/Fc CGJrkYL3ZfMUgdwO9XeDU4pjSjjYal59AmdG+1qLY3LCb3PbUO1yj0D/Tc9B07EnS6k3JI uck9cf+dE/NuBGAeC3UlMXbXG1ghJXI= 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-531-a1B9APTNPEOyuSsYVlQSgg-1; Mon, 26 Feb 2024 09:13:32 -0500 X-MC-Unique: a1B9APTNPEOyuSsYVlQSgg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 864803C28642; Mon, 26 Feb 2024 14:13:32 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEC821C06710; Mon, 26 Feb 2024 14:13:29 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Matthew Wilcox Subject: [PATCH v2 2/2] mm: remove total_mapcount() Date: Mon, 26 Feb 2024 15:13:24 +0100 Message-ID: <20240226141324.278526-3-david@redhat.com> In-Reply-To: <20240226141324.278526-1-david@redhat.com> References: <20240226141324.278526-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Rspamd-Queue-Id: AE8351A001B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 1raachupxaa3hi6yw8nu6ukb7gif56ab X-HE-Tag: 1708956848-658218 X-HE-Meta: U2FsdGVkX19LVSLqyJj/sPpk06gwe9OmTbUPYc+tSaSVN8Y9cfZcQTrB4s6PoVDTFMLWyCfOfVRXIroz7IqInyXYuePYCW1RGFvNnmzu/lkkL214qcguzQO9ZdgoHgkBSt76XIq7Drxpl1Ry0Ps/YfmPkMs+G+V0CizgYsx7o9bkuWoLLuLMEnDIwcGmyUYgJlzIu0KC4pSjQwWqaJfMOnF3jiPqC43pgqBPtmr0teZ7MHHP/ym2rS6aZugmiYKCndssaqiLptIR290DPtlHKhhYd81lraPs+xSXvQa+UJpphueoOeV0Ms8HaxfoHONw6AbvjReB2GoGZFtDn0Tdr0e46vmi/RI8kLhXHJJIoeh/OhsKp3Y9Q6QE88HWHcTRNIRTF+Bp5d/fJRkdwUwFpG8IWfqnQI8SZ0taN1heK/2ontaOstfH2e7Ra+v1S8ued4aNjMfZBe5BTd4mWRjesWuHVysmd/ra1jakytIutiffzc8v7LZ+VZu61P2D8IZZ8OTtxSn7nac9cNdA1xNu8a7wF+Z7Wk+8Xwp0w1Y1V/Kk7DkrjlRThIXy2Jriih5y65eQPU3sNpNLD4b3c12afdP/+unk9ngVQh+0NMoc2QMSiafsGC5NxnAfFWqntPGnyneCZiw7ZjvCVZ4dKsxLLOEQn8jJnB6H3+vBaZLaUz6CpHmnsUlIdswTF++74fu+K35xRbNRFkYh36TLu43z2h02Vm1NNrUrE0FXNzHoi4pFSi7sFohjZQPX+LuwKUDzKXGpvdQ9OlC/kJmiMUnoSVtRbxAevcDOvxWqriP6wvZEBRGu0hAuN608n7v4fvwjVejSo2b16oCe1+MiQ/b1BzQ5RlbLamMWAzPb03ko/eFhUnwBUaveXVdJO+ME7kjQtiDe/tcuSXrx06J/tent7H4/m5E64mRCaEu+PMjaUw32yDTbLIQ/mVJWPuj1pb4j 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: List-Subscribe: List-Unsubscribe: All users of total_mapcount() are gone, let's remove it. Signed-off-by: David Hildenbrand Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 6f4825d829656..49e22a2f6cccc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1183,7 +1183,7 @@ static inline int is_vmalloc_or_module_addr(const void *x) * How many times the entire folio is mapped as a single unit (eg by a * PMD or PUD entry). This is probably not what you want, except for * debugging purposes - it does not include PTE-mapped sub-pages; look - * at folio_mapcount() or page_mapcount() or total_mapcount() instead. + * at folio_mapcount() or page_mapcount() instead. */ static inline int folio_entire_mapcount(struct folio *folio) { @@ -1243,13 +1243,6 @@ static inline int folio_mapcount(struct folio *folio) return folio_total_mapcount(folio); } -static inline int total_mapcount(struct page *page) -{ - if (likely(!PageCompound(page))) - return atomic_read(&page->_mapcount) + 1; - return folio_total_mapcount(page_folio(page)); -} - static inline bool folio_large_is_mapped(struct folio *folio) { /*