Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2023 22:06:33 GMT
From:      =?utf-8?Q?Jean-S=C3=A9bastien=20P=C3=A9dron?= <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 836367272917 - main - linuxkpi: Add `synchronize_shrinkers()`
Message-ID:  <202302142206.31EM6XPx004084@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by dumbbell (ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=83636727291714c235726da987a02c5b1d51bb54

commit 83636727291714c235726da987a02c5b1d51bb54
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-02-13 20:49:28 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-02-14 22:01:06 +0000

    linuxkpi: Add `synchronize_shrinkers()`
    
    It takes the lock and release it immediately to make sure no shrinkers
    are running in parallel.
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D38565
---
 sys/compat/linuxkpi/common/include/linux/shrinker.h | 2 ++
 sys/compat/linuxkpi/common/src/linux_shrinker.c     | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/shrinker.h b/sys/compat/linuxkpi/common/include/linux/shrinker.h
index 39ea35f0a862..04e96a12c4bd 100644
--- a/sys/compat/linuxkpi/common/include/linux/shrinker.h
+++ b/sys/compat/linuxkpi/common/include/linux/shrinker.h
@@ -51,8 +51,10 @@ struct shrinker {
 
 int	linuxkpi_register_shrinker(struct shrinker *s);
 void	linuxkpi_unregister_shrinker(struct shrinker *s);
+void	linuxkpi_synchronize_shrinkers(void);
 
 #define	register_shrinker(s)	linuxkpi_register_shrinker(s)
 #define	unregister_shrinker(s)	linuxkpi_unregister_shrinker(s)
+#define	synchronize_shrinkers()	linuxkpi_synchronize_shrinkers()
 
 #endif	/* _LINUXKPI_LINUX_SHRINKER_H_ */
diff --git a/sys/compat/linuxkpi/common/src/linux_shrinker.c b/sys/compat/linuxkpi/common/src/linux_shrinker.c
index b48e491a4e2f..227ef3261cb3 100644
--- a/sys/compat/linuxkpi/common/src/linux_shrinker.c
+++ b/sys/compat/linuxkpi/common/src/linux_shrinker.c
@@ -64,6 +64,14 @@ linuxkpi_unregister_shrinker(struct shrinker *s)
 	sx_xunlock(&sx_shrinker);
 }
 
+void
+linuxkpi_synchronize_shrinkers(void)
+{
+
+	sx_xlock(&sx_shrinker);
+	sx_xunlock(&sx_shrinker);
+}
+
 #define	SHRINKER_BATCH	512
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302142206.31EM6XPx004084>