• Andrew Morton's avatar
    [PATCH] VFS cache sizing fix for small machines · 227d8064
    Andrew Morton authored
    From: Matt Mackall <mpm@selenic.com>
    
    Doing the algebra:
    
    c = (a - b) * 3/2
    a' = a - c = a - 3/2(a - b) = (2a - 3a + 3b)/2 = (3b - a)/2
    a' >= 0
    3b - a >= 0
    3b >= a
    b >= a/3
    nr_free_pages() >= mempages/3
    
    We can indeed get into trouble if we try to load a large kernel on a very
    small box (ie kernel reserves more than 2/3 of usable memory).  Surprisingly I
    haven't hit this, but here's a fix.
    227d8064
dcache.c 41.9 KB