Re: [PATCH v4 01/48] mm: move some shrinker-related function declarations to mm/internal.h

From: Qi Zheng
Date: Tue Aug 15 2023 - 05:16:48 EST




On 2023/8/15 16:36, Muchun Song wrote:


On Aug 7, 2023, at 19:08, Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx> wrote:

The following functions are only used inside the mm subsystem, so it's
better to move their declarations to the mm/internal.h file.

1. shrinker_debugfs_add()
2. shrinker_debugfs_detach()
3. shrinker_debugfs_remove()

Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>

Reviewed-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>

One nit bellow.

[...]

+
+/*
+ * shrinker related functions
+ */

This is a multi-comment format. "/* shrinker related functions. */" is
the right one-line format of comment.

Will do.

Thanks,
Qi


+
+#ifdef CONFIG_SHRINKER_DEBUG
+extern int shrinker_debugfs_add(struct shrinker *shrinker);
+extern struct dentry *shrinker_debugfs_detach(struct shrinker *shrinker,
+ int *debugfs_id);
+extern void shrinker_debugfs_remove(struct dentry *debugfs_entry,
+ int debugfs_id);
+#else /* CONFIG_SHRINKER_DEBUG */
+static inline int shrinker_debugfs_add(struct shrinker *shrinker)
+{
+ return 0;
+}
+static inline struct dentry *shrinker_debugfs_detach(struct shrinker *shrinker,
+ int *debugfs_id)
+{
+ *debugfs_id = -1;
+ return NULL;
+}
+static inline void shrinker_debugfs_remove(struct dentry *debugfs_entry,
+ int debugfs_id)
+{
+}
+#endif /* CONFIG_SHRINKER_DEBUG */
+
#endif /* __MM_INTERNAL_H */
--
2.30.2