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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 2EA6FC6377C for ; Thu, 22 Jul 2021 00:26:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BF78261249 for ; Thu, 22 Jul 2021 00:26:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF78261249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 548DF6B0036; Wed, 21 Jul 2021 20:26:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D2496B005D; Wed, 21 Jul 2021 20:26:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 373736B006C; Wed, 21 Jul 2021 20:26:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id 190AB6B0036 for ; Wed, 21 Jul 2021 20:26:43 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id AE12F22015 for ; Thu, 22 Jul 2021 00:26:42 +0000 (UTC) X-FDA: 78388333044.09.D96F747 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf09.hostedemail.com (Postfix) with ESMTP id 05786300D60C for ; Thu, 22 Jul 2021 00:26:41 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10052"; a="198743771" X-IronPort-AV: E=Sophos;i="5.84,259,1620716400"; d="scan'208";a="198743771" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2021 17:26:40 -0700 X-IronPort-AV: E=Sophos;i="5.84,259,1620716400"; d="scan'208";a="501534993" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.239.159.119]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2021 17:26:36 -0700 From: "Huang, Ying" To: Sean Christopherson Cc: Yang Shi , Zi Yan , Christian Borntraeger , Andrew Morton , Linux MM , Linux Kernel Mailing List , Dan Carpenter , Mel Gorman , Gerald Schaefer , Heiko Carstens , Hugh Dickins , Andrea Arcangeli , "Kirill A . Shutemov" , Michal Hocko , Vasily Gorbik , Paolo Bonzini , kvm list Subject: Re: [PATCH] mm,do_huge_pmd_numa_page: remove unnecessary TLB flushing code References: <20210720065529.716031-1-ying.huang@intel.com> <0D75A92F-E2AA-480C-9E9A-0B6EE7897757@nvidia.com> Date: Thu, 22 Jul 2021 08:26:34 +0800 In-Reply-To: (Sean Christopherson's message of "Wed, 21 Jul 2021 15:41:05 +0000") Message-ID: <87lf5z9osl.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Authentication-Results: imf09.hostedemail.com; dkim=none; spf=none (imf09.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 134.134.136.20) smtp.mailfrom=ying.huang@intel.com; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none) X-Rspamd-Server: rspam05 X-Stat-Signature: xrwo9jcp6o8qp8ttdr4uirebrtjm5zq6 X-Rspamd-Queue-Id: 05786300D60C X-HE-Tag: 1626913601-503825 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: Sean Christopherson writes: >> >> Thanks, I think you are correct. By looking into commit 7066f0f933a1 >> ("mm: thp: fix mmu_notifier in migrate_misplaced_transhuge_page()"), >> the tlb flush and mmu notifier invalidate were needed since the old >> numa fault implementation didn't change PTE to migration entry so it >> may cause data corruption due to the writes from GPU secondary MMU. >> >> The refactor does use the generic migration code which converts PTE to >> migration entry before copying data to the new page. > > That's my understanding as well, based on this blurb from commit 7066f0f933a1. > > The standard PAGE_SIZEd migrate_misplaced_page is less accelerated and > uses the generic migrate_pages which transitions the pte from > numa/protnone to a migration entry in try_to_unmap_one() and flushes TLBs > and all mmu notifiers there before copying the page. > > That analysis/justification for removing the invalidate_range() call should be > captured in the changelog. Confirmation from Andrea would be a nice bonus. When we flush CPU TLB for a page that may be shared with device/VM TLB, we will call MMU notifiers for the page to flush the device/VM TLB. Right? So when we replaced CPU TLB flushing in do_huge_pmd_numa_page() with that in try_to_migrate_one(), we will replace the MMU notifiers calling too. Do you agree? Best Regards, Huang, Ying