From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9B6FDC001B0 for ; Tue, 25 Jul 2023 03:01:37 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qO8Im-0003DH-Pk; Tue, 25 Jul 2023 03:01:33 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qO8Im-0003DB-3x for linux-f2fs-devel@lists.sourceforge.net; Tue, 25 Jul 2023 03:01:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=BOm9JtzAMmxvhoSbX2NtL3QoGfALrOaBCsSuiN3HvS8=; b=lrObTSyE/Zt6CvQMYxKx41jE4s CWwdWO5PoAyeN7zqlULOKVLgDjM0FvSNHQJtSqxkzjqkE0d2xsaU0uO+4Y5i8X7vOif6PD3f9iNC5 4nz/fPh23qkZU2g9/Hh2e3CUVAnhnYDgIhPPJX5jUNVkS7Ve0b3Mjz2QTbbzHL6TWbvU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BOm9JtzAMmxvhoSbX2NtL3QoGfALrOaBCsSuiN3HvS8=; b=nD87vGqNVeIBhi4dRoF+U136Hs mTZ0OSHISNnF+Hp7ahBlj5/RG5P8NGf+m65szy6Yg/qf8aRMf3+wRFcsYmAifzag81rhdCPNfBMHA rOBHUp7RVzlORKcCO0PmOqQN0Cgm+Vhf+0iQXciwFehP0CKsYOyRBXAe5yWuRsKZ/m38=; Received: from mail-pf1-f174.google.com ([209.85.210.174]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1qO8Ih-0000UL-1z for linux-f2fs-devel@lists.sourceforge.net; Tue, 25 Jul 2023 03:01:32 +0000 Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-682a5465e9eso1177319b3a.1 for ; Mon, 24 Jul 2023 20:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690254081; x=1690858881; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=BOm9JtzAMmxvhoSbX2NtL3QoGfALrOaBCsSuiN3HvS8=; b=S6qTrQW9jNBAqKkMe5A0Cu8+HbQDlzC3TLro07t5ACviirx/XqhnqUPjiclTs78MVw L8tR0RX+uwWODTuNUCn9GO7p4bXpfIsdbkjqpY0PqVfJilI1CACHVzYlY/iV0sWP5V/3 T3P+fsJZrl/T8/61jZYJY4PyQofvYiMvXNGAlNPnqvgQIdqIJpCErJLddWxt9/CHMYvA fQfQW01/Y2q+AlIExOo9mNzILsmJhUWs4VPYn88so7T3w1Nn66xNTb/c35K8Neo4b+tp wg91etpXIESM3veFJOsmMl9xQ0iXGYxs+8+DAjrpr00+sWBSXajvrars1puw7bQqkMd4 /qUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690254081; x=1690858881; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BOm9JtzAMmxvhoSbX2NtL3QoGfALrOaBCsSuiN3HvS8=; b=NfpJsFPuXVY8gueIUZFLQoJsPOuFmX/z7OKCvJ4O7GU9UwDEiHh3J9phA2Dx+wB91+ 3p4t66cEKCRPpJ/cDFxgVojXHImLRjkSwYxxBUqKe9Hc2P46biclaKH5RgpY4OGM2aUj 7Hmi18jbN3qEp1HcNpY35IaBUQw2c4+hCaLBfD8VsxnueC/hkeU8uIhRmnRMFQdOvPRs F53k0unLQwXnKUKgi6aoJN39j5c+GwtzEGxcyGAWew6tynkTewjbNEzRpPpyQIk8Dj+V ljnT2BDc3fftZFE6HfdBGkd/BgjF4uzljXMCPXgNDuIK9+fZG6bY3I1YSx7twAcRU1Pf YbvQ== X-Gm-Message-State: ABy/qLYo9Gq3uj/7eWwcFlG7Y46Lu87oS2e1t5y6YVlEzoLvtk0FEGmj +uz+Udg5QUVBpvu6b1/MAVeCAA== X-Google-Smtp-Source: APBJJlFM6WPSihXOKl0X4zg92CAAfeqIP/jkVagMNd5II31TO+klkQLkXzKhhJFyUFA6pGL+niCVGA== X-Received: by 2002:a05:6a20:160d:b0:111:a0e5:d2b7 with SMTP id l13-20020a056a20160d00b00111a0e5d2b7mr15056320pzj.4.1690254081364; Mon, 24 Jul 2023 20:01:21 -0700 (PDT) Received: from [10.70.252.135] ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id fe15-20020a056a002f0f00b0066ccb8e8024sm8472563pfb.30.2023.07.24.20.01.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Jul 2023 20:01:20 -0700 (PDT) Message-ID: <9b149dd9-1617-9af4-4252-6d0df01f93b1@bytedance.com> Date: Tue, 25 Jul 2023 11:01:06 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US To: Peter Zijlstra References: <20230724094354.90817-1-zhengqi.arch@bytedance.com> <20230724094354.90817-4-zhengqi.arch@bytedance.com> <20230724122549.GA3731903@hirez.programming.kicks-ass.net> In-Reply-To: <20230724122549.GA3731903@hirez.programming.kicks-ass.net> X-Headers-End: 1qO8Ih-0000UL-1z Subject: Re: [f2fs-dev] [PATCH v2 03/47] mm: shrinker: add infrastructure for dynamically allocating shrinker X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Qi Zheng via Linux-f2fs-devel Reply-To: Qi Zheng Cc: kvm@vger.kernel.org, djwong@kernel.org, roman.gushchin@linux.dev, david@fromorbit.com, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, linux-mtd@lists.infradead.org, cel@kernel.org, x86@kernel.org, steven.price@arm.com, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, paulmck@kernel.org, linux-arm-msm@vger.kernel.org, linux-nfs@vger.kernel.org, rcu@vger.kernel.org, linux-bcache@vger.kernel.org, yujie.liu@intel.com, vbabka@suse.cz, linux-raid@vger.kernel.org, brauner@kernel.org, tytso@mit.edu, gregkh@linuxfoundation.org, muchun.song@linux.dev, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, senozhatsky@chromium.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org, tkhai@ya.ru Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Hi Peter, On 2023/7/24 20:25, Peter Zijlstra wrote: > On Mon, Jul 24, 2023 at 05:43:10PM +0800, Qi Zheng wrote: > >> +void shrinker_unregister(struct shrinker *shrinker) >> +{ >> + struct dentry *debugfs_entry; >> + int debugfs_id; >> + >> + if (!shrinker || !(shrinker->flags & SHRINKER_REGISTERED)) >> + return; >> + >> + down_write(&shrinker_rwsem); >> + list_del(&shrinker->list); >> + shrinker->flags &= ~SHRINKER_REGISTERED; >> + if (shrinker->flags & SHRINKER_MEMCG_AWARE) >> + unregister_memcg_shrinker(shrinker); >> + debugfs_entry = shrinker_debugfs_detach(shrinker, &debugfs_id); >> + up_write(&shrinker_rwsem); >> + >> + shrinker_debugfs_remove(debugfs_entry, debugfs_id); > > Should there not be an rcu_barrier() right about here? The shrinker_debugfs_remove() will wait for debugfs_file_put() to return, so when running here, all shrinker debugfs operations have been completed. And the slab shrink will hold the read lock of shrinker_rwsem to traverse the shrinker_list, so when we hold the write lock of shrinker_rwsem to delete the shrinker from the shrinker_list, the shrinker will not be executed again. So I think there is no need to add a rcu_barrier() here. Please let me know if I missed something. Thanks, Qi > >> + >> + kfree(shrinker->nr_deferred); >> + shrinker->nr_deferred = NULL; >> + >> + kfree(shrinker); >> +} >> +EXPORT_SYMBOL(shrinker_unregister); > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel