Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2475034pxm; Sun, 27 Feb 2022 22:54:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzEXnObG2d7opcB9LKpz77+fLbZIeMEPJZ+Dp6jYtZ2RB6jKtFhKfrPcc1307MpWi38mCSK X-Received: by 2002:a05:6a00:24c7:b0:4e1:cb76:32d1 with SMTP id d7-20020a056a0024c700b004e1cb7632d1mr20059076pfv.36.1646031283939; Sun, 27 Feb 2022 22:54:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646031283; cv=none; d=google.com; s=arc-20160816; b=AmxGqJU7at71mxcW9kFDcHBgInQGvpjlYA6UI8HO+glb1m9BUHQKfLUsoZMe+WoFco agkX0S4wBrA5aO0UEo3MoaB88xmG884SFmZuhxi47sGqH4jwK/iaZIarMc4+hSxzmIP3 zjkCyEkKhh00nCIAgf6BjCKqLpO1hkBOd3Yyvbq6T86K09vU0Lme7v0zyJs92CC87EWX 5NCPNwfYf5ySbI3byXaYZ/WM22GIBjYl7ThFcLW1+Vaxqua4NXIHV2l8mEO3AmFAwI2G B9MgkXZTj6XgIfFjRAbIb9hp3TD/SWjdZZvpuDX58Ns8uDU7G5mHyT/jVYGpeScJ+98W YfgA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4hzepAOQTsZTnVcr4QPZkWOiCoYklQmYHIbKFxu1/40=; b=pvSJZEIRg1WBkcz1zoPSIynd0/Y/IHZnfef1eAhMqZj8BSRT32DktdwQhwN3VX/SPv 0E/r2Fg2ha7FZrchHoC/HFl66jfSV+qznx6VRwm2H9MxG2wnXccCUf/b5AtM5Z1KwAHO BEvVDurEwiMjOr2m4mjQrFgsbcL0o1f4GzOz2yfBZemR08jICJWbmmDtXD1hYhcLgc8g uv6abLBYVxvlIXYBkem/ga9VgZ7oVm8aRgb8W4AT8KrSVTm0a7GOYSnHjYRQWdiw6n/e n/VW6wIhGm0lN0zn0lwejXF1j9t5RsWGemZilXLrD6SPw4vuXgQz4LrqxgCzM7DLMryG Ym5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=6HLgk72K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s7-20020a056a00178700b004f0f0f8529esi7713833pfg.72.2022.02.27.22.54.28; Sun, 27 Feb 2022 22:54:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=6HLgk72K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233257AbiB1Ghb (ORCPT + 99 others); Mon, 28 Feb 2022 01:37:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233300AbiB1Gh2 (ORCPT ); Mon, 28 Feb 2022 01:37:28 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C0A66F87 for ; Sun, 27 Feb 2022 22:36:38 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id u16so10184382pfg.12 for ; Sun, 27 Feb 2022 22:36:38 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=4hzepAOQTsZTnVcr4QPZkWOiCoYklQmYHIbKFxu1/40=; b=6HLgk72Kdglyxsw+8BlARvezx741uWUej3+BnNBrAZfWtuioeXLnCZw+qyBFJRBK+m B/IsH1CvI0L08PqX7H7DvZ8vijJppm4uGyOD/GyeVzlZn2M3vR/G6fysXE2TfEv8e50J 3SN77OfLp05Re90/fV2IVGp39pqSfAcY6XapPh81hqbgrd/+qsxV5w+MjnulORgnDBd9 LTslegwrEHzpQVz5ZS/HPDqlRyhFvu3Ez/v1XqbF4dIMbYVDAQryr+wl2iYb3MX2oLQ4 c7GHk+VsgfesZ1iveu5a6GVroAqH4FT0xKFMAMgkm4eJkrLsvbb2EdUuRNtaFgCYP2qr zZDA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=4hzepAOQTsZTnVcr4QPZkWOiCoYklQmYHIbKFxu1/40=; b=KiBGKk5C5PYlN71iTn7hg/kC8NJ4Ssz18NNbOKPsVlU2hTKes1PumCvcDBopwVIlCv CFueZ9+TSSdWSsTGYhf3FzAf2y1sJwL7sun/NKaffsQzavBrMIngp8fm/DPe4H1WMRJw 63m3K2wXcJ9TNecPEE6TOocUrc3SIvZgF5R4O8+0EtqwFSic1x3Uo/t5Fhi0UayoPEFH L0HMaNd2Iij/vyn4pw0p0VQ4t/9wwhQ58WT6EwBPFZVgi019gVHBa4Mx2MCtcyDWi9o9 CvOWO6wA9pAQf8fnYKldLL4nKRtJgh1kW4pJAS0/Sy3UT67LGVRZwOoSsZ+QXKedL/r9 1chg== X-Gm-Message-State: AOAM532Rw/vxZlCnW+6CS1/jkKzxy8ZpkOKRlgCFS9qEMjnNO+qLR7uT XTuZ4sEo67OavsOSfW66df/leg== X-Received: by 2002:a05:6a00:248c:b0:4ce:1932:80dd with SMTP id c12-20020a056a00248c00b004ce193280ddmr20084253pfv.48.1646030197701; Sun, 27 Feb 2022 22:36:37 -0800 (PST) Received: from FVFYT0MHHV2J.tiktokcdn.com ([139.177.225.227]) by smtp.gmail.com with ESMTPSA id q13-20020aa7960d000000b004f13804c100sm11126472pfg.165.2022.02.27.22.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Feb 2022 22:36:37 -0800 (PST) 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 v3 6/6] mm: remove range parameter from follow_invalidate_pte() Date: Mon, 28 Feb 2022 14:35:36 +0800 Message-Id: <20220228063536.24911-7-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220228063536.24911-1-songmuchun@bytedance.com> References: <20220228063536.24911-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The only user (DAX) of range parameter of follow_invalidate_pte() is gone, it safe to remove the range paramter and make it static to simlify the code. Signed-off-by: Muchun Song --- include/linux/mm.h | 3 --- mm/memory.c | 23 +++-------------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index c9bada4096ac..be7ec4c37ebe 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1871,9 +1871,6 @@ void free_pgd_range(struct mmu_gather *tlb, unsigned long addr, unsigned long end, unsigned long floor, unsigned long ceiling); int copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma); -int follow_invalidate_pte(struct mm_struct *mm, unsigned long address, - struct mmu_notifier_range *range, pte_t **ptepp, - pmd_t **pmdpp, spinlock_t **ptlp); int follow_pte(struct mm_struct *mm, unsigned long address, pte_t **ptepp, spinlock_t **ptlp); int follow_pfn(struct vm_area_struct *vma, unsigned long address, diff --git a/mm/memory.c b/mm/memory.c index cc6968dc8e4e..278ab6d62b54 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4964,9 +4964,8 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address) } #endif /* __PAGETABLE_PMD_FOLDED */ -int follow_invalidate_pte(struct mm_struct *mm, unsigned long address, - struct mmu_notifier_range *range, pte_t **ptepp, - pmd_t **pmdpp, spinlock_t **ptlp) +static int follow_invalidate_pte(struct mm_struct *mm, unsigned long address, + pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp) { pgd_t *pgd; p4d_t *p4d; @@ -4993,31 +4992,17 @@ int follow_invalidate_pte(struct mm_struct *mm, unsigned long address, if (!pmdpp) goto out; - if (range) { - mmu_notifier_range_init(range, MMU_NOTIFY_CLEAR, 0, - NULL, mm, address & PMD_MASK, - (address & PMD_MASK) + PMD_SIZE); - mmu_notifier_invalidate_range_start(range); - } *ptlp = pmd_lock(mm, pmd); if (pmd_huge(*pmd)) { *pmdpp = pmd; return 0; } spin_unlock(*ptlp); - if (range) - mmu_notifier_invalidate_range_end(range); } if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd))) goto out; - if (range) { - mmu_notifier_range_init(range, MMU_NOTIFY_CLEAR, 0, NULL, mm, - address & PAGE_MASK, - (address & PAGE_MASK) + PAGE_SIZE); - mmu_notifier_invalidate_range_start(range); - } ptep = pte_offset_map_lock(mm, pmd, address, ptlp); if (!pte_present(*ptep)) goto unlock; @@ -5025,8 +5010,6 @@ int follow_invalidate_pte(struct mm_struct *mm, unsigned long address, return 0; unlock: pte_unmap_unlock(ptep, *ptlp); - if (range) - mmu_notifier_invalidate_range_end(range); out: return -EINVAL; } @@ -5055,7 +5038,7 @@ int follow_invalidate_pte(struct mm_struct *mm, unsigned long address, int follow_pte(struct mm_struct *mm, unsigned long address, pte_t **ptepp, spinlock_t **ptlp) { - return follow_invalidate_pte(mm, address, NULL, ptepp, NULL, ptlp); + return follow_invalidate_pte(mm, address, ptepp, NULL, ptlp); } EXPORT_SYMBOL_GPL(follow_pte); -- 2.11.0