[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070625205244.bbf0976a.akpm@linux-foundation.org>
Date: Mon, 25 Jun 2007 20:52:44 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: NeilBrown <neilb@...e.de>
Cc: nfs@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
"J. Bruce Fields" <bfields@...i.umich.edu>,
"J. Bruce Fields" <bfields@...ldses.org>
Subject: Re: [PATCH 007 of 8] knfsd: nfsd4: vary maximum delegation limit
based on RAM size
On Thu, 21 Jun 2007 14:31:12 +1000 NeilBrown <neilb@...e.de> wrote:
>
> From: "J. Bruce Fields" <bfields@...ldses.org>
>
>
> Our original NFSv4 delegation policy was to give out a read delegation
> on any open when it was possible to.
>
> Since the lifetime of a delegation isn't limited to that of an open, a
> client may quite reasonably hang on to a delegation as long as it has
> the inode cached. This becomes an obvious problem the first time a
> client's inode cache approaches the size of the server's total memory.
>
> Our first quick solution was to add a hard-coded limit. This patch
> makes a mild incremental improvement by varying that limit according to
> the server's total memory size, allowing at most 4 delegations per
> megabyte of RAM.
>
> My quick back-of-the-envelope calculation finds that in the worst case
> (where every delegation is for a different inode), a delegation could
> take about 1.5K, which would make the worst case usage about 6% of
> memory. The new limit works out to be about the same as the old on a
> 1-gig server.
>
> ...
>
> +static void
> +set_max_delegations()
> +{
> + struct sysinfo sys;
> +
> + si_meminfo(&sys);
> + sys.totalram *= sys.mem_unit;
> + sys.totalram >>= (18 - PAGE_SHIFT);
> + max_delegations = (unsigned int) sys.totalram;
> +}
Please put yourself in the position of the reader who happens across this
code and wonders why it is that way.
They could of course go hunt it out of the git repo but I do think it's
quite a bit more reader-friendly to explain the thinking in code comments.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists