wireless: Add memory usage debugging.
From: Ben Greear <[email protected]>
The bss objects are reference counted, and the ies are also tricky to keep track of. Add option to track allocation and freeing of the ies and bss objects, and add debugfs files to show the current objects.
Signed-off-by Ben Greear <[email protected]>
---
This patch is against wireless-next.
net/wireless/Kconfig | 13 +++++ net/wireless/core.c | 5 +- net/wireless/core.h | 17 ++++++ net/wireless/debugfs.c | 117 ++++++++++++++++++++++++++++++++++++++++++++ net/wireless/debugfs.h | 2 + net/wireless/scan.c | 127 ++++++++++++++++++++++++++++++++++++++++++------ 6 files changed, 264 insertions(+), 17 deletions(-)
net/wireless/Kconfig +13 -0
@@ -115,6 +115,19 @@ config CFG80211_DEBUGFS If unsure, say N. +config CFG80211_MEM_DEBUGGING + bool "cfg80211 memory debugging logic" + default n + depends on CFG80211_DEBUGFS + ---help--- + Enable this if you want to debug memory handling for bss and ies + objects. New debugfs files: ieee80211/all_ies and all_bss will + be created to display these objects. This has a moderate CPU cost + and uses a bit more memory than normal, but otherwise is not very + expensive. + + If unsure, say N. + config CFG80211_INTERNAL_REGDB bool "use statically compiled regulatory rules database" if EXPERT default n
net/wireless/core.c +3 -2
@@ -990,6 +990,7 @@ static int __init cfg80211_init(void) goto out_fail_nl80211; ieee80211_debugfs_dir =debugfs_create_dir ("ieee80211" ,NULL ); +ieee80211_debugfs_add_glbl (ieee80211_debugfs_dir); err =regulatory_init ();if (err)
@@ -1006,7 +1007,7 @@ static int __init cfg80211_init(void) out_fail_wq:regulatory_exit (); out_fail_reg: -debugfs_remove (ieee80211_debugfs_dir); +debugfs_remove_recursive (ieee80211_debugfs_dir); out_fail_nl80211:unregister_netdevice_notifier (&cfg80211_netdev_notifier); out_fail_notifier:
@@ -1020,7 +1021,7 @@ subsys_initcall(cfg80211_init); static void __exit cfg80211_exit(void) { -debugfs_remove (ieee80211_debugfs_dir); +debugfs_remove_recursive (ieee80211_debugfs_dir);nl80211_exit ();unregister_netdevice_notifier (&cfg80211_netdev_notifier);wiphy_sysfs_exit ();
net/wireless/core.h +17 -0
@@ -114,6 +114,23 @@ extern struct workqueue_struct *cfg80211_wq;extern struct list_head cfg80211_rdev_list;extern int cfg80211_rdev_list_generation; +#ifdef CONFIG_CFG80211_MEM_DEBUGGING + +struct wifi_mem_tracker { +struct list_head mylist; +char buf[40 ]; +void *ptr; +}; +extern struct list_head ies_list; +extern spinlock_t ies_lock; +extern atomic_t ies_count; + +extern struct list_head bss_list; +extern spinlock_t bss_lock; +extern atomic_t bss_count; + +#endif +struct cfg80211_internal_bss {struct list_head list;struct list_head hidden_list;
net/wireless/debugfs.c +117 -0
133 lines not on this page · raw message
net/wireless/debugfs.h +2 -0
@@ -3,9 +3,11 @@#ifdef CONFIG_CFG80211_DEBUGFS void cfg80211_debugfs_rdev_add (struct cfg80211_registered_device *rdev); +void ieee80211_debugfs_add_glbl (struct dentry *dir);#else static inline void cfg80211_debugfs_rdev_add (struct cfg80211_registered_device *rdev) {} +static inline void ieee80211_debugfs_add_glbl (struct dentry *dir) { }#endif #endif /* __CFG80211_DEBUGFS_H */
net/wireless/scan.c +112 -15
188 lines not on this page · raw message
Signature · 1 line
1.7.3.4