Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4610754pxv; Tue, 20 Jul 2021 07:42:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzY/5wkNZaeUloJtUMnR6+rrNhuP3tT+2ywuwLu1B7vzA1IuVq7SQGyWJHNsRkzbdZQdfUW X-Received: by 2002:a05:6402:31a6:: with SMTP id dj6mr41886493edb.248.1626792178486; Tue, 20 Jul 2021 07:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626792178; cv=none; d=google.com; s=arc-20160816; b=qXjJ4bCxopkF3HBO/yhDTHdWGhfgjgtLw1uzmiJ/NxYyWVkxaAIjMlBCDH/j+bKk8f RvDYRjQGydVsqbF4/Yh3SlVcIVtc+xBlxPSazYhkmIcX+F4mT413UccpRusNjn5bdLei b+y7vvmACwuGCB6tuxA8c3K8SGaAgePdLfwsR6VlJuFOTr/EtA7e/B+W6dSUB0hLjrPq 6s53uqp1gppk69VgsPbOhFpzKt2IVvNova/cs7csSOLmTvicQL561fZvtGeW3GG+hXTC GwzjVY3RJc6+7KzJTtaiXhaKLhbUSCYrSi2fAhxYTgYMr7HBpAXv9Cqxe8+TNv+Vx+cn WznA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=6ZxlFXPrsd/fsarVq1ctAW2etfUTeiHa1pr/LQKxuI4=; b=K3LeTQFo7H/6XShuY/wOXY3uR1E9+bIl60hYXuQA2me6Bbj2NVAj6e/Lx7i/lUmEaw pXKCfwFIJiE7IwyMZUMpw6htvLjiXCudML8/5lQWH3Ulju+MhJVxjX8+PicBuxvEBYoF fR9ZP47SX4PuKekhjAQDP3bQ0moKY36KtffrSoZTwDUyO+nsPyzuoMLAznWiKhlkG0EQ O7KzHenMjZY2MkAjyUp6YD+tDzmUERs8NuRp6aBpc06kvK7vmyCY1HsGkQLQ8W19CzF/ IX2/BPRjDW7T89U60fRPO/qyyxcTv8dEpdv+ae/mZIOK50pg+jVxr/MhvZfbp9N23b8z z0bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="PtJ/F/5j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eg51si11822431edb.107.2021.07.20.07.42.34; Tue, 20 Jul 2021 07:42:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="PtJ/F/5j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239946AbhGTN72 (ORCPT + 99 others); Tue, 20 Jul 2021 09:59:28 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:19406 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238463AbhGTNpU (ORCPT ); Tue, 20 Jul 2021 09:45:20 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16KE63IH086006; Tue, 20 Jul 2021 10:25:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=6ZxlFXPrsd/fsarVq1ctAW2etfUTeiHa1pr/LQKxuI4=; b=PtJ/F/5jojBAXjyhpuBBxyjxpHkyBsmInV89gFddE1+ZF76XW+FB9VClFcAUnqxKPub7 9t8tNWNLu9GMpECJYVQir7oe2vSZ+7lCmF93Z8HEaKBpzXCjJ6wdegIPQ4mkWsRBKDHS EsFZXIeE1TSiQyh43BSkw1H0YK1SH89Y8KobUT7TTGsrf7rtait9sZTE/auQLT1Fju8e /qMfMSvNQwjzGU9i06k1tl0hVLUk6OMV1du7F/f+Yio0cSw8nWc6CESdJW1RGoJ4JOka cv9zN3ADwJk0JczVjQUrszyfG3v3mWmMsRr5u4Q2PC6kLgDsbZVBDMHZd8nstRT227sJ /w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39wv47pywd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Jul 2021 10:25:44 -0400 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16KE6fQG090841; Tue, 20 Jul 2021 10:25:43 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 39wv47pyv8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Jul 2021 10:25:43 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16KEFKVJ005875; Tue, 20 Jul 2021 14:25:41 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 39upu89c5t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Jul 2021 14:25:41 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16KEPcMu27263320 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Jul 2021 14:25:38 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 112B55204F; Tue, 20 Jul 2021 14:25:38 +0000 (GMT) Received: from oc7455500831.ibm.com (unknown [9.145.91.99]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6F55652065; Tue, 20 Jul 2021 14:25:37 +0000 (GMT) Subject: Re: [PATCH] mm,do_huge_pmd_numa_page: remove unnecessary TLB flushing code To: Huang Ying , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yang Shi , Dan Carpenter , Mel Gorman , Gerald Schaefer , Heiko Carstens , Hugh Dickins , Andrea Arcangeli , "Kirill A . Shutemov" , Michal Hocko , Vasily Gorbik , Zi Yan , Paolo Bonzini , kvm list References: <20210720065529.716031-1-ying.huang@intel.com> From: Christian Borntraeger Message-ID: Date: Tue, 20 Jul 2021 16:25:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210720065529.716031-1-ying.huang@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: FU4yu0Zn1I8QZgVMsco2mndyx-fhnmiq X-Proofpoint-GUID: LYxMiQJt1hqM8Xe1uAAPGe35_SqVz3wM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-20_07:2021-07-19,2021-07-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 adultscore=0 impostorscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 clxscore=1011 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107200089 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20.07.21 08:55, Huang Ying wrote: > Before the commit c5b5a3dd2c1f ("mm: thp: refactor NUMA fault > handling"), the TLB flushing is done in do_huge_pmd_numa_page() itself > via flush_tlb_range(). > > But after commit c5b5a3dd2c1f ("mm: thp: refactor NUMA fault > handling"), the TLB flushing is done in migrate_pages() as in the > following code path anyway. > > do_huge_pmd_numa_page > migrate_misplaced_page > migrate_pages > > So now, the TLB flushing code in do_huge_pmd_numa_page() becomes > unnecessary. So the code is deleted in this patch to simplify the > code. This is only code cleanup, there's no visible performance > difference. > > Signed-off-by: "Huang, Ying" > Cc: Yang Shi > Cc: Dan Carpenter > Cc: Mel Gorman > Cc: Christian Borntraeger > Cc: Gerald Schaefer > Cc: Heiko Carstens > Cc: Hugh Dickins > Cc: Andrea Arcangeli > Cc: Kirill A. Shutemov > Cc: Michal Hocko > Cc: Vasily Gorbik > Cc: Zi Yan > --- > mm/huge_memory.c | 26 -------------------------- > 1 file changed, 26 deletions(-) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index afff3ac87067..9f21e44c9030 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -1440,32 +1440,6 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf) > goto out; > } > > - /* > - * Since we took the NUMA fault, we must have observed the !accessible > - * bit. Make sure all other CPUs agree with that, to avoid them > - * modifying the page we're about to migrate. > - * > - * Must be done under PTL such that we'll observe the relevant > - * inc_tlb_flush_pending(). > - * > - * We are not sure a pending tlb flush here is for a huge page > - * mapping or not. Hence use the tlb range variant > - */ > - if (mm_tlb_flush_pending(vma->vm_mm)) { > - flush_tlb_range(vma, haddr, haddr + HPAGE_PMD_SIZE); > - /* > - * change_huge_pmd() released the pmd lock before > - * invalidating the secondary MMUs sharing the primary > - * MMU pagetables (with ->invalidate_range()). The > - * mmu_notifier_invalidate_range_end() (which > - * internally calls ->invalidate_range()) in > - * change_pmd_range() will run after us, so we can't > - * rely on it here and we need an explicit invalidate. > - */ > - mmu_notifier_invalidate_range(vma->vm_mm, haddr, > - haddr + HPAGE_PMD_SIZE); > - } > CC Paolo/KVM list so we also remove the mmu notifier here. Do we need those now in migrate_pages? I am not an expert in that code, but I cant find an equivalent mmu_notifier in migrate_misplaced_pages. I might be totally wrong, just something that I noticed. > pmd = pmd_modify(oldpmd, vma->vm_page_prot); > page = vm_normal_page_pmd(vma, haddr, pmd); > if (!page) >