]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[malloc] Discard cached items less aggressively
authorMichael Brown <mcb30@ipxe.org>
Mon, 9 Jul 2012 08:54:24 +0000 (09:54 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 9 Jul 2012 09:08:37 +0000 (10:08 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/malloc.c

index 6633887bdd93b0dd3cacc6b5c3edd3b1c2b7095e..8660f44936b852c27a2c006b6cf8cb8d31c15a34 100644 (file)
@@ -192,12 +192,14 @@ static inline void valgrind_make_blocks_noaccess ( void ) {
  */
 static unsigned int discard_cache ( void ) {
        struct cache_discarder *discarder;
-       unsigned int discarded = 0;
+       unsigned int discarded;
 
        for_each_table_entry ( discarder, CACHE_DISCARDERS ) {
-               discarded += discarder->discard();
+               discarded = discarder->discard();
+               if ( discarded )
+                       return discarded;
        }
-       return discarded;
+       return 0;
 }
 
 /**