Browse Source

[malloc] Discard cached items less aggressively

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
8d95e1d6ff
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      src/core/malloc.c

+ 5
- 3
src/core/malloc.c View File

@@ -192,12 +192,14 @@ static inline void valgrind_make_blocks_noaccess ( void ) {
192 192
  */
193 193
 static unsigned int discard_cache ( void ) {
194 194
 	struct cache_discarder *discarder;
195
-	unsigned int discarded = 0;
195
+	unsigned int discarded;
196 196
 
197 197
 	for_each_table_entry ( discarder, CACHE_DISCARDERS ) {
198
-		discarded += discarder->discard();
198
+		discarded = discarder->discard();
199
+		if ( discarded )
200
+			return discarded;
199 201
 	}
200
-	return discarded;
202
+	return 0;
201 203
 }
202 204
 
203 205
 /**

Loading…
Cancel
Save