From patchwork Fri Feb 28 03:03:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arjun Roy X-Patchwork-Id: 11411447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C00214E3 for ; Fri, 28 Feb 2020 03:03:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 27C5B246A2 for ; Fri, 28 Feb 2020 03:03:59 +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="eW2WOYy3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27C5B246A2 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 2C1FA6B0005; Thu, 27 Feb 2020 22:03:58 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 271C36B0006; Thu, 27 Feb 2020 22:03:58 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 188B76B0007; Thu, 27 Feb 2020 22:03:58 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 032E26B0005 for ; Thu, 27 Feb 2020 22:03:57 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C1DD24995FF for ; Fri, 28 Feb 2020 03:03:57 +0000 (UTC) X-FDA: 76538041314.29.touch11_574775d4744b X-Spam-Summary: 2,0,0,1dfc64e0c0fd73d5,d41d8cd98f00b204,arjunroy.kdev@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1431:1437:1515:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:4321:5007:6261:6653:7576:7901:9036:9413:10004:11026:11473:11657:11658:11914:12043:12296:12297:12517:12519:12555:12679:12895:12986:13053:13069:13311:13357:13894:14096:14181:14384:14394:14687:14721:21080:21444:21451:21627:21666:21990:30003:30054:30070,0,RBL:209.85.216.68:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: touch11_574775d4744b X-Filterd-Recvd-Size: 4541 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Fri, 28 Feb 2020 03:03:57 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id e9so658104pjr.4 for ; Thu, 27 Feb 2020 19:03:57 -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=GrhFlla7ucdMi+pAAiXNRXFMnDAp/dWD+4P4yhEESVo=; b=eW2WOYy3tI6mnxQCfhlw+GSGnTzSCqELUUT5hVrS1+xId0IQRaQVFQtrvWiSK6d2lJ WHqZinWA3QsZ71HUvd19Noc8YAX4sGopOSo3Cbs36o9xa3uLtQfyUTNFkhvhtIFiiD/2 URZBbwPV0ne6f++75BPyTfWxhc1vRLj9Tr9FJEG350ZB7dC1lX14KU5jLyBUboX2vCc0 jc+VbKd+jyoEeZ4twLnsVP25OiBAK0MJzfB+JcpPydeQvuL5PdTF8WTKlEUVbfFYegBD nVMbo9ML+uFdwLtLi9suXevYZLNvdPb0KINB4jRRhH1Ufxj7l7mKp6o/gRrV2ydSs2Me x1QQ== 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=GrhFlla7ucdMi+pAAiXNRXFMnDAp/dWD+4P4yhEESVo=; b=bdncWU0A+I/gonjScSbihOt65ZGTC9Un3wQh6uI5mch9ek26GXOqAo0X63M0pRv2Zn 1YjPE+2nBtE8KXUnhZZ+J0P5HPAm/ilH6g+WiRtJfrgwLVv9x9NO310SpQQHbyb/qePx MVnbHoFu4uC+EkYhM6CNKZBPOQUwxGpop5IkmxmvY5Qso0mLJGCNbUStAo1dNcsz9PlF Oz/uckxZXQQJwKVdxz75BSDO2cKdHIt4DpPGr7kOMGsSIeTdBXyQuXYoA7n5GWOTM4xR aMHBydnmOj70EJ+afggJL4PNAqyjQVlv84BOPbEIhNqnWJHOcqPNJy8QST1H7DdfJ8PZ UzvA== X-Gm-Message-State: APjAAAUbCImncFOK6SklwCkTHLQjK2fyVjPVHN3FFnKiXkTzgonCs9n+ FdZhX4EtyiZN8dbmbebSN8U= X-Google-Smtp-Source: APXvYqy/bvzuCI2RiGLSWm2CNKXhK5W/3Ev3xYg2cI8GiKYRxIPFFOsDp4YYjBrRzYbvbLNPgfP/1g== X-Received: by 2002:a17:902:7009:: with SMTP id y9mr1969917plk.254.1582859036113; Thu, 27 Feb 2020 19:03:56 -0800 (PST) Received: from phantasmagoria.svl.corp.google.com ([2620:15c:2c4:201:2b0a:8c1:6a84:1aa0]) by smtp.gmail.com with ESMTPSA id d22sm8342821pfo.187.2020.02.27.19.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 19:03:55 -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 v2 mm 1/2] mm: Define pte_index as macro for x86 Date: Thu, 27 Feb 2020 19:03:47 -0800 Message-Id: <20200228030348.101745-1-arjunroy.kdev@gmail.com> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog MIME-Version: 1.0 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/pgtable.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 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);