From patchwork Sun Apr 3 05:39:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12799486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D961EC433F5 for ; Sun, 3 Apr 2022 05:41:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 079456B0072; Sun, 3 Apr 2022 01:41:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 050546B0073; Sun, 3 Apr 2022 01:41:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA7C36B0074; Sun, 3 Apr 2022 01:41:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0066.hostedemail.com [216.40.44.66]) by kanga.kvack.org (Postfix) with ESMTP id DC4386B0072 for ; Sun, 3 Apr 2022 01:41:22 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 90EBE182B5287 for ; Sun, 3 Apr 2022 05:41:12 +0000 (UTC) X-FDA: 79314469584.21.A7CA013 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf09.hostedemail.com (Postfix) with ESMTP id 67A3914002B for ; Sun, 3 Apr 2022 05:41:11 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id a16so5668630plh.13 for ; Sat, 02 Apr 2022 22:41:10 -0700 (PDT) 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=Wvujdoj+rXf8TntjDreBsLKKbh2J4gp+Ud8xZlie1p0=; b=TCwPLuOIkV9+38cDLkpS9nuHTn65VZXSagGE6TWoOmUkruIu5+qF3NuNmWAfItBIZD sXdedXicM713G2Gaq+ubx4DWik03Qcj/3gAF0jV7yUwqCGnR/cGdjiNUTr5HBiMoaWBL l5HMCf7TtzZK2fclBrR9rIhfV7zRzydnFm0chT0bjmPlqWlnmz3pul9UnvWP7EAVQBK9 fgIeSdi7V8f0YcbmyjkPmQRNFerDaidkAzMo5vRBGQcwx+qxsDNJPpCWnY8wbDTmNV1j f9YLHSrBCv8R2lu/h1BrOd9a342SdGQ7Ase0xNRvLlS+K3/Kjnk33gdqXgNMhoNeZrLX T9fw== 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=Wvujdoj+rXf8TntjDreBsLKKbh2J4gp+Ud8xZlie1p0=; b=DJamwlbmqhjNhGdXBF9W56XhM/D0dLkuv2VSgocYy5nGgxNJKzzR1wRO3tKrBfRyX9 GOyUVB/4SrOIrSBln8L/pBsK0zwk9+6yS8seEu4HkMQznqgJXX12Vvv0GgSQZ1nCVLf4 xjVxVAjhkVjuyQnCy75jG51nbRo64AfH4cvkl/uxpYryqlcWU0wkdbXbLZL1fpyumn3N K+mH4wDX4G0rFFknLB6VgA+qL5f9tzN8PBhjKEbDabYcUFzKniWwJFQvqoWPJ2VyGqnQ fzdudN5n7ry/cqvrmENKsntmt/wnm/lkxB2tmA6AMX8RtXsEOqI+ERpH5DT13T/iE6a0 FK/A== X-Gm-Message-State: AOAM531vKxAQYbAt4KD/BGWrVPIlwts90g4dxgSqymcJMDNhKZ8f2BRe RJmUHPf1LP1zsmPJxvbYk+Ljrg== X-Google-Smtp-Source: ABdhPJyUkVA34KXhqdWAtjVviE8uqiNT/qpXOuafZYF1Nio1ft2L3/3huAbiQqZd1DwmC0Hw+XJQHQ== X-Received: by 2002:a17:90b:3447:b0:1c6:fe01:675c with SMTP id lj7-20020a17090b344700b001c6fe01675cmr19568783pjb.59.1648964469978; Sat, 02 Apr 2022 22:41:09 -0700 (PDT) Received: from FVFYT0MHHV2J.bytedance.net ([139.177.225.245]) by smtp.gmail.com with ESMTPSA id a38-20020a056a001d2600b004f70d5e92basm8262479pfx.34.2022.04.02.22.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Apr 2022 22:41:09 -0700 (PDT) From: Muchun Song To: dan.j.williams@intel.com, willy@infradead.org, jack@suse.cz, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, apopple@nvidia.com, shy828301@gmail.com, rcampbell@nvidia.com, hughd@google.com, xiyuyang19@fudan.edu.cn, kirill.shutemov@linux.intel.com, zwisler@kernel.org, hch@infradead.org Cc: linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, duanxiongchun@bytedance.com, smuchun@gmail.com, Muchun Song Subject: [PATCH v7 0/6] Fix some bugs related to ramp and dax Date: Sun, 3 Apr 2022 13:39:51 +0800 Message-Id: <20220403053957.10770-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: uqccddit1trd7jeux6a67999g6hmciu7 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=TCwPLuOI; spf=pass (imf09.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 67A3914002B X-HE-Tag: 1648964471-188545 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: This series is based on next-20220225. Patch 1-2 fix a cache flush bug, because subsequent patches depend on those on those changes, there are placed in this series. Patch 3-4 are preparation for fixing a dax bug in patch 5. Patch 6 is code cleanup since the previous patch remove the usage of follow_invalidate_pte(). v7: - Remove redurant "*" above vma_address() reported by Christoph. - Fix oops (reported by Qian) on arm64 by using "pmd_present() && pmd_devmap()" to workaround the bug in pmd_leaf() on arm64, which is fixed in another patch [1]. [1] https://lore.kernel.org/all/20220403024928.4125-1-songmuchun@bytedance.com/ v6: - Collect Reviewed-by from Christoph Hellwig. - Fold dax_entry_mkclean() into dax_writeback_one(). v5: - Collect Reviewed-by from Dan Williams. - Fix panic reported by kernel test robot . - Remove pmdpp parameter from follow_invalidate_pte() and fold it into follow_pte(). v4: - Fix compilation error on riscv. v3: - Based on next-20220225. v2: - Avoid the overly long line in lots of places suggested by Christoph. - Fix a compiler warning reported by kernel test robot since pmd_pfn() is not defined when !CONFIG_TRANSPARENT_HUGEPAGE on powerpc architecture. - Split a new patch 4 for preparation of fixing the dax bug. Muchun Song (6): mm: rmap: fix cache flush on THP pages dax: fix cache flush on PMD-mapped pages mm: rmap: introduce pfn_mkclean_range() to cleans PTEs mm: pvmw: add support for walking devmap pages dax: fix missing writeprotect the pte entry mm: simplify follow_invalidate_pte() fs/dax.c | 98 +++++++--------------------------------------------- include/linux/mm.h | 3 -- include/linux/rmap.h | 3 ++ mm/internal.h | 26 +++++++++----- mm/memory.c | 81 ++++++++++++------------------------------- mm/page_vma_mapped.c | 17 ++++----- mm/rmap.c | 68 +++++++++++++++++++++++++++++------- 7 files changed, 120 insertions(+), 176 deletions(-)