Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4252103pxb; Thu, 14 Oct 2021 01:27:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEhddAcWcJxzp0xMc0qG+A26fFU76guDu9y5Xv+XBEFIXb8O8mK19qHiW4YioWZeHG6azs X-Received: by 2002:a17:906:f92:: with SMTP id q18mr2004501ejj.353.1634200021514; Thu, 14 Oct 2021 01:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634200021; cv=none; d=google.com; s=arc-20160816; b=guIkkq9QjAjuk6pro9JrsL2pqS/Qx/a3ZPGcRLI5UPbLsI9KYg41u0lGEKTXYE0S+2 lIoAzBl9SsE4p0cVIq/kOdrkEPgCTStLBA9AGqDT5CMqjpQt5fcGLt+MJff0/YJbqyFc MteXF+KMxx24SoHBokAWtA0VHavrrgKFvkHr/2iSjRlUZRlLeWsOC6Ns6RZoCOhGMwGJ knJWBlvTS1L5mPVnFqC4/B0rL/yvCxBiPbRDuTSUVvy+7sgg1wQ4S8FWAuBTJgbmbnCS /pNvkUf/xhxDfpuT7ZUrC+nb4HvqwzYNYXtAC3rkmLyqo2Kh/rHgxGWWo2j3Ka9Bw1Gk RDIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=Y1wcCJ10AMkbngtu0ZVsB2vKXfB5ndZJY8Kk89G1094=; b=sW/o1GfPopW0j+fkRNLACYPhMuXLuwxPWgvMgXrpP7soCMlMad9CEbbkZKvS4+GeZo YT3oAVmBxNRFAybk6k4zvo5v7+cKRX79G/Hdy2XEjMYY+nbgkuuYK/f5ljVXepRil62o Cazrri5360drANvWeCaw1A93N01h8RPiSKh7wQGCo15lE8B3s7L1Y3fFzjRXZB56PhSP FoL6tFLbS5uE6JU8fVtmT2d1GhrkCXfW3cU4U7jRNHDXXbYzrItqiMvMLWVFzQWJ2V/1 /lPKD8g3+pyUwVc0QmnARnWhJBe85QVYX+xrBdXe2MUjvTkJfoEG0TIBBfMBpkGsXOsk lj6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Du7sLLmA; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gh16si2648542ejb.666.2021.10.14.01.26.37; Thu, 14 Oct 2021 01:27:01 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=Du7sLLmA; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230132AbhJNI0o (ORCPT + 99 others); Thu, 14 Oct 2021 04:26:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbhJNI0n (ORCPT ); Thu, 14 Oct 2021 04:26:43 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9708EC061570 for ; Thu, 14 Oct 2021 01:24:39 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id na16-20020a17090b4c1000b0019f5bb661f9so4261595pjb.0 for ; Thu, 14 Oct 2021 01:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=Y1wcCJ10AMkbngtu0ZVsB2vKXfB5ndZJY8Kk89G1094=; b=Du7sLLmAp7rOYRynO6tGncdrjvNGW9V+5ICwMdQs4zj20vLCKphyt4oqz61sCfQa/M 9ixj+l1NhjXgtiAQXDdhd6XnqCLLzpnCJ7Iljh//b/pmgESEgyh5GXeRl1Vn3sIOTQg+ CUoF09sg3SfHW17Xd7AMZ7qHGyVh2Wd4GjHUwIQ7MzoVgjYrbQSI4jatpCpnmpVWHedA MqRif7sWQ9U1pKxi9v4UTLZktG6bMM5pgPkd1NRa8y2myhaTP5PGhmDHDjBkNx4wp/tS nlKpxul01nZTBwS8lhZUgV8z+nErQufQWM2ik4ksmkAU3yU4T3w2HqUxR+hnX2oHfOV/ w5zg== 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; bh=Y1wcCJ10AMkbngtu0ZVsB2vKXfB5ndZJY8Kk89G1094=; b=SsoGF62yJJ+UKn4lau0eyqPbFA/WaWysF1mNrQ0hwFIvJ2XvTEVbPXDLFhMSu5QJ7q 45+GjdtRe0lHZWE5o2w07fBKlGGVCjwB7firlODmbSsZ37sI/jXQWo3Q0HJm0I1wyAdU ExIMSsYmSJRDKY3CUk5mHR16nzplhLYJyE00Ccf/YLYGDtchHnXUsha1JaipGjzUlfbn 6fMTF40/avUON67bvxgJ5m+CKps+1X3Hdwf3ofslIoj7Cl0D6YWm4UESX6GGfgU0WBU9 PSusfLEkFn+hoW2ooRPf5pU6yy4084Gu4EG2fqG4lROh8E1F8j4LK9So2oucq4IK446F 4DQw== X-Gm-Message-State: AOAM530PJfbiNPUK7BeBbVR3iUkn395g1EhEzUhH/p79my1hyuFw2qSN vz+PmTXhufvhL7bPGL5p3raDjBKJc0Za2pJs X-Received: by 2002:a17:90a:b105:: with SMTP id z5mr18438907pjq.64.1634199879137; Thu, 14 Oct 2021 01:24:39 -0700 (PDT) Received: from BJ-zhangqiang.qcraft.lan ([137.59.101.13]) by smtp.gmail.com with ESMTPSA id r31sm8153943pjg.28.2021.10.14.01.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 01:24:38 -0700 (PDT) From: Zqiang To: akpm@linux-foundation.org, sunhao.th@gmail.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Zqiang Subject: [PATCH] mm: backing-dev: use kfree_rcu() instead of synchronize_rcu_expedited() Date: Thu, 14 Oct 2021 16:24:33 +0800 Message-Id: <20211014082433.30733-1-qiang.zhang1211@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __init_work+0x2d/0x50 synchronize_rcu_expedited+0x3af/0x650 bdi_remove_from_list [inline] bdi_unregister+0x17f/0x5c0 release_bdi+0xa1/0xc0 kref_put [inline] bdi_put+0x72/0xa0 bdev_free_inode+0x11e/0x220 i_callback+0x3f/0x70 rcu_do_batch [inline] rcu_core+0x76d/0x16c0 __do_softirq+0x1d7/0x93b invoke_softirq [inline] __irq_exit_rcu [inline] irq_exit_rcu+0xf2/0x130 sysvec_apic_timer_interrupt+0x93/0xc0 The bdi_remove_from_list() is called in RCU softirq, however the synchronize_rcu_expedited() will produce sleep action, use kfree_rcu() instead of it. Reported-by: Hao Sun Signed-off-by: Zqiang --- include/linux/backing-dev-defs.h | 1 + mm/backing-dev.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index 33207004cfde..35a093384518 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -202,6 +202,7 @@ struct backing_dev_info { #ifdef CONFIG_DEBUG_FS struct dentry *debug_dir; #endif + struct rcu_head rcu; }; enum { diff --git a/mm/backing-dev.c b/mm/backing-dev.c index c878d995af06..45d866a3a4a2 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -935,8 +935,6 @@ static void bdi_remove_from_list(struct backing_dev_info *bdi) rb_erase(&bdi->rb_node, &bdi_tree); list_del_rcu(&bdi->bdi_list); spin_unlock_bh(&bdi_lock); - - synchronize_rcu_expedited(); } void bdi_unregister(struct backing_dev_info *bdi) @@ -969,7 +967,7 @@ static void release_bdi(struct kref *ref) bdi_unregister(bdi); WARN_ON_ONCE(bdi->dev); wb_exit(&bdi->wb); - kfree(bdi); + kfree_rcu(bdi, rcu); } void bdi_put(struct backing_dev_info *bdi) -- 2.17.1