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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABB1AC2D0EC for ; Fri, 10 Apr 2020 21:33:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6CB0E20753 for ; Fri, 10 Apr 2020 21:33:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="hp2KiFe8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CB0E20753 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 211868E0071; Fri, 10 Apr 2020 17:33:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E89D8E0067; Fri, 10 Apr 2020 17:33:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D8898E0071; Fri, 10 Apr 2020 17:33:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0062.hostedemail.com [216.40.44.62]) by kanga.kvack.org (Postfix) with ESMTP id E8C808E0067 for ; Fri, 10 Apr 2020 17:33:00 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A932852B7 for ; Fri, 10 Apr 2020 21:33:00 +0000 (UTC) X-FDA: 76693245720.26.work68_375a5d0019854 X-HE-Tag: work68_375a5d0019854 X-Filterd-Recvd-Size: 3571 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Fri, 10 Apr 2020 21:33:00 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1246E2145D; Fri, 10 Apr 2020 21:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586554379; bh=0g7NgfaIQVQxI/OVgxxjqSRmIXM2HionC7YKKz7Q5gM=; h=Date:From:To:Subject:In-Reply-To:From; b=hp2KiFe8siy7u3y6S668VQIrOzEyjs8DnY4vX7h7vJiPrsivc9WZGyIg1mAPo69q5 KenO66lwXovygB/681PJ65sWe6tng7ZmWMnlH9JcXYZrKp7qgpgvrK7CKb5AZ9VTiZ BDkP7aZxTPsw0lEVT4cTjaCmw7u+KLNm3HBt3Yv4= Date: Fri, 10 Apr 2020 14:32:58 -0700 From: Andrew Morton To: akpm@linux-foundation.org, arjunroy@google.com, davem@davemloft.net, edumazet@google.com, jgg@ziepe.ca, linux-mm@kvack.org, mm-commits@vger.kernel.org, sfr@canb.auug.org.au, soheil@google.com, torvalds@linux-foundation.org, willy@infradead.org Subject: [patch 14/35] mm: define pte_index as macro for x86 Message-ID: <20200410213258.6ZdCCXWqN%akpm@linux-foundation.org> In-Reply-To: <20200410143047.bf34a933ce1affdc042c7c80@linux-foundation.org> User-Agent: s-nail v14.8.16 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: Arjun Roy Subject: mm: define pte_index as macro for x86 pte_index() is either defined as a macro (e.g. sparc64) or as an inlined function (e.g. x86). vm_insert_pages() depends on pte_index but it is not defined on all platforms (e.g. m68k). To fix compilation of vm_insert_pages() on architectures not providing pte_index(), we perform the following fix: 0. For platforms where it is meaningful, and defined as a macro, no change is needed. 1. For platforms where it is meaningful and defined as an inlined function, and we want to use it with vm_insert_pages(), we define a degenerate macro of the form: #define pte_index pte_index 2. vm_insert_pages() checks for the existence of a pte_index macro definition. If found, it implements a batched insert. If not found, it devolves to calling vm_insert_page() in a loop. This patch implements step 1 for x86. v3 of this patch fixes a compilation warning for an unused method. v2 of this patch moved a macro definition to a more readable location. Link: http://lkml.kernel.org/r/20200228054714.204424-1-arjunroy.kdev@gmail.com Signed-off-by: Arjun Roy Cc: David Miller Cc: Eric Dumazet Cc: Jason Gunthorpe Cc: Matthew Wilcox Cc: Soheil Hassas Yeganeh Cc: Stephen Rothwell Signed-off-by: Andrew Morton --- arch/x86/include/asm/pgtable.h | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/x86/include/asm/pgtable.h~mm-define-pte_index-as-macro-for-x86 +++ a/arch/x86/include/asm/pgtable.h @@ -860,7 +860,10 @@ static inline unsigned long pmd_index(un * * this function returns the index of the entry in the pte page which would * control the given virtual address + * + * Also define macro so we can test if pte_index is defined for arch. */ +#define pte_index pte_index static inline unsigned long pte_index(unsigned long address) { return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); _