Thread (28 messages) 28 messages, 4 authors, 2021-03-22

Re: [PATCH v4] mm: cma: support sysfs

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2021-03-19 13:48:30
Also in: linux-tegra, lkml

On Fri, Mar 19, 2021 at 04:45:21PM +0300, Dmitry Osipenko wrote:
19.03.2021 16:42, Greg Kroah-Hartman пишет:
quoted
On Fri, Mar 19, 2021 at 04:39:41PM +0300, Dmitry Osipenko wrote:
quoted
19.03.2021 15:44, Dmitry Osipenko пишет:
...
quoted
quoted
 #include <linux/debugfs.h>
+#include <linux/kobject.h>
+
+struct cma_stat {
+	spinlock_t lock;
+	/* the number of CMA page successful allocations */
+	unsigned long nr_pages_succeeded;
+	/* the number of CMA page allocation failures */
+	unsigned long nr_pages_failed;
+	struct kobject kobj;
+};
 
 struct cma {
 	unsigned long   base_pfn;
@@ -16,6 +26,9 @@ struct cma {
 	struct debugfs_u32_array dfs_bitmap;
 #endif
 	char name[CMA_MAX_NAME];
+#ifdef CONFIG_CMA_SYSFS
+	struct cma_stat	*stat;
+#endif
What is the point of allocating stat dynamically?
Because static kobjects make me cry.
I meant that it's already a part of struct cma, it looks like the stat
could be embedded into struct cma and then kobj could be initialized
separately.
But that structure is statically allocated, so it can not be.  This has
been discussed in the past threads for when this was reviewed if you are
curious :)

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help