From patchwork Tue Apr 9 19:22:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13623130 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 0DC4FCD1299 for ; Tue, 9 Apr 2024 19:26:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D51F6B00AC; Tue, 9 Apr 2024 15:26:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9856A6B00AD; Tue, 9 Apr 2024 15:26:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 84D0C6B00AE; Tue, 9 Apr 2024 15:26:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6544F6B00AC for ; Tue, 9 Apr 2024 15:26:17 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 24277A0C9C for ; Tue, 9 Apr 2024 19:26:17 +0000 (UTC) X-FDA: 81990974394.16.F1FFCB4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 7F05940010 for ; Tue, 9 Apr 2024 19:26:15 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aso5oJJ6; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.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=1712690775; a=rsa-sha256; cv=none; b=YE331oSCVQY/KO3mD1VODOvwbJ/mCjt6Cmo3v594Ur2pVwxVM0F9pwUuGYRzeZBZ14aU/c xRGPnrWX/Stb5C3ogoeWJUCe/UnpdJ3wmKHlSa0xVOQRKNv0VCSP5UDgArEYuyQmY628WX 8cN3mnxfsPSfOUXoJ5SLNQrcrduyXKQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=aso5oJJ6; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.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=1712690775; 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=z56f15PtBl+UvHHvSB3Qx1+Za4NemO81qqaBL/Rijfc=; b=EyqD5VQpQe/hIQcgiML+1+n1DMNsWFhU2RECEdnzAL0sh5bFo1CU41RgUrUjo2WcHz0nFc nZFDYyw1CC3Kq1kkLMllm+c/EBtKRGugjp2wvoHIUgU+96k8mo0++AzE7k/IZtxCNhsQyl WcDYTKu17WEvpGjnTtY3kInDOGEFOcQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712690774; 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=z56f15PtBl+UvHHvSB3Qx1+Za4NemO81qqaBL/Rijfc=; b=aso5oJJ6oAQm5N4KHjTiaJiXDbY1WyU1AaAnmAFMBV44XUQMEGzVdfBInPTF6xfTsBKP1s 4heRTHPdGrhocSTQu5Law6h+jDEvkMpzaTIjhoKCWWUCq9xXQOmSXE6HoSXJh5slBAljTo OW2wa4oOJS8xTni83zWXLUhsQStMhvY= 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-14-Ea0Nh1k0ME2JTUIPiSiprg-1; Tue, 09 Apr 2024 15:26:09 -0400 X-MC-Unique: Ea0Nh1k0ME2JTUIPiSiprg-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 3DD5B3C3D0CD; Tue, 9 Apr 2024 19:26:08 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B0B440C6DAE; Tue, 9 Apr 2024 19:25:56 +0000 (UTC) From: David Hildenbrand 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 , Andrew Morton , "Matthew Wilcox (Oracle)" , Peter Xu , Ryan Roberts , Yin Fengwei , Yang Shi , Zi Yan , Jonathan Corbet , Hugh Dickins , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Chris Zankel , Max Filippov , Muchun Song , Miaohe Lin , Naoya Horiguchi , Richard Chang Subject: [PATCH v1 13/18] mm/filemap: use folio_mapcount() in filemap_unaccount_folio() Date: Tue, 9 Apr 2024 21:22:56 +0200 Message-ID: <20240409192301.907377-14-david@redhat.com> In-Reply-To: <20240409192301.907377-1-david@redhat.com> References: <20240409192301.907377-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 7F05940010 X-Stat-Signature: cupm959hwkwtworb3bgtxn1k8t9e8rdi X-HE-Tag: 1712690775-126818 X-HE-Meta: U2FsdGVkX19/aWwZNLhYH518r7/jZU5ebFm6a6F1J7w5jNM1UViVbZMyfcwO2y1K4XCg40S6GG4+MVVcMBlqLJe1uK/kHFzdq0gvNoXuknjmopwmSWFXVsKSgW31D8NCQb/jyJcJ/ScEkWsjmQ4grVn7t+Brg5JI9fOLjoJgMqhgCJty7YAtVijs4w1X81ry0VOCo/QG6alIm5QdmVFTO/tSK87YMc703qvJMimEKdbYcprUXNt1zLwYqIfoygpuu51A2S0soMKzmw7Oe0pchRl4NlCD6YK0CpQqlUIn+RkgYCB3+r/4C+kWi9YRR6NRopPT9rGGZUmtLvdF9Z40a83BSwtFlnlo1JaNHyXHkRBdbCWRnbGMYSHtvBXtMkyKWoefYkHG+zBJI/ostb9Ip0eipdz939g2URvZjizFr/rxashiGLI7USc53E16uGUH3WNd7hgX6WYgh2yEHz0aStsVqiBAeajqf/f7ffbH6/MODlVU0NJVOJArybqkH/XSSNe7u3j5dj9c2NMWI6e+klahGA4UzkdEOcsvraZugovXtj3wLEX21Os9ZWqoB9efjdXSEnUv83fzFlgnQVsoXviKc8IRQSD3xYGbzIEsOiyezeTX+17+93PtzxoT+1xvIj2rP71GjvayCWoRW/9jJWmV1HIHCACgYHNv+ZWkapfKjP+TtWPK4MyIPBNcVTDld5CIomMcWf7gnMESJMXnCX0qjWOwEu8vbLxp7okWAtCQGXJgdrfYIITbSX0x9eYNNDwc7VAkOn5eVtXoF9L8ywP3E3KNjDaFwlbuggURRMhIgQfGKBBi+90PyFCNVVNkL2uW8hwWsOkwu6xKPdjJllr8OhGuUw9YGE67EbQT6T08sxNpPs8Kljz8TRVTylX712e5QzPy+YT9BvDQSg820L2U7lesujS8fJC+wc7sJ0CWapk89w+ROYCEtN2YtQnZQBXCrnA9BrWUoH4ErTu uIhzZP8E FXNBEPjv91KJnvpq1f7/fmme7FBs+ZOr41aen5x4EVEvE48b28cXNDnE7iXHz15UphH+ZBs9BBukhv8h1ynx7iMXXW9vpjNUUHGMPrVFknsGD5NmcHoPYcRTFvzSdedAv013SVNs1MDqb0A7cLmyYOzBMrFCwGaaZM9T/Mdsf/Dx2kXIWZBRBN/WPLIzyFOGk49PLpt8QyxE/CtasO/6dNXQocbh6V3qM7XDu 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: We want to limit the use of page_mapcount() to the places where it is absolutely necessary. Let's use folio_mapcount() instead of filemap_unaccount_folio(). No functional change intended, because we're only dealing with small folios. Signed-off-by: David Hildenbrand --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index c668e11cd6ef..d4aa82ad5b59 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -168,7 +168,7 @@ static void filemap_unaccount_folio(struct address_space *mapping, add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); if (mapping_exiting(mapping) && !folio_test_large(folio)) { - int mapcount = page_mapcount(&folio->page); + int mapcount = folio_mapcount(folio); if (folio_ref_count(folio) >= mapcount + 2) { /*