Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jul 2015 02:20:42 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285808 - head/sys/kern
Message-ID:  <201507230220.t6N2KgG9070819@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jeff
Date: Thu Jul 23 02:20:41 2015
New Revision: 285808
URL: https://svnweb.freebsd.org/changeset/base/285808

Log:
   - Don't defeat the FIFO nature of the buffer cache by eliminating the
     most recently used buffer when we are under paging pressure.  This is
     a perversion of the buffer and page replacement algorithms and recent
     improvements to the page daemon have rendered it unnecessary.  In the
     event that low-memory deadlocks become an issue it would be possible
     to make a daemon or event handler that performs a similar action on
     the oldest buffers rather than the newest.  Since the buf cache
     is analogous to the page cache and some minimum working set is desired
     another possibility is to simply shrink the minimum working set which
     has less downside now that file pages are not directly mapped.
  
  Sponsored by:	EMC / Isilon
  Reviewed by:	alc, kib (with some minor objection)
  Tested by:	pho

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Wed Jul 22 23:30:54 2015	(r285807)
+++ head/sys/kern/vfs_bio.c	Thu Jul 23 02:20:41 2015	(r285808)
@@ -1563,15 +1563,6 @@ buf_dirty_count_severe(void)
 	return(numdirtybuffers >= hidirtybuffers);
 }
 
-static __noinline int
-buf_vm_page_count_severe(void)
-{
-
-	KFAIL_POINT_CODE(DEBUG_FP, buf_pressure, return 1);
-
-	return vm_page_count_severe();
-}
-
 /*
  *	brelse:
  *
@@ -1647,20 +1638,9 @@ brelse(struct buf *bp)
 	 * 
 	 * We still allow the B_INVAL case to call vfs_vmio_release(), even
 	 * if B_DELWRI is set.
-	 *
-	 * If B_DELWRI is not set we may have to set B_RELBUF if we are low
-	 * on pages to return pages to the VM page queues.
 	 */
 	if (bp->b_flags & B_DELWRI)
 		bp->b_flags &= ~B_RELBUF;
-	else if (buf_vm_page_count_severe()) {
-		/*
-		 * BKGRDINPROG can only be set with the buf and bufobj
-		 * locks both held.  We tolerate a race to clear it here.
-		 */
-		if (!(bp->b_vflags & BV_BKGRDINPROG))
-			bp->b_flags |= B_RELBUF;
-	}
 
 	/*
 	 * VMIO buffer rundown.  It is not very necessary to keep a VMIO buffer
@@ -1875,20 +1855,6 @@ bqrelse(struct buf *bp)
 		if ((bp->b_flags & B_DELWRI) == 0 &&
 		    (bp->b_xflags & BX_VNDIRTY))
 			panic("bqrelse: not dirty");
-		/*
-		 * BKGRDINPROG can only be set with the buf and bufobj
-		 * locks both held.  We tolerate a race to clear it here.
-		 */
-		if (buf_vm_page_count_severe() &&
-		    (bp->b_vflags & BV_BKGRDINPROG) == 0) {
-			/*
-			 * We are too low on memory, we have to try to free
-			 * the buffer (most importantly: the wired pages
-			 * making up its backing store) *now*.
-			 */
-			brelse(bp);
-			return;
-		}
 		qindex = QUEUE_CLEAN;
 	}
 	binsfree(bp, qindex);
@@ -1934,8 +1900,6 @@ vfs_vmio_release(struct buf *bp)
 				vm_page_free(m);
 		} else if (bp->b_flags & B_DIRECT)
 			vm_page_try_to_free(m);
-		else if (buf_vm_page_count_severe())
-			vm_page_try_to_cache(m);
 		vm_page_unlock(m);
 	}
 	if (obj != NULL)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507230220.t6N2KgG9070819>