buffer patch for 2.0.31

Bill Hawes (whawes@star.net)
Wed, 06 Aug 1997 11:42:52 -0400

This is a multi-part message in MIME format.
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I went through the 2.0.31 pre-3 buffer.c patches, and it looks like the
important (and safe) fixes are there.

I would like to propose one further small change to refill_freelist,
which is to test for free_list non-empty and return early _before_
starting to exhaust the reserved pages. This change is manifestly safe,
as it's just a retesting of the original condition for entry into

The situation I'm trying to avoid is having a short-term buffer shortage
deplete the reserved pages, which can then render the system unstable.
By getting the task out early with some buffers, we buy time for other
events (buffers unlocking, flushing buffers, other tasks releasing
memory, etc.) to make existing buffers available to reap. But once
reserved pages are converted into buffers, it's not that easy to get
them back.

I've tested this change running simultaneous compiles and copying big
files in 6M, and although it didn't prevent bottoming out reserved pages
and waking bdflush, everything did finish successfully.

Content-Type: text/plain; charset=us-ascii; name="buffer_31-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="buffer_31-patch"

--- fs/buffer.c.old Wed Aug 6 10:18:22 1997
+++ fs/buffer.c Wed Aug 6 11:15:46 1997
@@ -669,6 +669,13 @@

+ /*
+ * In order to protect our reserved pages,
+ * return now if we got any buffers.
+ */
+ if (free_list[BUFSIZE_INDEX(size)])
+ return;
/* and repeat until we find something good */
if (!grow_buffers(GFP_ATOMIC, size))