From patchwork Thu Feb 17 11:09:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12749838 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 49249C433F5 for ; Thu, 17 Feb 2022 11:10:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D44CA6B0078; Thu, 17 Feb 2022 06:10:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CF4CC6B007B; Thu, 17 Feb 2022 06:10:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE3346B007D; Thu, 17 Feb 2022 06:10:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0037.hostedemail.com [216.40.44.37]) by kanga.kvack.org (Postfix) with ESMTP id AC8D56B0078 for ; Thu, 17 Feb 2022 06:10:45 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6D4438249980 for ; Thu, 17 Feb 2022 11:10:45 +0000 (UTC) X-FDA: 79152004050.17.6CC32B5 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf22.hostedemail.com (Postfix) with ESMTP id 3698AC000C for ; Thu, 17 Feb 2022 11:10:44 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4JzsT561Ycz1FDG5; Thu, 17 Feb 2022 19:06:17 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 17 Feb 2022 19:10:40 +0800 From: Miaohe Lin To: CC: , , Subject: [PATCH] mm/mmu_notifiers: use helper function mmu_notifier_synchronize() Date: Thu, 17 Feb 2022 19:09:48 +0800 Message-ID: <20220217110948.35477-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Stat-Signature: 6xmi7qwuux5eexwmwaf6w6pa1duojitj X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3698AC000C Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspam-User: X-HE-Tag: 1645096244-766824 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: Use helper function mmu_notifier_synchronize() to ensure all mmu_notifiers are freed. Minor readability improvement. Signed-off-by: Miaohe Lin --- mm/mmu_notifier.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c index 459d195d2ff6..159f70c20236 100644 --- a/mm/mmu_notifier.c +++ b/mm/mmu_notifier.c @@ -334,15 +334,15 @@ static void mn_hlist_release(struct mmu_notifier_subscriptions *subscriptions, srcu_read_unlock(&srcu, id); /* - * synchronize_srcu here prevents mmu_notifier_release from returning to - * exit_mmap (which would proceed with freeing all pages in the mm) - * until the ->release method returns, if it was invoked by - * mmu_notifier_unregister. + * mmu_notifier_synchronize here prevents mmu_notifier_release from + * returning to exit_mmap (which would proceed with freeing all pages + * in the mm) until the ->release method returns, if it was invoked + * by mmu_notifier_unregister. * * The notifier_subscriptions can't go away from under us because * one mm_count is held by exit_mmap. */ - synchronize_srcu(&srcu); + mmu_notifier_synchronize(); } void __mmu_notifier_release(struct mm_struct *mm) @@ -851,7 +851,7 @@ void mmu_notifier_unregister(struct mmu_notifier *subscription, * Wait for any running method to finish, of course including * ->release if it was run by mmu_notifier_release instead of us. */ - synchronize_srcu(&srcu); + mmu_notifier_synchronize(); BUG_ON(atomic_read(&mm->mm_count) <= 0);