summaryrefslogtreecommitdiffstats
path: root/src/core/malloc.c
diff options
context:
space:
mode:
authorMichael Brown2012-07-09 10:54:24 +0200
committerMichael Brown2012-07-09 11:08:37 +0200
commit8d95e1d6ff7b77ac6ea4d675c524c75d896c5d4b (patch)
tree12abdffc66d0bbe2ec0b26e0391e27422753c54a /src/core/malloc.c
parent[iobuf] Allocate I/O buffer descriptor separately to conserve aligned memory (diff)
downloadipxe-8d95e1d6ff7b77ac6ea4d675c524c75d896c5d4b.tar.gz
ipxe-8d95e1d6ff7b77ac6ea4d675c524c75d896c5d4b.tar.xz
ipxe-8d95e1d6ff7b77ac6ea4d675c524c75d896c5d4b.zip
[malloc] Discard cached items less aggressively
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/malloc.c')
-rw-r--r--src/core/malloc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/malloc.c b/src/core/malloc.c
index 6633887b..8660f449 100644
--- a/src/core/malloc.c
+++ b/src/core/malloc.c
@@ -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;
}
/**