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 0B9C0C3F2CD for ; Fri, 28 Feb 2020 00:47:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 96FA6246A5 for ; Fri, 28 Feb 2020 00:47:11 +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="b5GVlyPt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96FA6246A5 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 0B83D6B0005; Thu, 27 Feb 2020 19:47:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 068D86B0006; Thu, 27 Feb 2020 19:47:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E73246B0007; Thu, 27 Feb 2020 19:47:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0099.hostedemail.com [216.40.44.99]) by kanga.kvack.org (Postfix) with ESMTP id CC9856B0005 for ; Thu, 27 Feb 2020 19:47:10 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C4B45180AD807 for ; Fri, 28 Feb 2020 00:47:10 +0000 (UTC) X-FDA: 76537696620.19.toy27_78db63ac9ec0c X-HE-Tag: toy27_78db63ac9ec0c X-Filterd-Recvd-Size: 4459 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Fri, 28 Feb 2020 00:47:10 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id u3so503689plr.9 for ; Thu, 27 Feb 2020 16:47:10 -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=02RTkuwrEXYw+n1gJeC7e0lo7lWGJwygwHXErSlNuCI=; b=b5GVlyPtxWswhTNLW2pOZ5CAR3XGEr9UGrkQ2kceHS3+xxTYrG2mSIcJJTikPr0Cwk EvZd0F/3RMB72KJwhdSmsARC9L/UCPSu+4wcF7gIAtpgW3lghlTVKpx3kC+FBeNMJoOw Ohyl7JQKSupBwTC0aU4t9npQEV4vNhFjTyYvu+T3qn5+EsyN90vi/Bmw0rxh9EnLh0Im Se4g+6tYdT28YUysd7Gy6HocNDn5bUly0gvKjr4kOOXuav3W5zA7csVeDj3oS5Kjy7DW RIw4wxdgevqhJJLm6oM/VXOd6aUq1c22CDT2/qjsxSmmRo2nBlUn1msbn+Ime6Sfm7Jv wGdg== 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=02RTkuwrEXYw+n1gJeC7e0lo7lWGJwygwHXErSlNuCI=; b=QTaVyJ+db6FHWPVPiKcC2Lhq7U3RRFna1X+x0cVJ2DPlVBx8vLjS14ZvkOMwa5Noik X050G7wM/UtdAgh3gQERvuyquugS9IJyq++P3y90Q1cdvwFhxjhvdsrNR383jgFk6nMz 9ATnEEwFZ1qFJ/pqU0Vr3xF1diNwaKaWAd3t0mlxFwa1d4Sg9IviOu13QTY69G8vKHGN I6dVYpVxQBg3vE3Ex/f/9NtY8CkJPkZmF+EqzGmLXS4HN/HA/+991771cbFKhc1hEJPu jGSe6QAlVGpIvmt3cgiD46lH/KEhc/9k0/bQdUZQJKoRcjNZlnk2VeoqERiLJ1iu9/7S hE6w== X-Gm-Message-State: APjAAAWtQ5nhWMGHg6oaM9IKKn4WJ5rOEVKngANH62bUWdCVFRJWbI1D m3mzrWZElkgcPCKpRcBjdAI= X-Google-Smtp-Source: APXvYqz+nifiROZ/HQFWwwNx4NJuUrfN0cg3Zhen0FqXG+ZdWkfMReJSSu6nA6XY+oRi5/m2mGOOJQ== X-Received: by 2002:a17:902:7895:: with SMTP id q21mr1501607pll.222.1582850829081; Thu, 27 Feb 2020 16:47:09 -0800 (PST) Received: from phantasmagoria.svl.corp.google.com ([2620:15c:2c4:201:2b0a:8c1:6a84:1aa0]) by smtp.gmail.com with ESMTPSA id e4sm4525500pfi.99.2020.02.27.16.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 16:47:08 -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 mm 1/2] mm: Define pte_index as macro for x86 Date: Thu, 27 Feb 2020 16:46:56 -0800 Message-Id: <20200228004657.79943-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. 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..6658c04bce83 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -823,6 +823,9 @@ static inline unsigned long pmd_index(unsigned long a= ddress) */ #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) =20 +/* Degenerative definition so we can test if pte_index is defined for ar= ch. */ +#define pte_index pte_index + /* * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE= ] * --=20 2.25.1.481.gfbce0eb801-goog