From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: akpm@linux-foundation.org, gregkh@linuxfoundation.org,
rafael@kernel.org, viro@zeniv.linux.org.uk,
darrick.wong@oracle.com, paulmck@linux.vnet.ibm.com,
josh@joshtriplett.org, rostedt@goodmis.org,
mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com,
hughd@google.com, shuah@kernel.org, robh@kernel.org,
ulf.hansson@linaro.org, aspriel@gmail.com,
vivek.gautam@codeaurora.org, robin.murphy@arm.com,
joe@perches.com, heikki.krogerus@linux.intel.com,
ktkhai@virtuozzo.com, sfr@canb.auug.org.au,
vdavydov.dev@gmail.com, mhocko@suse.com,
chris@chris-wilson.co.uk, penguin-kernel@I-love.SAKURA.ne.jp,
aryabinin@virtuozzo.com, willy@infradead.org,
ying.huang@intel.com, shakeelb@google.com, jbacik@fb.com,
mingo@kernel.org, mhiramat@kernel.org,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org
Subject: [PATCH RFC 05/10] fs: Move list_lru_destroy() to destroy_super_work()
Date: Tue, 07 Aug 2018 18:38:23 +0300 [thread overview]
Message-ID: <153365630328.19074.5326096793225967868.stgit@localhost.localdomain> (raw)
In-Reply-To: <153365347929.19074.12509495712735843805.stgit@localhost.localdomain>
The patch makes s_dentry_lru and s_inode_lru be destroyed
later from the workqueue. This is preparation to split
unregister_shrinker(super_block::s_shrink) in two stages,
and to call finalize stage from destroy_super_work().
Note, that generic filesystem shrinker unregistration
is safe to be splitted in two stages right after this
patch, since super_cache_count() and super_cache_scan()
have a deal with s_dentry_lru and s_inode_lru only.
But there are two exceptions: XFS and SHMEM, which
define .nr_cached_objects() and .free_cached_objects()
callbacks. These two do not allow us to do the splitting
right after this patch. They touch fs-specific data,
which is destroyed earlier, than destroy_super_work().
So, we can't call unregister_shrinker_delayed_finalize()
from destroy_super_work() because of them, and next
patches make preparations to make this possible.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
fs/super.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/fs/super.c b/fs/super.c
index 426161360af3..457834278e37 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -159,6 +159,11 @@ static void destroy_super_work(struct work_struct *work)
destroy_work);
int i;
+ WARN_ON(list_lru_count(&s->s_dentry_lru));
+ WARN_ON(list_lru_count(&s->s_inode_lru));
+ list_lru_destroy(&s->s_dentry_lru);
+ list_lru_destroy(&s->s_inode_lru);
+
for (i = 0; i < SB_FREEZE_LEVELS; i++)
percpu_free_rwsem(&s->s_writers.rw_sem[i]);
kfree(s);
@@ -177,8 +182,6 @@ static void destroy_unused_super(struct super_block *s)
if (!s)
return;
up_write(&s->s_umount);
- list_lru_destroy(&s->s_dentry_lru);
- list_lru_destroy(&s->s_inode_lru);
security_sb_free(s);
put_user_ns(s->s_user_ns);
kfree(s->s_subtype);
@@ -283,8 +286,6 @@ static void __put_super(struct super_block *s)
{
if (!--s->s_count) {
list_del_init(&s->s_list);
- WARN_ON(s->s_dentry_lru.node);
- WARN_ON(s->s_inode_lru.node);
WARN_ON(!list_empty(&s->s_mounts));
security_sb_free(s);
put_user_ns(s->s_user_ns);
@@ -327,14 +328,6 @@ void deactivate_locked_super(struct super_block *s)
unregister_shrinker(&s->s_shrink);
fs->kill_sb(s);
- /*
- * Since list_lru_destroy() may sleep, we cannot call it from
- * put_super(), where we hold the sb_lock. Therefore we destroy
- * the lru lists right now.
- */
- list_lru_destroy(&s->s_dentry_lru);
- list_lru_destroy(&s->s_inode_lru);
-
put_filesystem(fs);
put_super(s);
} else {
next prev parent reply other threads:[~2018-08-07 15:38 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-07 15:37 [PATCH RFC 00/10] Introduce lockless shrink_slab() Kirill Tkhai
2018-08-07 15:37 ` [PATCH RFC 01/10] rcu: Make CONFIG_SRCU unconditionally enabled Kirill Tkhai
2018-08-08 0:55 ` Steven Rostedt
2018-08-08 1:05 ` Stephen Rothwell
2018-08-08 9:46 ` Kirill Tkhai
2018-08-08 1:08 ` Stephen Rothwell
2018-08-08 9:59 ` Kirill Tkhai
2018-08-08 11:04 ` Stephen Rothwell
2018-08-08 7:20 ` Michal Hocko
2018-08-08 10:17 ` Kirill Tkhai
2018-08-08 10:27 ` Michal Hocko
2018-08-08 21:31 ` Dave Chinner
2018-08-09 0:07 ` Matthew Wilcox
2018-08-09 7:45 ` Greg KH
2018-08-09 10:22 ` Kirill Tkhai
2018-08-08 16:13 ` Josh Triplett
2018-08-08 16:23 ` Kirill Tkhai
2018-08-08 16:30 ` Kirill Tkhai
2018-08-08 18:01 ` Josh Triplett
2018-08-08 23:02 ` Shakeel Butt
2018-08-08 23:09 ` Josh Triplett
2018-08-07 15:37 ` [PATCH RFC 02/10] mm: Make shrink_slab() lockless Kirill Tkhai
2018-08-08 11:51 ` Kirill Tkhai
2018-08-08 12:36 ` Tetsuo Handa
2018-08-08 12:51 ` Kirill Tkhai
2018-08-08 13:20 ` [PATCH RFC v2 " Kirill Tkhai
2018-08-09 7:14 ` Michal Hocko
2018-08-09 9:21 ` Kirill Tkhai
2018-08-09 10:37 ` Tetsuo Handa
2018-08-09 10:58 ` Kirill Tkhai
2018-08-09 11:23 ` Kirill Tkhai
2018-08-07 15:38 ` [PATCH RFC 03/10] mm: Convert shrinker_rwsem to mutex Kirill Tkhai
2018-08-07 15:38 ` [PATCH RFC 04/10] mm: Split unregister_shrinker() Kirill Tkhai
2018-08-07 15:38 ` Kirill Tkhai [this message]
2018-08-07 15:38 ` [PATCH RFC 06/10] fs: Shrink only (SB_ACTIVE|SB_BORN) superblocks in super_cache_scan() Kirill Tkhai
2018-08-07 15:38 ` [PATCH RFC 07/10] fs: Introduce struct super_operations::destroy_super() callback Kirill Tkhai
2018-08-07 15:39 ` [PATCH RFC 08/10] xfs: Introduce xfs_fs_destroy_super() Kirill Tkhai
2018-08-07 15:39 ` [PATCH RFC 09/10] shmem: Implement shmem_destroy_super() Kirill Tkhai
2018-08-07 15:39 ` [PATCH RFC 10/10] fs: Use unregister_shrinker_delayed_{initiate, finalize} for super_block shrinker Kirill Tkhai
2018-08-08 1:12 ` [PATCH RFC 00/10] Introduce lockless shrink_slab() Stephen Rothwell
2018-08-08 5:39 ` Shakeel Butt
2018-08-08 10:18 ` Kirill Tkhai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=153365630328.19074.5326096793225967868.stgit@localhost.localdomain \
--to=ktkhai@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=aryabinin@virtuozzo.com \
--cc=aspriel@gmail.com \
--cc=chris@chris-wilson.co.uk \
--cc=darrick.wong@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=hughd@google.com \
--cc=jbacik@fb.com \
--cc=jiangshanlai@gmail.com \
--cc=joe@perches.com \
--cc=josh@joshtriplett.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=rostedt@goodmis.org \
--cc=sfr@canb.auug.org.au \
--cc=shakeelb@google.com \
--cc=shuah@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=vdavydov.dev@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--cc=vivek.gautam@codeaurora.org \
--cc=willy@infradead.org \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).