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 <dumbb...@freebsd.org>
AuthorDate: 2023-02-13 20:49:28 +0000
Commit:     Jean-Sébastien Pédron <dumbb...@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

Reply via email to