From mboxrd@z Thu Jan 1 00:00:00 1970 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 AC108C3DA7D for ; Sat, 31 Dec 2022 21:46:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B0FE8E0001; Sat, 31 Dec 2022 16:46:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 411928E0013; Sat, 31 Dec 2022 16:46:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 17C498E0014; Sat, 31 Dec 2022 16:46:37 -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 DCDAE8E0014 for ; Sat, 31 Dec 2022 16:46:36 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id C129E120486 for ; Sat, 31 Dec 2022 21:46:36 +0000 (UTC) X-FDA: 80303935992.23.D5F9ECD Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf11.hostedemail.com (Postfix) with ESMTP id 2F24F40002 for ; Sat, 31 Dec 2022 21:46:34 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hLDkGoc0; dmarc=none; spf=none (imf11.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672523195; 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=uSV1JGSnX8tQjtuNAwlCQ8YX4bimlKh/5v7VMgUi/M4=; b=3QT7+RVhqzKRyfd8MZufzr5tdh6GcDD26DiTc96uGL1CH11Eew2nWVkbiJqfjvXOxz202x mzfdy58o3ZyuGMObR9iJOuSzJk/6/um4O8HIMp7g0EHwCPifqyoizYe2r43cbc1EF6IBP+ MJL81eTagi/Wha7d818c+nUwmMmAQ6k= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hLDkGoc0; dmarc=none; spf=none (imf11.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672523195; a=rsa-sha256; cv=none; b=frGh/4sILFvBZeMyYyKacd2B2BSH33MjCyopi8X1eOTBSUMO6CX+0WT+M4ZDGKM+ygcNmg rSZg9X2zT1wYQt3e+vezWKNH9KDbnZ0Ej5MrzojXohTLENM3NAqd8KO+S/4HbqGqj584Zl nX9sgQDuLTDuMxWxSlbpcGdYUlVcaek= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=uSV1JGSnX8tQjtuNAwlCQ8YX4bimlKh/5v7VMgUi/M4=; b=hLDkGoc0/5s6uPr/7sD/fKJZB9 Uk4gcU7y0/aFtOhfJKWsngdUL4O5noZbXaPDpzDRPbdpFYoqFuNlmN8rpQyJ/UGtJjzjRz6zXt0Qc FMD0SU/sFdwWV1HsEflczN51lyJKji9ot5Ah5wlbe3XKw7GAqcj1bWVDqLUu4tikntQASCT27ZFH7 3CTnZXSueLwfoszaCVdAYc7mZTUhx2pTtmk1wcn4l5Af8u4fKl3uLcqUxXyeVVGN4fyEyODdKH4u/ mlP+BDZi9vu8vM6oRZa/pNTrbX63W4xXnUDrMSfdceF+zBuhWtBmCPHJ+j9zJGCKJit783RrnsBLI /P+m92Yw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pBjgD-00Bkat-Qi; Sat, 31 Dec 2022 21:46:13 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Hugh Dickins Subject: [PATCH 14/22] mm: Convert page_mapcount() to use folio_entire_mapcount() Date: Sat, 31 Dec 2022 21:46:02 +0000 Message-Id: <20221231214610.2800682-15-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221231214610.2800682-1-willy@infradead.org> References: <20221231214610.2800682-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2F24F40002 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: ih1r8s45yz8pskrdijxa7gr5aqfzi9wb X-HE-Tag: 1672523194-647145 X-HE-Meta: U2FsdGVkX19alaR9wBfTv8Y8qLoyPLgsAquWJpac4f1YMgkA/tYy+G0ZmMBGv2Id/tXluSTd6iuHBr8MIxl2uzCzysqF6mbedCFALy+M5LrtqvR8kz/YTVCeZZTyT9jbML/Y/41738QyhterDzdyEQaqjv7GDmb6d26FUkKym72jBSAVcJBF/JT1YELH1Dy0Igfw9wmlousLpJVlvzPZZ6EU1urkvZ3wszsgTH/B4/iodDn8ChcAj9Sv8hnspzASryu7iVzD7DcH+P59/exgwQCw9Fm8Cg0enn/2liwtMQacTHHpoVU6nBbuf1jPkbJ174s3R0d2WzLOg0TH60E84mvUvgpLiPXWJUnsfvPfiAbiVBGpdTb4+IFcnsGvtlwP64rJU8z/kXzAfJrjlL1j7dN9CuzWnlklqweV8HH50nka5s6FJE3/BNcL7iuSHEWVyYpXYE0/6TWmY9UpvIgxOPi0lsHrNE3PEdM9RUutvAbgBmW0p6JBfu43+m01BbRMVRg7sVrC4cEhgUgOC0+bZi1H3GsMrSH2XIz34QWUsm2tBEzltNsy4lD1g1h3Lm8SLUMrRD3+0YEMBxW3eAi7TDhogh9YGTEf7bL3kBvH7V5LUt3So08bAFiq/5biy1WxDfKBLjV5Sm8Ou4Yozn/5TeMA+c3zuWjhSKxAD7tpDAOcu4+MKD7Bwi+eSxAtBG+kd74DGt+RBlgbGq0RFFcv6UmHJgGIF0dpS5bcUWCVhUejf9MAs2+82ZXTfrJqSjHsJ6YbZ7qDBnNiqLpZ2YAdgJH6CFap57F3XTcKmZWnBhRgdybnm3KumKoD0ouvBT0LEYVsPZNNcBeufUUZw4B9cTdKAEKrNGLNTizA0+QPRGdV5lkH3C4vQksUXjYDf35CLvSc/qgd7ahn/6YfVT7dkFvbesoKhwlg3TtQDZO5ZuHnm9vW/Y7+gA== 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: Remove a use of head_compound_mapcount(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 0079f779da47..cc6e94647ed8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -848,22 +848,26 @@ static inline void page_mapcount_reset(struct page *page) atomic_set(&(page)->_mapcount, -1); } -/* - * Mapcount of 0-order page; when compound sub-page, includes - * compound_mapcount of compound_head of page. +/** + * page_mapcount() - Number of times this precise page is mapped. + * @page: The page. + * + * The number of times this page is mapped. If this page is part of + * a large folio, it includes the number of times this page is mapped + * as part of that folio. * - * Result is undefined for pages which cannot be mapped into userspace. + * The result is undefined for pages which cannot be mapped into userspace. * For example SLAB or special types of pages. See function page_has_type(). - * They use this place in struct page differently. + * They use this field in struct page differently. */ static inline int page_mapcount(struct page *page) { int mapcount = atomic_read(&page->_mapcount) + 1; - if (likely(!PageCompound(page))) - return mapcount; - page = compound_head(page); - return head_compound_mapcount(page) + mapcount; + if (unlikely(PageCompound(page))) + mapcount += folio_entire_mapcount(page_folio(page)); + + return mapcount; } int folio_total_mapcount(struct folio *folio); -- 2.35.1