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.3 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 71C37C35666 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 30C9D207FD 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 30C9D207FD 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) Received: by kanga.kvack.org (Postfix, from userid 40) id BB0FF6B0006; Fri, 21 Feb 2020 16:17:24 -0500 (EST) 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-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-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 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() 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 --- 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))) =20 /* 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) =20 /* We cannot include at this point yet: */ --=20 2.25.0.265.gbab2e86ba0-goog