From patchwork Fri Feb 21 21:17:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arjun Roy X-Patchwork-Id: 11397565 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 BF12714E3 for ; Fri, 21 Feb 2020 21:17:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8B4B5208C4 for ; Fri, 21 Feb 2020 21:17: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="U0rtL4z7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B4B5208C4 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 C28976B0003; Fri, 21 Feb 2020 16:17:24 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BB0FF6B0006; Fri, 21 Feb 2020 16:17:24 -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 AA0156B0007; Fri, 21 Feb 2020 16:17:24 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id 8DE696B0003 for ; Fri, 21 Feb 2020 16:17:24 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3BCEC1EFF for ; Fri, 21 Feb 2020 21:17:24 +0000 (UTC) X-FDA: 76515395208.30.plant97_7acb34787d230 X-Spam-Summary: 2,0,0,3c791e7b463a5a82,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:3352:3865:3867:3870:3872:4321:5007:6261:6653:7576:9036:9413:10004:11026:11473:11657:11658:11914:12043:12296:12297:12517:12519:12555:12679:12895:12986:13053:13069:13311:13357:13894:14181:14384:14394:14687:14721:21063:21080:21324:21433:21444:21451:21627:21666:21990:30003:30054,0,RBL:209.85.216.67:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.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: plant97_7acb34787d230 X-Filterd-Recvd-Size: 4555 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Fri, 21 Feb 2020 21:17:23 +0000 (UTC) Received: by mail-pj1-f67.google.com with SMTP id m13so1324897pjb.2 for ; Fri, 21 Feb 2020 13:17:23 -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=mrC+oltF8Or5t90thEoB9e/G6S/IWkv6pxKk981E0Is=; b=U0rtL4z7vSBPMOjZpnBufJccd7tONVllqHoCInsYixhXa9EMydJ4Kt8kmplZFUO2D4 6OLo0IUyo5BSPDqW6oOL349asRorp26/cGxUCU4ZPBUvebSAQLKvbcUroxxrLtvs4RxU NLy/ik1IRhK/qMMFCddw2o6ZMyeLPv067m6QqEPnmQftVysS70QBV6qFm4sYDExWl3I0 PySQdmQsw2og4xF8izVA7Q2/1A0R0130rfGr9AdMxAjeNViT2e9rhnrsbZ9GQ7Xz54WG 02Nu7K1xH7W0f4/f8D24sILF1LBDrisWmFeUV0O7upSl8c1gt3e13ITUKWX3ZxIvpMSj 5JoA== 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=mrC+oltF8Or5t90thEoB9e/G6S/IWkv6pxKk981E0Is=; b=Di2QpvIfUVjWcXE/rT/XV9LOSKkHqeoRCS3mmEUjOCgYmKexLwGVj0SIYUOzRUh3Dl YJp+fvHWW14oZxOfPn8rAHZIBM1ivl4pGS8cq62XnjTjPaPGTyATD/S92bUw8Fs5uVur sml7WNKsoS3KpeqWJVeUQ54mz8HZOG6kxZ9Wkhczab85pDP1FTaHjSvcDvIGVuM3jRBj BTpGm08+Ke6PwLIMqHH2/Gvk9l7fzOK+5MXZBG+Fp0udltRLQREhSOxEXuOJ6TTtYvHS oxT7/3uqSR+B4pv8erMRNR8je32zQHzXMjlhL3ba45WjCfCjposvdvKGbvuvdVfuZqTv pNoA== X-Gm-Message-State: APjAAAVT9L9sh838C2jJAfOKd59IVBfSRlNbzdKZj5yf7UQyY9iCl/53 uIh+QlqCTA4KsY2toQgFKXY= X-Google-Smtp-Source: APXvYqxKETKKh4ebM0u76N2qPgoYYrCQojH6ndN5kr67gyAPqQ+bnHZCamU3xyFhsfkl+apZefwk9g== X-Received: by 2002:a17:902:224:: with SMTP id 33mr37364270plc.246.1582319842863; Fri, 21 Feb 2020 13:17:22 -0800 (PST) Received: from phantasmagoria.svl.corp.google.com ([2620:15c:2c4:201:2b0a:8c1:6a84:1aa0]) by smtp.gmail.com with ESMTPSA id 17sm3658475pfv.142.2020.02.21.13.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 13:17: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 Subject: [PATCH mm] mm: Bring sparc pte_index() semantics inline with other platforms. Date: Fri, 21 Feb 2020 13:17:07 -0800 Message-Id: <20200221211707.257960-1-arjunroy.kdev@gmail.com> X-Mailer: git-send-email 2.25.0.265.gbab2e86ba0-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() on platforms other than sparc return a numerical index. On sparc, it returns a pte_t*. This presents an issue for vm_insert_pages(), which relies on pte_index() to find the offset for a pte within a pmd, for batched inserts. This patch: 1. Modifies pte_index() for sparc to return a numerical index, like other platforms, 2. Defines pte_entry() for sparc which returns a pte_t* (as pte_index() used to), 3. Converts existing sparc callers for pte_index() to use pte_entry(). Signed-off-by: Arjun Roy Signed-off-by: Arjun Roy Signed-off-by: Stephen Rothwell --- arch/sparc/include/asm/pgtable_64.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index 65494c3a420e..851ed0f99159 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -907,11 +907,12 @@ static inline unsigned long pud_pfn(pud_t pud) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))) /* Find an entry in the third-level page table.. */ -#define pte_index(dir, address) \ - ((pte_t *) __pmd_page(*(dir)) + \ - ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) -#define pte_offset_kernel pte_index -#define pte_offset_map pte_index +#define pte_index(address) \ + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_entry(dir, address) \ + ((pte_t *) __pmd_page(*(dir)) + pte_index(address)) +#define pte_offset_kernel pte_entry +#define pte_offset_map pte_entry #define pte_unmap(pte) do { } while (0) /* We cannot include at this point yet: */