瀏覽代碼

[malloc] Discard cached items less aggressively

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 年之前
父節點
當前提交
8d95e1d6ff
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5
    3
      src/core/malloc.c

+ 5
- 3
src/core/malloc.c 查看文件

@@ -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…
取消
儲存