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=-7.0 required=3.0 tests=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 2B3DDC3F2CD for ; Sun, 1 Mar 2020 16:40:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BDFEE21775 for ; Sun, 1 Mar 2020 16:40:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BDFEE21775 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2E9376B0005; Sun, 1 Mar 2020 11:40:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 299D36B0006; Sun, 1 Mar 2020 11:40:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 189496B0007; Sun, 1 Mar 2020 11:40:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0217.hostedemail.com [216.40.44.217]) by kanga.kvack.org (Postfix) with ESMTP id F397E6B0005 for ; Sun, 1 Mar 2020 11:40:54 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C5C9E276FC for ; Sun, 1 Mar 2020 16:40:54 +0000 (UTC) X-FDA: 76547357628.08.feast18_7c4f4eb602b05 X-HE-Tag: feast18_7c4f4eb602b05 X-Filterd-Recvd-Size: 7709 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Sun, 1 Mar 2020 16:40:54 +0000 (UTC) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 021GdVuX063295 for ; Sun, 1 Mar 2020 11:40:53 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yfmu2ubm8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 01 Mar 2020 11:40:53 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 1 Mar 2020 16:40:51 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 1 Mar 2020 16:40:47 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 021Geksg48169148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 1 Mar 2020 16:40:46 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 846C6A4051; Sun, 1 Mar 2020 16:40:46 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A3E48A404D; Sun, 1 Mar 2020 16:40:45 +0000 (GMT) Received: from hump.haifa.ibm.com (unknown [9.148.206.239]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 1 Mar 2020 16:40:45 +0000 (GMT) Date: Sun, 1 Mar 2020 18:40:43 +0200 From: Mike Rapoport To: Stephen Rothwell Cc: Arjun Roy , 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. References: <20200221211707.257960-1-arjunroy.kdev@gmail.com> <20200227105045.6b421d9f@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200227105045.6b421d9f@canb.auug.org.au> X-TM-AS-GCONF: 00 x-cbid: 20030116-4275-0000-0000-000003A7106C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20030116-4276-0000-0000-000038BBF6E9 Message-Id: <20200301164043.GA19967@hump.haifa.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-03-01_05:2020-02-28,2020-03-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=1 spamscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 impostorscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003010130 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: On Thu, Feb 27, 2020 at 10:50:45AM +1100, Stephen Rothwell wrote: > Hi all, > > On Fri, 21 Feb 2020 13:17:07 -0800 Arjun Roy wrote: > > > > 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))) > > > > /* 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: */ > > -- > > 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 platforms. > > 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 FWIW: Reviewed-by: Mike Rapoport > --- > 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/pgtable_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))) > > /* 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) > > /* We cannot include at this point yet: */ > -- > 2.25.1 > > -- > Cheers, > Stephen Rothwell -- Sincerely yours, Mike.