Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Feb 2023 11:56:35 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-branches@FreeBSD.org
Subject:   git: 01b3fc89ddd8 - stable/13 - linuxkpi: Add `synchronize_shrinkers()`
Message-ID:  <202302161156.31GBuZWX056395@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=01b3fc89ddd8e48c6dfe584d44b6018edc4f3a5f

commit 01b3fc89ddd8e48c6dfe584d44b6018edc4f3a5f
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-16 11:55:20 +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
    
    (cherry picked from commit 83636727291714c235726da987a02c5b1d51bb54)
---
 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?202302161156.31GBuZWX056395>