mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
	rushikesh.s.kadam@intel.com, urezki@gmail.com,
	neeraj.iitr10@gmail.com, frederic@kernel.org, paulmck@kernel.org,
	rostedt@goodmis.org, rcu@vger.kernel.org
Subject: [PATCH v3 resend 4/6] fs: Move call_rcu() to call_rcu_lazy() in some paths
Date: Tue,  9 Aug 2022 03:45:15 +0000	[thread overview]
Message-ID: <20220809034517.3867176-5-joel@joelfernandes.org> (raw)
In-Reply-To: <20220809034517.3867176-1-joel@joelfernandes.org>

This is required to prevent callbacks triggering RCU machinery too
quickly and too often, which adds more power to the system.

When testing, we found that these paths were invoked often when the
system is not doing anything (screen is ON but otherwise idle).

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 fs/dcache.c     | 4 ++--
 fs/eventpoll.c  | 2 +-
 fs/file_table.c | 2 +-
 fs/inode.c      | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 93f4f5ee07bf..7f51bac390c8 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -366,7 +366,7 @@ static void dentry_free(struct dentry *dentry)
 	if (unlikely(dname_external(dentry))) {
 		struct external_name *p = external_name(dentry);
 		if (likely(atomic_dec_and_test(&p->u.count))) {
-			call_rcu(&dentry->d_u.d_rcu, __d_free_external);
+			call_rcu_lazy(&dentry->d_u.d_rcu, __d_free_external);
 			return;
 		}
 	}
@@ -374,7 +374,7 @@ static void dentry_free(struct dentry *dentry)
 	if (dentry->d_flags & DCACHE_NORCU)
 		__d_free(&dentry->d_u.d_rcu);
 	else
-		call_rcu(&dentry->d_u.d_rcu, __d_free);
+		call_rcu_lazy(&dentry->d_u.d_rcu, __d_free);
 }
 
 /*
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 971f98af48ff..57b3f781760c 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -729,7 +729,7 @@ static int ep_remove(struct eventpoll *ep, struct epitem *epi)
 	 * ep->mtx. The rcu read side, reverse_path_check_proc(), does not make
 	 * use of the rbn field.
 	 */
-	call_rcu(&epi->rcu, epi_rcu_free);
+	call_rcu_lazy(&epi->rcu, epi_rcu_free);
 
 	percpu_counter_dec(&ep->user->epoll_watches);
 
diff --git a/fs/file_table.c b/fs/file_table.c
index 5424e3a8df5f..417f57e9cb30 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -56,7 +56,7 @@ static inline void file_free(struct file *f)
 	security_file_free(f);
 	if (!(f->f_mode & FMODE_NOACCOUNT))
 		percpu_counter_dec(&nr_files);
-	call_rcu(&f->f_u.fu_rcuhead, file_free_rcu);
+	call_rcu_lazy(&f->f_u.fu_rcuhead, file_free_rcu);
 }
 
 /*
diff --git a/fs/inode.c b/fs/inode.c
index bd4da9c5207e..38fe040ddbd6 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -312,7 +312,7 @@ static void destroy_inode(struct inode *inode)
 			return;
 	}
 	inode->free_inode = ops->free_inode;
-	call_rcu(&inode->i_rcu, i_callback);
+	call_rcu_lazy(&inode->i_rcu, i_callback);
 }
 
 /**
-- 
2.37.1.559.g78731f0fdb-goog


  parent reply	other threads:[~2022-08-09  3:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09  3:45 [PATCH v3 resend 0/6] Implement call_rcu_lazy() and miscellaneous fixes Joel Fernandes (Google)
2022-08-09  3:45 ` [PATCH v3 resend 1/6] rcu: Introduce call_rcu_lazy() API implementation Joel Fernandes (Google)
2022-08-09  3:45 ` [PATCH v3 resend 2/6] rcu: shrinker for lazy rcu Joel Fernandes (Google)
2022-08-09  3:45 ` [PATCH v3 resend 3/6] rcuscale: Add laziness and kfree tests Joel Fernandes (Google)
2022-08-09  3:45 ` Joel Fernandes (Google) [this message]
2022-08-18 17:22   ` [PATCH v3 resend 4/6] fs: Move call_rcu() to call_rcu_lazy() in some paths Joel Fernandes
2022-08-18 17:23   ` Joel Fernandes
2022-08-18 23:05     ` Joel Fernandes
2022-08-19  1:21       ` Joel Fernandes
2022-08-19  1:29         ` Joel Fernandes
2022-08-19  2:35         ` Paul E. McKenney
2022-08-19  2:45           ` Joel Fernandes
2022-08-19 16:30             ` Joel Fernandes
2022-08-19 17:12               ` Paul E. McKenney
2022-08-19 18:14                 ` Joel Fernandes
2022-08-19 18:17                   ` Joel Fernandes
2022-08-19 18:26                     ` Paul E. McKenney
2022-08-19 18:29                       ` Joel Fernandes
2022-08-19 19:40                   ` Joel Fernandes
2022-08-19 19:58                     ` Paul E. McKenney
2022-08-19 20:13                       ` Joel Fernandes
2022-08-09  3:45 ` [PATCH v3 resend 5/6] rcutorture: Add test code for call_rcu_lazy() Joel Fernandes (Google)
2022-08-09  3:45 ` [PATCH v3 resend 6/6] debug: Toggle lazy at runtime and change flush jiffies Joel Fernandes (Google)
2022-08-11  2:23 ` [PATCH v3 resend 0/6] Implement call_rcu_lazy() and miscellaneous fixes Joel Fernandes
2022-08-11  2:31   ` Joel Fernandes
2022-08-11  2:51     ` Paul E. McKenney
2022-08-11  3:22       ` Joel Fernandes
2022-08-11  3:46         ` Paul E. McKenney

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=20220809034517.3867176-5-joel@joelfernandes.org \
    --to=joel@joelfernandes.org \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neeraj.iitr10@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rushikesh.s.kadam@intel.com \
    --cc=urezki@gmail.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

all inboxes | Powered by JetHome®