From c7c7e7ee2afcb21f5523d6b66e539befe2b93b01 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Fri, 25 Oct 2013 02:42:35 +0200 Subject: kernel: disable freelist page caching for executables run from uncached mount the image cache has the property of keeping a channel for the executable binary arround which prevents the mountpoint from going away. this can easily be reproduced by running: @{rfork n; ramfs; cp /bin/echo /tmp; /tmp/echo} observe how ramfs stays arround until the image is reclaimed. the echo binary is also cached but is unreachable from any namespace. we now restrict the caching to mounts that use the client cache (-C flag) only. this should always be the case for /bin. places where this isnt the case might observe a performance regression. --- sys/src/9/port/page.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sys/src/9/port/page.c') diff --git a/sys/src/9/port/page.c b/sys/src/9/port/page.c index e8c5b6ce0..50cb4efca 100644 --- a/sys/src/9/port/page.c +++ b/sys/src/9/port/page.c @@ -228,6 +228,9 @@ putpage(Page *p) return; } + if(p->image && p->image->nocache) + uncachepage(p); + if(p->image && p->image != &swapimage) pagechaintail(p); else @@ -291,8 +294,8 @@ duppage(Page *p) /* Always call with p locked */ return; } - /* No freelist cache when memory is very low */ - if(palloc.freecount < swapalloc.highwater) { + /* No freelist cache with uncached image or when memory is very low */ + if(p->image->nocache || palloc.freecount < swapalloc.highwater) { unlock(&palloc); uncachepage(p); return; -- cgit v1.2.3