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=-6.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 9DA2BC4BA24 for ; Wed, 26 Feb 2020 23:51:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2684821D7E for ; Wed, 26 Feb 2020 23:51:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=canb.auug.org.au header.i=@canb.auug.org.au header.b="L9/m9wy6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2684821D7E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=canb.auug.org.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C471A6B0003; Wed, 26 Feb 2020 18:51:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BF8166B0005; Wed, 26 Feb 2020 18:51:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0CD06B0006; Wed, 26 Feb 2020 18:51:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0174.hostedemail.com [216.40.44.174]) by kanga.kvack.org (Postfix) with ESMTP id 965816B0003 for ; Wed, 26 Feb 2020 18:51:02 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 41772180AD801 for ; Wed, 26 Feb 2020 23:51:02 +0000 (UTC) X-FDA: 76533926364.03.frogs64_8d9a22a5815c X-HE-Tag: frogs64_8d9a22a5815c X-Filterd-Recvd-Size: 6629 Received: from ozlabs.org (ozlabs.org [203.11.71.1]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Wed, 26 Feb 2020 23:51:00 +0000 (UTC) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 48SXcZ0YSxz9sPR; Thu, 27 Feb 2020 10:50:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1582761056; bh=zZP4S03RAqBew87tvMOnNyaUhmo+wortZovoIuJCGLg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=L9/m9wy6YfaNOhLbhpfCcVRVJHuT1EQDBN8F+Okl46V2YHh2Xl5koPd/GXEUUMrDi rnHL1n9EBtwlfVKSNAq/vAODi2X8nNy2qcv5I5+gt9Sf3gmf4cOWKeWACFlh9ecaHZ YQD8ptSKh4gbYWt30Kwxg0NOVNhPs/QKdgSf6UgMDyCV95Dft4eLGLXwc4VYHkBnVG 3KfEbQzgbRSeB8vPtCXVZ2yZlpXrEt8OF1SE664GNH8cbdhoxZyWIFwKfBKgkbG+6k o/h6MCqIBBScW6wpn1eKLDdC3hVYyLNMKJdAd3kpl83FVVdne+qUkfDkVnB1hczgWf ncMr4GqnYcn9A== Date: Thu, 27 Feb 2020 10:50:45 +1100 From: Stephen Rothwell To: Arjun Roy Cc: davem@davemloft.net, akpm@linux-foundation.org, linux-mm@kvack.org, arjunroy@google.com, soheil@google.com, edumazet@google.com Subject: Re: [PATCH mm] mm: Bring sparc pte_index() semantics inline with other platforms. Message-ID: <20200227105045.6b421d9f@canb.auug.org.au> In-Reply-To: <20200221211707.257960-1-arjunroy.kdev@gmail.com> References: <20200221211707.257960-1-arjunroy.kdev@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/TA+Du82r7GiWFfep_7OJVsy"; protocol="application/pgp-signature"; micalg=pgp-sha256 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: --Sig_/TA+Du82r7GiWFfep_7OJVsy Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi all, On Fri, 21 Feb 2020 13:17:07 -0800 Arjun Roy wrot= e: > > From: Arjun Roy >=20 > 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. >=20 > 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(). >=20 > Signed-off-by: Arjun Roy >=20 > --- > arch/sparc/include/asm/pgtable_64.h | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) >=20 > 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 I have applied the following patch to the akpm tree today (just ahead of "mm/memory.c: add vm_insert_pages()") - this includes my suggested changes. From: Arjun Roy Date: Fri, 21 Feb 2020 13:17:07 -0800 Subject: [PATCH] mm: Bring sparc pte_index() semantics inline with other pl= atforms. 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(). sfr: removed pte_entry and just directly modified pte_offset_kernel instead Signed-off-by: Arjun Roy Signed-off-by: Stephen Rothwell --- arch/sparc/include/asm/pgtable_64.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/p= gtable_64.h index 65494c3a420e..930ea3c12739 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -907,11 +907,11 @@ 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_offset_kernel(dir, address) \ + ((pte_t *) __pmd_page(*(dir)) + pte_index(address)) +#define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) #define pte_unmap(pte) do { } while (0) =20 /* We cannot include at this point yet: */ --=20 2.25.1 --=20 Cheers, Stephen Rothwell --Sig_/TA+Du82r7GiWFfep_7OJVsy Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEENIC96giZ81tWdLgKAVBC80lX0GwFAl5XBFYACgkQAVBC80lX 0Gw6Swf+IvxaZ9z8ae1vokm++rawQx/kBVGkViBitxaWw4T89ZzSgy4lqrN9neXz IUK+GOXaSteO6pe1k92Ic4vfOKAZSo5xlY8t0HjBNTFGUxhAvoCj27I/YHKYh/sh nYkRmAqk6/ftCAunsdfeC3DSRZ8+8DeXpBCB6synz63+yLYcqVrlsqZvLiJzuUjL vajXDXexDPZ1HOsvZPB79fCrmKU890EsrtInj9um1Qwj83WxcPwo7WgVStA0xX90 71c611ZalCJTKWHz6ZA73rt0XTAw2grnr/p10FVwEfoaVu1bx4sb+rqJufyBGhXE Wk7DgiLLmcAwc3mFszwI9Iq/rzUMJg== =UgAB -----END PGP SIGNATURE----- --Sig_/TA+Du82r7GiWFfep_7OJVsy--