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=-9.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 1AA7CC3F2CF for ; Fri, 28 Feb 2020 05:47:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A39CF246A1 for ; Fri, 28 Feb 2020 05:47:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BJU8O9Nj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A39CF246A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 09A786B0005; Fri, 28 Feb 2020 00:47:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 04BCB6B0006; Fri, 28 Feb 2020 00:47:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA2286B0007; Fri, 28 Feb 2020 00:47:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0215.hostedemail.com [216.40.44.215]) by kanga.kvack.org (Postfix) with ESMTP id D11A36B0005 for ; Fri, 28 Feb 2020 00:47:24 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9C032181AEF09 for ; Fri, 28 Feb 2020 05:47:24 +0000 (UTC) X-FDA: 76538453208.24.root63_7add80aea155e X-HE-Tag: root63_7add80aea155e X-Filterd-Recvd-Size: 4688 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Fri, 28 Feb 2020 05:47:24 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id b22so789856pls.12 for ; Thu, 27 Feb 2020 21:47:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4YQN11RHWqWYlow7WCdfiB2i6Tmy+9h5VA/awdDf+EI=; b=BJU8O9NjW2nq2PNBRr9WZGo/jLEGkii97kBHto9gKdJV1MT17kDht7+DQX00msKGLq RiKL8uNiizrEkTKei2uRexj+f9yg/zfuGPy9PVT8srqtwwLCmJ4D5bZHN0b8OnnDfkz4 6ruYVg5PbEUrlnWPpGkfpBkeyvyzun65XL58CW5wD71UdJWp4wkmhCnmrJ3chqKX1yj+ aWwLci/3QzUhKFVl3suQJrB2Gy1r+qNxny7F93H/AjGmLmNsastVNRpNoT6ljBpXY+0i DYJ11VM++fuvXvl0TH5EwOja4yLfqcFYGZtelXG4EBjwh1mXDL7g2fG39mmLmDnGDfUW 1klA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4YQN11RHWqWYlow7WCdfiB2i6Tmy+9h5VA/awdDf+EI=; b=mNXNwau5ueTyAEE6SfdTEhkxlPPN8/2zgYjqhGYSIT3VtuSe1i83fJ2s57141/K5rI fRWe/SNjnqwIkcVPNvp9Ll0RzeDksjEoN6vUEbkq8bYbhDxzLE/k5KvUS57GGaC0U5gU EZssmzWSV9HObK0XvluS3evS9uGCk44J+ViDfnewpW0eTIfRDzG2E4WUrXSCdg8d05py OL+OwckokSWtauM8bwy8tNJEc9MjLRYcNBg9op7hcsXHgxEESFaKK0iPnEu7RglLPJrV A9W6nGMx2frEDuc8YJzqgBjSvUlzL3LLCjDB4Wu0hWR2RxRXK9p3bHQu7fV8zAyXv4k1 10ag== X-Gm-Message-State: APjAAAXd6ewVvqXQbMW69pEDiJRttJhYsRVzjyVgMi9Nclb4KVDlUtf5 Fp/OHskD1xE3kb4v/0VoLc0= X-Google-Smtp-Source: APXvYqwD+2KOd1yIQyKes5uceAG+L2EYl1OmHwp3XvIL9Vecr8UxZGLp5BaD+f0bWZer+9gDbNJjJg== X-Received: by 2002:a17:902:8f94:: with SMTP id z20mr2559856plo.62.1582868843077; Thu, 27 Feb 2020 21:47:23 -0800 (PST) Received: from phantasmagoria.svl.corp.google.com ([2620:15c:2c4:201:2b0a:8c1:6a84:1aa0]) by smtp.gmail.com with ESMTPSA id d3sm9027253pfn.113.2020.02.27.21.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 21:47:22 -0800 (PST) From: Arjun Roy To: davem@davemloft.net, akpm@linux-foundation.org, linux-mm@kvack.org Cc: arjunroy@google.com, soheil@google.com, edumazet@google.com, sfr@canb.auug.org.au, geert@linux-m68k.org Subject: [PATCH v3 mm 1/2] mm: Define pte_index as macro for x86 Date: Thu, 27 Feb 2020 21:47:13 -0800 Message-Id: <20200228054714.204424-1-arjunroy.kdev@gmail.com> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 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. Signed-off-by: Arjun Roy --- arch/x86/include/asm/pgtable.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtabl= e.h index 7e118660bbd9..d9925b10e326 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -828,7 +828,10 @@ static inline unsigned long pmd_index(unsigned long = address) * * this function returns the index of the entry in the pte page which wo= uld * 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); --=20 2.25.1.481.gfbce0eb801-goog