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 48C1EC25B0C for ; Mon, 8 Aug 2022 19:34:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C0506B0073; Mon, 8 Aug 2022 15:34:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE17C8E0006; Mon, 8 Aug 2022 15:34:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C49386B0075; Mon, 8 Aug 2022 15:34:49 -0400 (EDT) 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 A16438E0001 for ; Mon, 8 Aug 2022 15:34:49 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7427D1C5CB5 for ; Mon, 8 Aug 2022 19:34:49 +0000 (UTC) X-FDA: 79777427898.22.88B7375 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf22.hostedemail.com (Postfix) with ESMTP id 22874C012E for ; Mon, 8 Aug 2022 19:34:47 +0000 (UTC) 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=PiHBVuKwdKoB1+T6CMjhocZsD9aMxQ9a1/As9MIyMJs=; b=GCLusaoJrOn7UVUelevIz+vrvc A2KdNtTS8pXefXkAFre00lDAjhncwu7N1+lUzdHH9Jq4v88c13kHPW2BHvMl5l4b6ljmWgbt+HDJu ny4Rihjo2tGg1RmXPy63d3GpAxfyp/JuwIdcVo8hkDaKiEnYweF5a8QFtLvqNgbUafpl1P7Z3FY4g 02SYF+ZaNjdjlqCxNoREKNAXqN7Cia+QGOZuDlTemYVQQmaM/BcFDhhvR8+ZL7BNiN5j6too9CjkU QhieHsyB9u2BcsEF4YsdRnmxdTDXGuBFC1gfb/HetAecwvwsPfmAlWDSUlebVtVsCOJMZtP1z+mas ecq7Zu7g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oL8WU-00EAsW-CV; Mon, 08 Aug 2022 19:34:46 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , hughd@google.com Subject: [PATCH 06/59] mm: Reimplement folio_order() and folio_nr_pages() Date: Mon, 8 Aug 2022 20:33:34 +0100 Message-Id: <20220808193430.3378317-7-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220808193430.3378317-1-willy@infradead.org> References: <20220808193430.3378317-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659987289; 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=PiHBVuKwdKoB1+T6CMjhocZsD9aMxQ9a1/As9MIyMJs=; b=UHNNjckD3mbMM+8D6pEOri3fZmL0NRjOFCop2qkyQEo1MlPdC4LYbzcLd+cA2RTcQ+nVY8 XeQURLmjP1SoI+fHrvh8Bq4xEUdZ1XILDpuiedxObffc5h2oqIrTD2Op4+Z50Y2SfL9PDs hrK8l+tJbq6AYqZJMIdhUzFBZ3j0MYE= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=GCLusaoJ; dmarc=none; spf=none (imf22.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=1659987289; a=rsa-sha256; cv=none; b=dV37PXJHeO1F6Hy5aq8xXjmmuQGRunrdZDN3VqB98PmJvEL7EC93pwLtS2NBLsVAaWIOXD kVxZV2Af+HupwjJHuZ8MxXRQbLmlhqDEKQ+pNabPJ8OU8WrdMSGpz7EH9A8whVbhdK9gkj 4K1UJBX0WHx7XwRZ/6cej5sNtmzALFo= Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=GCLusaoJ; dmarc=none; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam02 X-Stat-Signature: cuawmcae65dpqoukwozxrsmc4fyjbmc3 X-Rspamd-Queue-Id: 22874C012E X-Rspam-User: X-HE-Tag: 1659987287-771957 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: Instead of calling compound_order() and compound_nr_pages(), use the folio directly. Saves 1905 bytes from mm/filemap.o due to folio_test_large() now being a cheaper check than PageHead(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/mm.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 18e01474cf6b..7ee34dcf1aa3 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -697,7 +697,9 @@ static inline unsigned int compound_order(struct page *page) */ static inline unsigned int folio_order(struct folio *folio) { - return compound_order(&folio->page); + if (!folio_test_large(folio)) + return 0; + return folio->_folio_order; } #include @@ -1590,7 +1592,13 @@ static inline void set_page_links(struct page *page, enum zone_type zone, */ static inline long folio_nr_pages(struct folio *folio) { - return compound_nr(&folio->page); + if (!folio_test_large(folio)) + return 1; +#ifdef CONFIG_64BIT + return folio->_folio_nr_pages; +#else + return 1L << folio->_folio_order; +#endif } /** -- 2.35.1