From patchwork Fri Feb 4 04:49:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12734793 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 5FFE0C433EF for ; Fri, 4 Feb 2022 04:49:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0EE56B007D; Thu, 3 Feb 2022 23:49:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DBD6F6B007E; Thu, 3 Feb 2022 23:49:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C84CD6B0080; Thu, 3 Feb 2022 23:49:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id B927F6B007D for ; Thu, 3 Feb 2022 23:49:32 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 8FBC91206BD for ; Fri, 4 Feb 2022 04:49:32 +0000 (UTC) X-FDA: 79103868984.03.407CD6B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf05.hostedemail.com (Postfix) with ESMTP id 36927100007 for ; Fri, 4 Feb 2022 04:49:32 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E8C261B48; Fri, 4 Feb 2022 04:49:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB9A2C340E9; Fri, 4 Feb 2022 04:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1643950171; bh=MDHhps9eYNeO/cKBYWhXRHb++o+a0biupbPiV5wilT0=; h=Date:To:From:In-Reply-To:Subject:From; b=crYwElvQFciOg8RuzWOhmfqclGz4EBTbAuEdvFZUBL080dOqoSybOKInoV3z008Z9 Jor4bBOjackNplGGhhLVATKsk3Jf7iW7vfAxm6t87hgmcwn2CKwaxFa50JTmo2814u AhqAgNicTqKnJhlb+x5ttl1hNHbLtWqfTiesJcXs= Received: by hp1 (sSMTP sendmail emulation); Thu, 03 Feb 2022 20:49:29 -0800 Date: Thu, 03 Feb 2022 20:49:29 -0800 To: stettberger@dokucode.de,stable@vger.kernel.org,khalid.aziz@oracle.com,rppt@linux.ibm.com,akpm@linux-foundation.org,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220203204836.88dcebe504f440686cc63a60@linux-foundation.org> Subject: [patch 06/10] mm/pgtable: define pte_index so that preprocessor could recognize it Message-Id: <20220204044929.AB9A2C340E9@smtp.kernel.org> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 36927100007 X-Stat-Signature: g7coqqn9suqtcpr4ijd6pqkx5smnfwmr Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=crYwElvQ; dmarc=none; spf=pass (imf05.hostedemail.com: domain of akpm@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@kernel.org X-Rspam-User: nil X-HE-Tag: 1643950172-620348 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: From: Mike Rapoport Subject: mm/pgtable: define pte_index so that preprocessor could recognize it Since commit 974b9b2c68f3 ("mm: consolidate pte_index() and pte_offset_*() definitions") pte_index is a static inline and there is no define for it that can be recognized by the preprocessor. As a result, vm_insert_pages() uses slower loop over vm_insert_page() instead of insert_pages() that amortizes the cost of spinlock operations when inserting multiple pages. Link: https://lkml.kernel.org/r/20220111145457.20748-1-rppt@kernel.org Fixes: 974b9b2c68f3 ("mm: consolidate pte_index() and pte_offset_*() definitions") Signed-off-by: Mike Rapoport Reported-by: Christian Dietrich Reviewed-by: Khalid Aziz Cc: Signed-off-by: Andrew Morton --- include/linux/pgtable.h | 1 + 1 file changed, 1 insertion(+) --- a/include/linux/pgtable.h~mm-pgtable-define-pte_index-so-that-preprocessor-could-recognize-it +++ a/include/linux/pgtable.h @@ -62,6 +62,7 @@ static inline unsigned long pte_index(un { return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); } +#define pte_index pte_index #ifndef pmd_index static inline unsigned long pmd_index(unsigned long address)