Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3418456pxb; Mon, 24 Jan 2022 09:08:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyRJn9DH/nXx0DKTdOud7TxGrW9FRbq6tbl2sGcDE5jMuD6uC888Mk4IwJZqLIpEWljy3w X-Received: by 2002:a63:460e:: with SMTP id t14mr12372677pga.222.1643044139355; Mon, 24 Jan 2022 09:08:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643044139; cv=none; d=google.com; s=arc-20160816; b=HlR0XsMmzjjUKjR6LRJ7+EmF2fqRW6gwraf/PEG72RpoPC0wI7Vfv+3h9YIsIz6A0Y kCzlxkecH5EEl4iHZ+JGHBz+uFoNtqq4CpRJaeyQxiNkjCREjpPhOdUIYpPC0QzsSnb5 ejA7975jZLnnN8wTmNXjwsyaDPRqQBELIEh4jia5dEEs6yy2Oe8BtTLwcwVJKIyhdEnR 6fzRNI5+IIPTYvgF+B3QfpTmJ6gwObHuOH85EGH+UkcNhDS+Msj+NFtcxzl518dQjYm2 brdNzqjOnukNvMYQsY1VmKwmKWV5eqh5G24/iDMzKP6EE/R76vIvRtQy1B43zzuuq4Mx JuFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=zP36aX2d/bL6wS6rcbFJKrOBtz963Nu2Kl7o23XZalE=; b=cbIZKiDq1K7hU3Fo45/lE1CR6Hsh1YnRoXlmlIwQTty/HMkS0M7kjNMloZcRMzNIb6 QceiEBH+sd5/wRANqI7RJ24nuMmlCRkxT8buFre9daP8nJDIjsYERF+ui82OjKGYZwce pN/XokHCU0n4mlIhXXAQ+mOJ1k4xo54M/p8wxh/HrOdxBDTlQmDeEUSz7de2hAscm1NE U6+sYeHmGrsjgjdJcsy7qBj7l78rmZo66UoVqiAdm7o9np1xq9/4MpIHux8i49fX1bWb +iPBojdJOoaLzV3nKdt7F4qrZlibrfVYKV6+g0GH+luwVLJzCzITFkY8tGGNgvRq5GNs JIHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=u53kMVT1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ch19si19336780pjb.163.2022.01.24.09.08.45; Mon, 24 Jan 2022 09:08:59 -0800 (PST) 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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=u53kMVT1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235775AbiAXFSF (ORCPT + 99 others); Mon, 24 Jan 2022 00:18:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbiAXFSE (ORCPT ); Mon, 24 Jan 2022 00:18:04 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC2EC06173B for ; Sun, 23 Jan 2022 21:18:04 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id j10so2183978pgc.6 for ; Sun, 23 Jan 2022 21:18:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zP36aX2d/bL6wS6rcbFJKrOBtz963Nu2Kl7o23XZalE=; b=u53kMVT1HAOzyAHD6LkcLXv4YmcYTS+naIZ3o73dHyAi/6jxb7xkkx8srkEdgI6wuC 5wqEUbd98o2kB8drLXvSSDVix9X3EGBdn6pvaTxT7RNdEpj645jfE4qxAwASiVAvDXjM ARH8ayPrDE+L+VJvOdCFEy1sDgaNA8hDRliKjCWmZHrR4+w64uAMmPbxQSHSEhdB+REO EytluLz/hkxH9jTtJGnz2GTlGJgren6/ISKvLuDi/HBw464+4Fuw25N1n46hjoT4BG18 LWJkecKpssASBvS1OOY3HltjsmttZchousDfKh2nxLBOfqhseBn3SgMHn4HwaRRPYU7a UNhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zP36aX2d/bL6wS6rcbFJKrOBtz963Nu2Kl7o23XZalE=; b=oqBTG/eE05/Vl0Abp2s5XslUAqlr/D/bPh4GgGRuHb0PlvTxczUYSkdlsl0qbVayV0 0T+/GCkJWg1B6rXlep9Wuyv0KWg8xaKTvCdFA4rS+jUcQFk/T9Ob4L4gk4Ozvt5g4WYi oEVfu0qsZyZcVNH7yQ3t7FrTNRTHGNVsayEN86fN6eqjd2UYhJ4bkEZ5/WnullXGTpNU IpDYXPIP5GxUZ21kY9WON7UpwQuL/8SIcAWvpttH8bjgAYl+sm0dGvaqaX44wxtZbHet 5Yyci3bCarpFrqkg7t126+AQbxva0SGVtIQKhLBJkRMZ9u96eya1v2t7XJoK60CX46Yz CjHw== X-Gm-Message-State: AOAM530+lwQ1h6jdSs1AJpvaudC1eUQhoGt4Uld55982DeUX/IbKSRM2 ppAZA/IB95+D/BQD71Vw+W7VqA== X-Received: by 2002:a63:8c59:: with SMTP id q25mr10494273pgn.13.1643001483990; Sun, 23 Jan 2022 21:18:03 -0800 (PST) Received: from FVFYT0MHHV2J.tiktokcdn.com ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id l21sm14263018pfu.120.2022.01.23.21.18.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 21:18:03 -0800 (PST) From: Muchun Song To: akpm@linux-foundation.org, zi.yan@cs.rutgers.edu, kirill.shutemov@linux.intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, duanxiongchun@bytedance.com, Muchun Song , Zi Yan Subject: [PATCH v2 1/2] mm: thp: fix wrong cache flush in remove_migration_pmd() Date: Mon, 24 Jan 2022 13:17:51 +0800 Message-Id: <20220124051752.83281-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The flush_cache_page() is supposed to be justified only if the page is already placed in process page table, and that is done right after flush_cache_page(). So using this interface is wrong. And there is no need to invalite cache since it was non-present before in remove_migration_pmd(). So just to remove it. Signed-off-by: Muchun Song Reviewed-by: Zi Yan --- Changes in v2: - Collect Reviewed-by tag. Thanks Zi. mm/huge_memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index f58524394dc1..45ede45b11f5 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3207,7 +3207,6 @@ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new) if (pmd_swp_uffd_wp(*pvmw->pmd)) pmde = pmd_wrprotect(pmd_mkuffd_wp(pmde)); - flush_cache_range(vma, mmun_start, mmun_start + HPAGE_PMD_SIZE); if (PageAnon(new)) page_add_anon_rmap(new, vma, mmun_start, true); else @@ -3215,6 +3214,8 @@ void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new) set_pmd_at(mm, mmun_start, pvmw->pmd, pmde); if ((vma->vm_flags & VM_LOCKED) && !PageDoubleMap(new)) mlock_vma_page(new); + + /* No need to invalidate - it was non-present before */ update_mmu_cache_pmd(vma, address, pvmw->pmd); } #endif -- 2.11.0