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=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 946D5C433E0 for ; Thu, 25 Jun 2020 00:30:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2A7AC20706 for ; Thu, 25 Jun 2020 00:30:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="vyfAIpZq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A7AC20706 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 79A766B0002; Wed, 24 Jun 2020 20:30:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74B236B0003; Wed, 24 Jun 2020 20:30:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5ED396B0005; Wed, 24 Jun 2020 20:30:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0173.hostedemail.com [216.40.44.173]) by kanga.kvack.org (Postfix) with ESMTP id 4340C6B0002 for ; Wed, 24 Jun 2020 20:30:57 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9F806180AD82F for ; Thu, 25 Jun 2020 00:30:56 +0000 (UTC) X-FDA: 76965854112.24.test48_27153f326e48 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 7A4991A4A0 for ; Thu, 25 Jun 2020 00:30:56 +0000 (UTC) X-HE-Tag: test48_27153f326e48 X-Filterd-Recvd-Size: 5970 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Thu, 25 Jun 2020 00:30:55 +0000 (UTC) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05P0IZZe035797; Thu, 25 Jun 2020 00:30:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=v5UZ8E2BaaKVJw0SUqbMQAWJdec91gruES39hMbMVCU=; b=vyfAIpZqjw9o9dcPYLfc/MxH6nNL6/pCrCoztRMLPfSXuDFzTHOuSmmA5I8H9t/FhDcU +Wrd4UmERiu5/cSb7AMvfn0HRzTuqKq+w8G0BGVQTDDwgf8vt0x3e0W8enbkQvbgkyrS LZQ/Ub9qxCo1gM5TDuisOXJiPMIkkrEn6fnAPC+okiY+mPMtCSp9vTr+llb5nHlsTQ1/ R2rYhSPN/eJOJHOoFxs1T3O/2Jqak/dNcRnxP6Cubh480t/O/vMtFiAzmKlTSoZmMDZx /iHF9SivYpppHceukNi7vDUoo3K9AQf2jwoB2wnQBHlWSv8oHOzRfs3yK6DGRBHAgb6v mQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 31uustwsbc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 25 Jun 2020 00:30:47 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05P0IDQv195085; Thu, 25 Jun 2020 00:30:46 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 31uur83whu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Jun 2020 00:30:46 +0000 Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 05P0UdVM024958; Thu, 25 Jun 2020 00:30:39 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 25 Jun 2020 00:30:39 +0000 Subject: Re: [PATCH 2/3] mm/huge_memory.c: update tlb entry if pmd is changed To: Bibo Mao , Andrew Morton , Thomas Bogendoerfer , Paul Burton , Anshuman Khandual , Mike Rapoport , Daniel Silsby Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <1592990792-1923-1-git-send-email-maobibo@loongson.cn> <1592990792-1923-2-git-send-email-maobibo@loongson.cn> From: Mike Kravetz Message-ID: <07f78e99-6e59-0bce-8ac0-50d7c7600461@oracle.com> Date: Wed, 24 Jun 2020 17:30:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <1592990792-1923-2-git-send-email-maobibo@loongson.cn> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9662 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 malwarescore=0 suspectscore=18 mlxlogscore=999 adultscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006250000 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9662 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=18 bulkscore=0 cotscore=-2147483648 malwarescore=0 mlxscore=0 clxscore=1011 lowpriorityscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 spamscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006250000 X-Rspamd-Queue-Id: 7A4991A4A0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 6/24/20 2:26 AM, Bibo Mao wrote: > When set_pmd_at is called in function do_huge_pmd_anonymous_page, > new tlb entry can be added by software on MIPS platform. > > Here add update_mmu_cache_pmd when pmd entry is set, and > update_mmu_cache_pmd is defined as empty excepts arc/mips platform. > This patch has no negative effect on other platforms except arc/mips > system. I am confused by this comment. It appears that update_mmu_cache_pmd is defined as non-empty on arc, mips, powerpc and sparc architectures. Am I missing something? If those architectures do provide update_mmu_cache_pmd, then the previous patch and this one now call update_mmu_cache_pmd with the actual faulting address instead of the huge page aligned address. This was intentional for mips. However, are there any potential issues on the other architectures? I am no expert in any of those architectures. arc looks like it could be problematic as update_mmu_cache_pmd calls update_mmu_cache and then operates on (address & PAGE_MASK). That could now be different. -- Mike Kravetz > > Signed-off-by: Bibo Mao > --- > mm/huge_memory.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 0f9187b..8b4ccf7 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -643,6 +643,7 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, > lru_cache_add_active_or_unevictable(page, vma); > pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable); > set_pmd_at(vma->vm_mm, haddr, vmf->pmd, entry); > + update_mmu_cache_pmd(vma, vmf->address, vmf->pmd); > add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); > mm_inc_nr_ptes(vma->vm_mm); > spin_unlock(vmf->ptl); > @@ -756,6 +757,7 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) > } else { > set_huge_zero_page(pgtable, vma->vm_mm, vma, > haddr, vmf->pmd, zero_page); > + update_mmu_cache_pmd(vma, vmf->address, vmf->pmd); > spin_unlock(vmf->ptl); > set = true; > } >