diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/kmemleak.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 93f14818e901..3c2b24c49a84 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
@@ -103,7 +103,6 @@ | |||
103 | * Kmemleak configuration and common defines. | 103 | * Kmemleak configuration and common defines. |
104 | */ | 104 | */ |
105 | #define MAX_TRACE 16 /* stack trace length */ | 105 | #define MAX_TRACE 16 /* stack trace length */ |
106 | #define REPORTS_NR 50 /* maximum number of reported leaks */ | ||
107 | #define MSECS_MIN_AGE 5000 /* minimum object age for reporting */ | 106 | #define MSECS_MIN_AGE 5000 /* minimum object age for reporting */ |
108 | #define SECS_FIRST_SCAN 60 /* delay before the first scan */ | 107 | #define SECS_FIRST_SCAN 60 /* delay before the first scan */ |
109 | #define SECS_SCAN_WAIT 600 /* subsequent auto scanning delay */ | 108 | #define SECS_SCAN_WAIT 600 /* subsequent auto scanning delay */ |
@@ -196,9 +195,6 @@ static int kmemleak_stack_scan = 1; | |||
196 | /* protects the memory scanning, parameters and debug/kmemleak file access */ | 195 | /* protects the memory scanning, parameters and debug/kmemleak file access */ |
197 | static DEFINE_MUTEX(scan_mutex); | 196 | static DEFINE_MUTEX(scan_mutex); |
198 | 197 | ||
199 | /* number of leaks reported (for limitation purposes) */ | ||
200 | static int reported_leaks; | ||
201 | |||
202 | /* | 198 | /* |
203 | * Early object allocation/freeing logging. Kmemleak is initialized after the | 199 | * Early object allocation/freeing logging. Kmemleak is initialized after the |
204 | * kernel allocator. However, both the kernel allocator and kmemleak may | 200 | * kernel allocator. However, both the kernel allocator and kmemleak may |
@@ -1106,11 +1102,6 @@ static void *kmemleak_seq_start(struct seq_file *seq, loff_t *pos) | |||
1106 | struct kmemleak_object *object; | 1102 | struct kmemleak_object *object; |
1107 | loff_t n = *pos; | 1103 | loff_t n = *pos; |
1108 | 1104 | ||
1109 | if (!n) | ||
1110 | reported_leaks = 0; | ||
1111 | if (reported_leaks >= REPORTS_NR) | ||
1112 | return NULL; | ||
1113 | |||
1114 | rcu_read_lock(); | 1105 | rcu_read_lock(); |
1115 | list_for_each_entry_rcu(object, &object_list, object_list) { | 1106 | list_for_each_entry_rcu(object, &object_list, object_list) { |
1116 | if (n-- > 0) | 1107 | if (n-- > 0) |
@@ -1135,8 +1126,6 @@ static void *kmemleak_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1135 | struct list_head *n = &prev_obj->object_list; | 1126 | struct list_head *n = &prev_obj->object_list; |
1136 | 1127 | ||
1137 | ++(*pos); | 1128 | ++(*pos); |
1138 | if (reported_leaks >= REPORTS_NR) | ||
1139 | goto out; | ||
1140 | 1129 | ||
1141 | rcu_read_lock(); | 1130 | rcu_read_lock(); |
1142 | list_for_each_continue_rcu(n, &object_list) { | 1131 | list_for_each_continue_rcu(n, &object_list) { |
@@ -1145,7 +1134,7 @@ static void *kmemleak_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1145 | break; | 1134 | break; |
1146 | } | 1135 | } |
1147 | rcu_read_unlock(); | 1136 | rcu_read_unlock(); |
1148 | out: | 1137 | |
1149 | put_object(prev_obj); | 1138 | put_object(prev_obj); |
1150 | return next_obj; | 1139 | return next_obj; |
1151 | } | 1140 | } |
@@ -1168,10 +1157,8 @@ static int kmemleak_seq_show(struct seq_file *seq, void *v) | |||
1168 | unsigned long flags; | 1157 | unsigned long flags; |
1169 | 1158 | ||
1170 | spin_lock_irqsave(&object->lock, flags); | 1159 | spin_lock_irqsave(&object->lock, flags); |
1171 | if ((object->flags & OBJECT_REPORTED) && unreferenced_object(object)) { | 1160 | if ((object->flags & OBJECT_REPORTED) && unreferenced_object(object)) |
1172 | print_unreferenced(seq, object); | 1161 | print_unreferenced(seq, object); |
1173 | reported_leaks++; | ||
1174 | } | ||
1175 | spin_unlock_irqrestore(&object->lock, flags); | 1162 | spin_unlock_irqrestore(&object->lock, flags); |
1176 | return 0; | 1163 | return 0; |
1177 | } | 1164 | } |